mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-28 05:39:35 +08:00
Merge pull request #865 from stweil/posix
Replace Tesseract data types by POSIX data types
This commit is contained in:
commit
b2454d2f2e
@ -760,7 +760,7 @@ void TessBaseAPI::DumpPGM(const char* filename) {
|
||||
fprintf(fp, "P5 %d %d 255\n", width, height);
|
||||
for (int y = 0; y < height; ++y, data += pixGetWpl(pix)) {
|
||||
for (int x = 0; x < width; ++x) {
|
||||
uinT8 b = GET_DATA_BIT(data, x) ? 0 : 255;
|
||||
uint8_t b = GET_DATA_BIT(data, x) ? 0 : 255;
|
||||
fwrite(&b, 1, 1, fp);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
// fool the intrinsics into thinking we are extracting the bottom int64.
|
||||
auto cast_sum = _mm256_castpd_si256(sum);
|
||||
*(reinterpret_cast<inT64*>(&result)) =
|
||||
*(reinterpret_cast<int64_t*>(&result)) =
|
||||
#if defined(_WIN32) || defined(__i386__)
|
||||
// This is a very simple workaround that is activated
|
||||
// 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");
|
||||
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");
|
||||
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.
|
||||
// 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 offset = 0;
|
||||
// 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 = _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) {
|
||||
result += u[offset] * v[offset];
|
||||
++offset;
|
||||
|
@ -28,7 +28,7 @@ namespace tesseract {
|
||||
double DotProductSSE(const double* u, const double* v, int n);
|
||||
// Computes and returns the dot product of the n-vectors u and v.
|
||||
// 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.
|
||||
|
||||
|
@ -641,7 +641,7 @@ void Tesseract::rejection_passes(PAGE_RES* page_res,
|
||||
word_char_quality(word, page_res_it.row()->row,
|
||||
&all_char_quality, &accepted_all_char_quality);
|
||||
stats_.doc_char_quality += all_char_quality;
|
||||
uinT8 permuter_type = word->best_choice->permuter();
|
||||
uint8_t permuter_type = word->best_choice->permuter();
|
||||
if ((permuter_type == SYSTEM_DAWG_PERM) ||
|
||||
(permuter_type == FREQ_DAWG_PERM) ||
|
||||
(permuter_type == USER_DAWG_PERM)) {
|
||||
@ -1881,7 +1881,7 @@ BOOL8 Tesseract::check_debug_pt(WERD_RES *word, int location) {
|
||||
static void find_modal_font( //good chars in word
|
||||
STATS *fonts, //font stats
|
||||
inT16 *font_out, //output font
|
||||
inT8 *font_count //output count
|
||||
int8_t *font_count //output count
|
||||
) {
|
||||
inT16 font; //font index
|
||||
inT32 count; //pile couat
|
||||
@ -1999,7 +1999,7 @@ void Tesseract::font_recognition_pass(PAGE_RES* page_res) {
|
||||
}
|
||||
}
|
||||
inT16 doc_font; // modal font
|
||||
inT8 doc_font_count; // modal font
|
||||
int8_t doc_font_count; // modal font
|
||||
find_modal_font(&doc_fonts, &doc_font, &doc_font_count);
|
||||
if (doc_font_count == 0)
|
||||
return;
|
||||
|
@ -69,10 +69,10 @@ void Tesseract::recog_word(WERD_RES *word) {
|
||||
}
|
||||
if (tessedit_override_permuter) {
|
||||
/* Override the permuter type if a straight dictionary check disagrees. */
|
||||
uinT8 perm_type = word->best_choice->permuter();
|
||||
uint8_t perm_type = word->best_choice->permuter();
|
||||
if ((perm_type != SYSTEM_DAWG_PERM) &&
|
||||
(perm_type != FREQ_DAWG_PERM) && (perm_type != USER_DAWG_PERM)) {
|
||||
uinT8 real_dict_perm_type = dict_word(*word->best_choice);
|
||||
uint8_t real_dict_perm_type = dict_word(*word->best_choice);
|
||||
if (((real_dict_perm_type == SYSTEM_DAWG_PERM) ||
|
||||
(real_dict_perm_type == FREQ_DAWG_PERM) ||
|
||||
(real_dict_perm_type == USER_DAWG_PERM)) &&
|
||||
|
Loading…
Reference in New Issue
Block a user