tesseract  4.1.0
tesseract::SIMDDetect Class Reference

#include <simddetect.h>

Static Public Member Functions

static bool IsAVXAvailable ()
 
static bool IsAVX2Available ()
 
static bool IsAVX512FAvailable ()
 
static bool IsAVX512BWAvailable ()
 
static bool IsSSEAvailable ()
 
static TESS_API void Update ()
 

Detailed Description

Definition at line 31 of file simddetect.h.

Member Function Documentation

static bool tesseract::SIMDDetect::IsAVX2Available ( )
inlinestatic

Definition at line 38 of file simddetect.h.

38  {
39  return detector.avx2_available_;
40  }
static bool tesseract::SIMDDetect::IsAVX512BWAvailable ( )
inlinestatic

Definition at line 46 of file simddetect.h.

46  {
47  return detector.avx512BW_available_;
48  }
static bool tesseract::SIMDDetect::IsAVX512FAvailable ( )
inlinestatic

Definition at line 42 of file simddetect.h.

42  {
43  return detector.avx512F_available_;
44  }
static bool tesseract::SIMDDetect::IsAVXAvailable ( )
inlinestatic

Definition at line 34 of file simddetect.h.

34  {
35  return detector.avx_available_;
36  }
static bool tesseract::SIMDDetect::IsSSEAvailable ( )
inlinestatic

Definition at line 50 of file simddetect.h.

50  {
51  return detector.sse_available_;
52  }
void tesseract::SIMDDetect::Update ( )
static

Definition at line 162 of file simddetect.cpp.

162  {
163  // Select code for calculation of dot product based on the
164  // value of the config variable if that value is not empty.
165  const char* dotproduct_method = "generic";
166  if (!strcmp(dotproduct.string(), "auto")) {
167  // Automatic detection. Nothing to be done.
168  } else if (!strcmp(dotproduct.string(), "generic")) {
169  // Generic code selected by config variable.
170  SetDotProduct(DotProductGeneric);
171  dotproduct_method = "generic";
172  } else if (!strcmp(dotproduct.string(), "native")) {
173  // Native optimized code selected by config variable.
174  SetDotProduct(DotProductNative);
175  dotproduct_method = "native";
176 #if defined(AVX2)
177  } else if (!strcmp(dotproduct.string(), "avx2")) {
178  // AVX2 selected by config variable.
180  dotproduct_method = "avx2";
181 #endif
182 #if defined(AVX)
183  } else if (!strcmp(dotproduct.string(), "avx")) {
184  // AVX selected by config variable.
186  dotproduct_method = "avx";
187 #endif
188 #if defined(SSE4_1)
189  } else if (!strcmp(dotproduct.string(), "sse")) {
190  // SSE selected by config variable.
192  dotproduct_method = "sse";
193 #endif
194  } else if (!strcmp(dotproduct.string(), "std::inner_product")) {
195  // std::inner_product selected by config variable.
196  SetDotProduct(DotProductStdInnerProduct);
197  dotproduct_method = "std::inner_product";
198  } else {
199  // Unsupported value of config variable.
200  tprintf("Warning, ignoring unsupported config variable value: dotproduct=%s\n",
201  dotproduct.string());
202  tprintf("Support values for dotproduct: auto generic native"
203 #if defined(AVX)
204  " avx"
205 #endif
206 #if defined(SSE4_1)
207  " sse"
208 #endif
209  " std::inner_product.\n");
210  }
211 
212  dotproduct.set_value(dotproduct_method);
213 }
static const IntSimdMatrix intSimdMatrixAVX2
double DotProductAVX(const double *u, const double *v, int n)
double DotProductNative(const double *u, const double *v, int n)
Definition: dotproduct.cpp:22
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:36
static const IntSimdMatrix intSimdMatrixSSE
double DotProductSSE(const double *u, const double *v, int n)

The documentation for this class was generated from the following files: