mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 06:30:14 +08:00
arch: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
c1d649ebbc
commit
e7794c0c72
@ -90,7 +90,7 @@ double DotProductAVX(const double* u, const double* v, int n) {
|
|||||||
// instruction, as that introduces a 70 cycle delay. All this casting is to
|
// instruction, as that introduces a 70 cycle delay. All this casting is to
|
||||||
// fool the intrinsics into thinking we are extracting the bottom int64.
|
// fool the intrinsics into thinking we are extracting the bottom int64.
|
||||||
auto cast_sum = _mm256_castpd_si256(sum);
|
auto cast_sum = _mm256_castpd_si256(sum);
|
||||||
*(reinterpret_cast<inT64*>(&result)) =
|
*(reinterpret_cast<int64_t*>(&result)) =
|
||||||
#if defined(_WIN32) || defined(__i386__)
|
#if defined(_WIN32) || defined(__i386__)
|
||||||
// This is a very simple workaround that is activated
|
// This is a very simple workaround that is activated
|
||||||
// for all platforms that do not have _mm256_extract_epi64.
|
// for all platforms that do not have _mm256_extract_epi64.
|
||||||
|
@ -28,7 +28,7 @@ double DotProductSSE(const double* u, const double* v, int n) {
|
|||||||
fprintf(stderr, "DotProductSSE can't be used on Android\n");
|
fprintf(stderr, "DotProductSSE can't be used on Android\n");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
inT32 IntDotProductSSE(const inT8* u, const inT8* v, int n) {
|
int32_t IntDotProductSSE(const int8_t* u, const int8_t* v, int n) {
|
||||||
fprintf(stderr, "IntDotProductSSE can't be used on Android\n");
|
fprintf(stderr, "IntDotProductSSE can't be used on Android\n");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ double DotProductSSE(const double* u, const double* v, int n) {
|
|||||||
|
|
||||||
// Computes and returns the dot product of the n-vectors u and v.
|
// Computes and returns the dot product of the n-vectors u and v.
|
||||||
// Uses Intel SSE intrinsics to access the SIMD instruction set.
|
// Uses Intel SSE intrinsics to access the SIMD instruction set.
|
||||||
inT32 IntDotProductSSE(const inT8* u, const inT8* v, int n) {
|
int32_t IntDotProductSSE(const int8_t* u, const int8_t* v, int n) {
|
||||||
int max_offset = n - 8;
|
int max_offset = n - 8;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
// Accumulate a set of 4 32-bit sums in sum, by loading 8 pairs of 8-bit
|
// Accumulate a set of 4 32-bit sums in sum, by loading 8 pairs of 8-bit
|
||||||
@ -128,7 +128,7 @@ inT32 IntDotProductSSE(const inT8* u, const inT8* v, int n) {
|
|||||||
// Sum the 4 packed 32 bit sums and extract the low result.
|
// Sum the 4 packed 32 bit sums and extract the low result.
|
||||||
sum = _mm_hadd_epi32(sum, sum);
|
sum = _mm_hadd_epi32(sum, sum);
|
||||||
sum = _mm_hadd_epi32(sum, sum);
|
sum = _mm_hadd_epi32(sum, sum);
|
||||||
inT32 result = _mm_cvtsi128_si32(sum);
|
int32_t result = _mm_cvtsi128_si32(sum);
|
||||||
while (offset < n) {
|
while (offset < n) {
|
||||||
result += u[offset] * v[offset];
|
result += u[offset] * v[offset];
|
||||||
++offset;
|
++offset;
|
||||||
|
@ -28,7 +28,7 @@ namespace tesseract {
|
|||||||
double DotProductSSE(const double* u, const double* v, int n);
|
double DotProductSSE(const double* u, const double* v, int n);
|
||||||
// Computes and returns the dot product of the n-vectors u and v.
|
// Computes and returns the dot product of the n-vectors u and v.
|
||||||
// Uses Intel SSE intrinsics to access the SIMD instruction set.
|
// Uses Intel SSE intrinsics to access the SIMD instruction set.
|
||||||
inT32 IntDotProductSSE(const inT8* u, const inT8* v, int n);
|
int32_t IntDotProductSSE(const int8_t* u, const int8_t* v, int n);
|
||||||
|
|
||||||
} // namespace tesseract.
|
} // namespace tesseract.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user