mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-30 23:49:05 +08:00
Clean code for NEON support
Include it only for NEON and remove unneeded code. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
7b0e5b0722
commit
6732eb9eb5
@ -135,13 +135,16 @@ static void PrintVersionInfo() {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(HAVE_NEON)
|
||||
if (tesseract::SIMDDetect::IsNEONAvailable()) printf(" Found NEON\n");
|
||||
#else
|
||||
if (tesseract::SIMDDetect::IsAVX512BWAvailable()) printf(" Found AVX512BW\n");
|
||||
if (tesseract::SIMDDetect::IsAVX512FAvailable()) printf(" Found AVX512F\n");
|
||||
if (tesseract::SIMDDetect::IsAVX2Available()) printf(" Found AVX2\n");
|
||||
if (tesseract::SIMDDetect::IsAVXAvailable()) printf(" Found AVX\n");
|
||||
if (tesseract::SIMDDetect::IsFMAAvailable()) printf(" Found FMA\n");
|
||||
if (tesseract::SIMDDetect::IsSSEAvailable()) printf(" Found SSE\n");
|
||||
if (tesseract::SIMDDetect::IsNEONAvailable()) printf(" Found NEON\n");
|
||||
#endif
|
||||
#ifdef _OPENMP
|
||||
printf(" Found OpenMP %d\n", _OPENMP);
|
||||
#endif
|
||||
|
@ -2,7 +2,6 @@
|
||||
// File: intsimdmatrix.h
|
||||
// Description: Base class for 8-bit int SIMD matrix multipliers.
|
||||
// Author: Ray Smith
|
||||
// Created: Tue Aug 15 07:37:20 PST 2017
|
||||
//
|
||||
// (C) Copyright 2017, Google Inc.
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -114,9 +113,11 @@ struct IntSimdMatrix {
|
||||
// num_input_groups_ = num_inputs_per_register_ / num_inputs_per_group_
|
||||
|
||||
static const IntSimdMatrix* intSimdMatrix;
|
||||
// Only available with NEON.
|
||||
static const IntSimdMatrix intSimdMatrixNEON;
|
||||
// Only available with AVX2 / SSE.
|
||||
static const IntSimdMatrix intSimdMatrixAVX2;
|
||||
static const IntSimdMatrix intSimdMatrixSSE;
|
||||
static const IntSimdMatrix intSimdMatrixNEON;
|
||||
};
|
||||
|
||||
} // namespace tesseract
|
||||
|
@ -16,9 +16,7 @@
|
||||
// limitations under the License.
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(__ARM_NEON)
|
||||
//#error Implementation only for NEON capable architectures
|
||||
#else
|
||||
#if defined(__ARM_NEON)
|
||||
|
||||
#include "intsimdmatrix.h"
|
||||
|
||||
@ -158,4 +156,4 @@ const IntSimdMatrix IntSimdMatrix::intSimdMatrixNEON = {
|
||||
|
||||
} // namespace tesseract.
|
||||
|
||||
#endif
|
||||
#endif /* __ARM_NEON */
|
||||
|
@ -66,6 +66,10 @@ static STRING_VAR(dotproduct, "auto",
|
||||
|
||||
SIMDDetect SIMDDetect::detector;
|
||||
|
||||
#if defined(HAVE_NEON)
|
||||
// If true, then Neon has been detected.
|
||||
bool SIMDDetect::neon_available_;
|
||||
#else
|
||||
// If true, then AVX has been detected.
|
||||
bool SIMDDetect::avx_available_;
|
||||
bool SIMDDetect::avx2_available_;
|
||||
@ -75,8 +79,7 @@ bool SIMDDetect::avx512BW_available_;
|
||||
bool SIMDDetect::fma_available_;
|
||||
// If true, then SSe4.1 has been detected.
|
||||
bool SIMDDetect::sse_available_;
|
||||
// If true, then Neon has been detected.
|
||||
bool SIMDDetect::neon_available_;
|
||||
#endif
|
||||
|
||||
// Computes and returns the dot product of the two n-vectors u and v.
|
||||
static double DotProductGeneric(const double* u, const double* v, int n) {
|
||||
@ -188,8 +191,6 @@ SIMDDetect::SIMDDetect() {
|
||||
neon_available_ = (android_getCpuFeatures() &
|
||||
ANDROID_CPU_ARM64_FEATURE_ASIMD);
|
||||
#endif
|
||||
else
|
||||
neon_available_ = false;
|
||||
}
|
||||
#else
|
||||
/* Assume linux */
|
||||
|
Loading…
Reference in New Issue
Block a user