Commit Graph

4218 Commits

Author SHA1 Message Date
Stefan Weil
a1c8841725 Remove unused FeatureEnabled from FEATURE_DEFS_STRUCT
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:13:33 +01:00
Stefan Weil
b38c6d6ce4 Fix CID 1164622 (Uninitialized pointer field)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:13:26 +01:00
Stefan Weil
b5655827c1 Fix CID 1164620 (Uninitialized pointer field)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:13:20 +01:00
Stefan Weil
33ee0694d1 Fix CID 1386105 (Logically dead code)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:13:13 +01:00
Stefan Weil
d6401f924c Fix CID 1402767 (Invalid type in argument to printf format specifier)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:13:07 +01:00
Stefan Weil
c09eea18ae Remove unused italic, bold in class BLOCK_RES and class WORD_RES
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:13:00 +01:00
Stefan Weil
3a88b99c2b Fix CID 1340276 (Uninitialized scalar field) for class BLOB_CHOICE
xgap_before_ and xgap_after_ are never used, so remove them.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:12:51 +01:00
Stefan Weil
3f86fc8f1a Fix CID 1400760 (Uninitialized scalar field) for class BLOCK
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:10:52 +01:00
zdenop
0a5443c93c Fix two issues reported by Coverity Scan and modernize class WERD_RES
Report from Coverity Scan:

    CID 1405560 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
    2. uninit_member: Non-static class member end is not initialized in
    this constructor nor in any functions that it calls.

    CID 1405561 [...]

Modernize and optimize class WERD_RES. This not only fixes the issues
but also reduces the size and eliminates the functions InitNonPointers
and InitPointers.

Signed-off-by: Stefan Weil <sw@weilnetz.de>

# Conflicts:
#	src/ccstruct/pageres.h
2019-11-01 14:10:32 +01:00
Stefan Weil
f86f839ab8 Optimize classes Trie, Dawg and DawgPosition
Reduce size from 368 to 352 bytes for Trie, 72 to 64 bytes for Dawg
and 40 to 24 bytes for DawgPosition by avoiding holes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:06:14 +01:00
Stefan Weil
e6728ff055 Optimize classes CLIST_ITERATOR, ELIST_ITERATOR, ELIST2_ITERATOR
Reduce size from 56 to 48 bytes by avoiding holes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:06:07 +01:00
Stefan Weil
7601034772 Optimize class Classify
Reduce size from 138016 to 13000 bytes by avoiding holes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:06:02 +01:00
Stefan Weil
39788fc7eb Optimize class TFile
Reduce size from 24 to 16 bytes by avoiding holes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:05:56 +01:00
Stefan Weil
fbb9db8352 Optimize class ColPartition
Reduce size from 248 to 224 bytes by avoiding holes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:05:50 +01:00
Stefan Weil
e77f957357 Optimize struct LMConsistencyInfo
Reduce size from 104 to 96 bytes by avoiding holes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:05:44 +01:00
Stefan Weil
c48315ec21 Optimize class ViterbiStateEntry
Reduce size from 232 to 216 bytes by avoiding holes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:05:38 +01:00
Stefan Weil
69c4829743 Modernize and optimize BLOBNBOX and remove BLOBNBOX::ConstructionInit
The class no longer uses bit fields. Re-ordering the member variables
avoids holes and reduces the size of BLOBNBOX from 168 to 152 bytes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:03:29 +01:00
Stefan Weil
b8c516de9c tfnetwork: Fix info text
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:03:22 +01:00
Stefan Weil
591110ecac Re-order commands in autogen.sh
This avoids an unnecessary reconfiguration when running

    ./autogen.sh && ./configure && make

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:03:16 +01:00
Stefan Weil
8615e6e36c RecodedCharIDHash: Fix runtime errors detected by UndefinedBehaviorSanitizer
Fix this runtime error in recodebeam_test and unicharcompress_test:

    src/ccutil/unicharcompress.h:84:27: runtime error:
      left shift of 267 by 28 places cannot be represented in type 'int'

code has up to kMaxCodeLen (9) values, so the highest possible value for
i is 8, and the shift value can reach 7 * 8 = 56.

