Commit Graph

2697 Commits

Author SHA1 Message Date
Stefan Weil
46c887b77e genericvector: Fix minimum size
Commit 907de5995f tried to improve
GenericVector, but missed a case where vectors with less than
kDefaultVectorSize were allocated. This resulted in additional
alloc / free operations.

Commit a28b2a033d (before memory optimization)
oem 0: total heap usage: 739,238 allocs, 739,237 frees, 161,699,214 bytes allocated
oem 1: total heap usage: 690,182 allocs, 690,175 frees, 144,470,400 bytes allocated
oem 2: total heap usage: 728,213 allocs, 728,206 frees, 182,885,824 bytes allocated

Commit fd3f8f9b2d without genericvector change
oem 0: total heap usage: 738,980 allocs, 738,979 frees, 161,697,150 bytes allocated
oem 1: total heap usage: 690,182 allocs, 690,175 frees, 144,470,400 bytes allocated
oem 2: total heap usage: 728,213 allocs, 728,206 frees, 182,885,824 bytes allocated
=> Improvements for oem 0, no change for oem 1 and oem 2.

Commit fd3f8f9b2d
oem 0: total heap usage: 772,648 allocs, 772,647 frees, 160,083,901 bytes allocated
oem 1: total heap usage: 748,591 allocs, 748,584 frees, 143,581,672 bytes allocated
oem 2: total heap usage: 764,796 allocs, 764,789 frees, 181,212,197 bytes allocated
=> Less bytes allocated, but more allocs / frees = bad for performance.

Commit fd3f8f9b2d with this patch
oem 0: total heap usage: 677,537 allocs, 677,536 frees, 160,444,634 bytes allocated
oem 1: total heap usage: 653,812 allocs, 653,805 frees, 143,423,008 bytes allocated
oem 2: total heap usage: 670,029 allocs, 670,022 frees, 181,517,760 bytes allocated
=> Improvements for all three cases.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-03 09:49:23 +02:00
zdenop
b2454d2f2e Merge pull request #865 from stweil/posix
Replace Tesseract data types by POSIX data types
2017-05-03 08:42:07 +02:00
Stefan Weil
5cc8c058fa ccmain: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-02 18:21:51 +02:00
Stefan Weil
e7794c0c72 arch: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-02 18:21:44 +02:00
Stefan Weil
c1d649ebbc api: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-02 18:21:44 +02:00
zdenop
b4d77057d6 Merge pull request #863 from stweil/warnings
Remove unused local variables
2017-05-02 14:46:02 +02:00
Stefan Weil
048cf9d06a Remove unused local variables
This fixes some compiler warnings.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-02 09:43:29 +02:00
zdenop
5eb9f0c392 Merge pull request #862 from stweil/doc
doc: Fix use of MAINTAINER_MODE
2017-05-02 08:39:26 +02:00
zdenop
b8137d810f Merge pull request #861 from stweil/malloc
Remove freelist,c and freelist.h
2017-05-02 08:37:00 +02:00
Stefan Weil
2f48d69bcd doc: Fix use of MAINTAINER_MODE
It must also include man_MANS – otherwise make tries to build the
man pages also in non maintainer mode without having a rule for that.

This fixes commit 2794410c9b.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-02 07:37:18 +02:00
Stefan Weil
6bfde5dcaf Remove undefined macro MAC_OR_DOS
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-01 18:17:33 +02:00
Stefan Weil
030d29a4d0 cutil: Remove unused freelist.c and freelist.h
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-01 18:14:00 +02:00
Stefan Weil
e219ad195c classify: Replace memfree by free
free also accepts a nullptr argument, so the code can be simplified.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-01 18:14:00 +02:00
Stefan Weil
1d6dd03bfc training: Replace memfree by free
free also accepts a nullptr argument, so the code can be simplified.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-01 18:14:00 +02:00
Stefan Weil
ca89a11f28 cutil: Remove unused code using memfree
The case (destructor == NULL) never occurs in the current code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-01 18:14:00 +02:00
Stefan Weil
80fdb634ba classify: Remove unused ContextsSeen
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-01 18:14:00 +02:00
zdenop
b9dff1607f Merge pull request #860 from stweil/malloc
Replace memalloc / memfree by C++ new / delete
2017-05-01 18:09:17 +02:00
Stefan Weil
300841f9a7 Replace memalloc / memfree by C++ new / delete
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-01 17:26:23 +02:00
zdenop
ebea04e67a Merge pull request #859 from stweil/unused
Remove unused code
2017-05-01 17:18:16 +02:00
Stefan Weil
85afda65f5 blobs: Remove unused macro
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-01 17:12:43 +02:00
Stefan Weil
aebdcd8bce Remove unused global function memrealloc
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-01 17:12:43 +02:00
Stefan Weil
445befd3cb Remove unused include statements for freelist.h
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-01 17:12:43 +02:00
zdenop
857d920c9b Merge pull request #856 from stweil/doc
RFC – doc: Remove generated files and add rules to build manpages
2017-05-01 16:03:17 +02:00
zdenop
6e80812ac8 Merge pull request #857 from stweil/new_delete
Avoid unnecessary new / delete code
2017-05-01 16:02:49 +02:00
Stefan Weil
6d19e7c3c0 SVNetwork: Avoid unneeded new / delete operations
The class variable mutex_send_ does not require an indirection
by using a pointer.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-04-30 19:58:58 +02:00
Stefan Weil
83588bc7a1 Classify: Avoid unneeded new / delete operations
Both class variables BaselineCutoffs and CharNormCutoffs were pointers
to fixed size arrays which were allocated in the constructor and
deallocated in the destructor. These two extra allocations and two
extra deallocations can be avoided.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-04-30 19:45:50 +02:00
Stefan Weil
bb75793539 ccstruct: Remove unneeded NULL checks
It's also not necessary to nullify class variables in the destructor.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-04-30 19:23:24 +02:00
Stefan Weil
aea0d9a8d5 api: Remove unneeded NULL checks
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-04-30 19:23:24 +02:00
zdenop
fd3f8f9b2d Merge pull request #352 from pnordhus/reduce_mallocs
Avoid unnecessary memory allocations
2017-04-30 17:39:31 +02:00
zdenop
a28b2a033d Merge pull request #855 from stweil/lept
Use Leptonica struct names L_Compressed_Data, Pix
2017-04-30 17:38:02 +02:00
zdenop
eaf5629b46 Merge pull request #744 from stweil/malloc
Replace alloc_struct, free_struct
2017-04-30 17:35:17 +02:00
Stefan Weil
2794410c9b doc: Remove generated files and add rules to build manpages
Those files can be built by doc/generate_manpages.sh.