That requires an uint64_t data type.
size_t would fit for 64 bit hosts, but be too small for 32 bit hosts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:03:07 +01:00
Stefan Weil
e4389be97e OSResults: Fix runtime errors detected by UndefinedBehaviorSanitizer
Fix this runtime error in osd_test and textlineprojection_test:

    src/ccmain/osdetect.cpp:109:14: runtime error: division by zero

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:03:00 +01:00
Stefan Weil
3951f840b9 BitVector: Fix runtime errors detected by UndefinedBehaviorSanitizer
Fix these runtime errors in mastertrainer_test:

    src/ccutil/bitvector.cpp:119:18: runtime error:
      null pointer passed as argument 2, which is declared to never be null
    src/ccutil/bitvector.cpp:124:10: runtime error:
      null pointer passed as argument 1, which is declared to never be null

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:02:53 +01:00
Stefan Weil
e11e50fda7 ccutil: Remove old comments
There is no CLIST2 in the current code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:02:20 +01:00
Stefan Weil
e142b5ec26 Use type bool for boolean values in class BLOBNBOX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:02:12 +01:00
Stefan Weil
df3612d366 Fix warnings from LGTM
This fixes three LGTM warnings:

    Multiplication result may overflow 'float' before it is converted to 'double'.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:01:19 +01:00
Stefan Weil
84083138fb fuzzer-api: Use optional macro LIB_FUZZING_ENGINE for build
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:01:13 +01:00
Stefan Weil
0a9ef388b5 Add missing TensorFlow libraries for fuzzer-api
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:01:04 +01:00
Stefan Weil
e892cc272f Fix crash when function lookup tables are accessed with NaN
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:00:49 +01:00
Stefan Weil
863a5b4232 capi: Add missing PSM_RAW_LINE to TessPageSegMode
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:00:31 +01:00
zdenop
f15e2cc174 fix typo 2019-11-01 14:00:22 +01:00
Stefan Weil
7e980df016 simd: Check whether the OS supports FMA, AVX, ...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 14:00:00 +01:00
Stefan Weil
e413b9318b classify/Makefile: Fix inconsistent style
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 13:59:33 +01:00
Julian Gilbey
d8f695271f fix #2616: allow building of training data
This fixes Issue #2616 by preventing an attempt to build the recognition engine when running tesstrain.sh.
2019-11-01 13:59:26 +01:00
Egor Pugin
55b4099ad1 Export some classify vars. 2019-11-01 13:59:14 +01:00
zdenop
0d8be252cc Remove more code for builds with disabled legacy engine
Now the Tesseract library no longer includes unused code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>

# Conflicts:
#	src/cutil/Makefile.am
#	unittest/Makefile.am
2019-11-01 13:58:37 +01:00
Stefan Weil
b52c466ab4 [sw] Update build for commit e84cb24def
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 13:51:01 +01:00
Egor Pugin
0bce4ebb2b [sw] Try to fix build. 2019-11-01 13:50:53 +01:00
zdenop
c9ecab8854 Move source files which are used for training only to src/training 2019-11-01 13:50:26 +01:00
Stefan Weil
b80acd81ba OpenCL: Add static attribute for kernel_src
It is only used in openclwrapper.cpp.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 13:36:22 +01:00
Stefan Weil
14665dfa2c Remove unused functions create_edges_window, draw_raw_edge
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 13:36:15 +01:00
Stefan Weil
91f0de94bc Remove unused function truncate_path and related files
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 13:36:07 +01:00
Stefan Weil
c3d4742af6 Remove global array kPolyBlockNames from Tesseract library
It is only used in unittest/layout_test.cc after moving a test from
baseapi_test.cc to that file, so it can be made local.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 13:35:55 +01:00
Egor Pugin
25c411c86c [sw] Update build script. 2019-11-01 13:00:10 +01:00
Stefan Weil
92b460010e cmake: Don't link pthread on Windows
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 13:00:03 +01:00
Stefan Weil
5989f128a3 Fix linker error in Appveyor CI
This completes commit c5a50b93ce.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 12:59:52 +01:00
Stefan Weil
5d2265478f universalambigs: Add hack to fix builds with Microsoft compiler
The MS compiler only accepts string constants up to 65535 characters,
so shorten the string for that compiler to fix the compilation.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 12:59:44 +01:00
Egor Pugin
26feea5ef4 [sw] Use the latest pango again. 2019-11-01 12:59:37 +01:00
Zdenko Podobný
9dd392d8b2 move fileio.cpp and fileio.h to training (this fix android build) 2019-11-01 12:59:31 +01:00
Stefan Weil
ea34763fea universalambigs: Replace octal characters by UTF-8 string
This improves readability and reduces the file size.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 12:59:20 +01:00
Stefan Weil
a473283482 Clean ambigs.h
* Remove unused kUnigramAmbigsBufferSize and kAmbigNgramSeparator
* Move some declarations to ambigs.cpp

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-01 12:59:12 +01:00