The manpages are needed for the installation,
so add Makefile rules for them.

Git must ignore the generated manpages.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-04-30 11:27:17 +02:00
Stefan Weil
1c59914b61 Use Leptonica struct names L_Compressed_Data, Pix
The Tesseract project prefers that names, so fix the remaining exceptions.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-04-30 10:50:12 +02:00
Stefan Weil
f8fba59804 Replace alloc_struct, free_struct
Both functions simply call malloc, free.

Remove also unneeded null pointer checks and use calloc where possible.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-04-30 09:25:04 +02:00
Ray Smith
7a116ce8bb More formatting fixes from clang tidy 2017-04-28 13:38:32 -07:00
Ray Smith
77015526fa Jeff's fixes to pdf rendering 2017-04-28 13:38:13 -07:00
zdenop
13b7900ebf Merge pull request #778 from cjmayo/singleopts
tidy tesseract(1) adding missing options
2017-04-28 18:58:40 +02:00
zdenop
177ceff9dd Merge pull request #853 from stweil/doc
doc: Remove unsupported font name
2017-04-28 18:58:08 +02:00
zdenop
84f78f87c9 Merge pull request #851 from stweil/typo
Fix typo in comment
2017-04-28 18:56:47 +02:00
Stefan Weil
151a76ef26 doc: Remove unsupported font name
Fix this warning from doxygen:

    warning: doxygen no longer ships with the FreeSans font.
    You may want to clear or change DOT_FONTNAME.
    Otherwise you run the risk that the wrong font is being used for dot generated graphs.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-04-28 16:13:41 +02:00
Stefan Weil
73db84d674 Fix typo in comment
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-04-28 06:59:00 +02:00
Ray Smith
500bfaf315 Added std:: to some stl types 2017-04-27 17:15:35 -07:00
Ray Smith
1cc511188d Added extra Init that takes a memory buffer or a filereader function pointer to enable read of traineddata from memory or foreign file systems. Updated existing readers to use TFile API instead of FILE. This does not yet add big-endian capability to LSTM, but it is very easy from here. 2017-04-27 15:48:23 -07:00
zdenop
10e04ffe99 Merge pull request #849 from stweil/opencl
opencl: Remove more unused functions and related code
2017-04-27 09:02:56 +02:00
zdenop
394162e120 Merge pull request #848 from stweil/lept
ccstruct: Fix Leptonica data type
2017-04-27 09:01:43 +02:00
zdenop
72b86e098f Merge pull request #847 from stweil/crash
opencl: Fix crash on hosts with no OpenCL platform
2017-04-27 09:01:11 +02:00
Stefan Weil
582eaeba7d opencl: Remove more unused functions and related code
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-04-27 08:32:43 +02:00
Stefan Weil
b5abfb53d7 ccstruct: Fix Leptonica data type
L_Bmf works for C++ code, but the common form is L_BMF, so use that.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-04-27 07:51:50 +02:00
Stefan Weil
1e11b16d73 opencl: Fix crash on hosts with no OpenCL platform
A Tesseract binary with OpenCL support can also run on a host without
any OpenCL platform, as it simply uses the normal CPU based code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-04-27 07:50:05 +02:00
zdenop
50f92c8f23 Merge pull request #843 from stweil/opencl
opencl: Remove unused code
2017-04-26 15:20:10 +02:00