Stefan Weil
d8d63fd71b
Optimize performance with clang-tidy
...
The code was partially formatted with clang-format and optimized with
clang-tidy --checks="-*,perfor*" --fix src/*/*.cpp
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-11-14 15:54:04 +01:00
Stefan Weil
73a1bfc4e8
Run ReCachePages synchronously during training (fix issue #3111 )
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-10-28 14:40:27 +02:00
Stefan Weil
97048fe3e4
ccstruct: Fix some signed/unsigned compiler warnings
...
Remove also a local buffer in function REJMAP::print.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-10-10 20:00:31 +02:00
Tadahito Yao
12e0fb4e01
Fix deadlock in lstmtraing. ( #3488 )
2021-07-10 10:59:10 +03:00
Egor Pugin
306d296979
Add Image::clone().
2021-04-01 17:06:30 +03:00
Egor Pugin
2aca22439e
Add Image::copy().
2021-04-01 16:55:43 +03:00
Stefan Weil
5159f9aa12
Fix name conflict between class and function named Image
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-04-01 14:00:08 +02:00
Egor Pugin
1628a9aae3
Revert 4fa05b9147
. Make a note.
2021-04-01 01:35:50 +03:00
Egor Pugin
a792b67983
Basic usage of new Image class. Only pixDestroy is wrapped at the moment.
...
Add new methods to Image class and replace them in non-public code.
2021-03-31 22:39:43 +03:00
Egor Pugin
4fa05b9147
Remove unused ifdef.
2021-03-31 21:54:12 +03:00
Stefan Weil
0f72e0fdb3
Simplify checks for emptiness
...
Replace the patterns (x.size() == 0) and (x.length() == 0) by x.empty().
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-26 23:22:50 +01:00
Stefan Weil
ef645ce334
Avoid lots of messages for training with single line images
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-22 16:06:30 +01:00
Stefan Weil
d4d51910e1
Add braces to single line statements (clang-tidy -checks='-*,google-readability-braces-around-statements')
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-22 09:02:13 +01:00
Stefan Weil
27293fad62
Modernize code (clang-tidy -checks='-*,modernize-use-emplace')
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-21 21:45:55 +01:00
Stefan Weil
02774bda6e
Modernize code (clang-tidy -checks='-*,modernize-loop-convert')
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-21 21:45:55 +01:00
Stefan Weil
7207cf13d7
Replace more PointerVector by std::vector for src/ccstruct
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-19 21:53:08 +01:00
Stefan Weil
79477dc2fe
Replace more PointerVector by std::vector for src/ccstruct
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-19 14:46:25 +01:00
Stefan Weil
177703c562
Replace more GenericVector by std::vector for src/ccstruct
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-18 16:46:56 +01:00
Stefan Weil
9e566de0f2
Remove unused classes WordFeature, FloatWordFeature
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-18 16:46:56 +01:00
Stefan Weil
7b92614efa
Replace more GenericVector by std::vector for src/ccstruct
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-18 16:46:56 +01:00
Stefan Weil
d16fba9bed
Replace all but one remaining STRING by std::string in src/ccstruct
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-15 09:11:41 +01:00
Stefan Weil
c9f0da49ca
Replace more STRING by std::string
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-13 21:15:52 +01:00
Egor Pugin
0eb7ba88bf
[clang-format] Execute clang format on include and src dirs.
...
Script:
find include src -type f | sort > all.txt
find include src -type f | grep -v "\.cpp" | grep -v "\.h" | sort > skip.txt
comm -23 all.txt skip.txt | xargs clang-format -i
2021-03-12 22:35:02 +03:00
Stefan Weil
4c6cc5a04d
Replace GenericVector by std::vector in class ImageData
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-12 13:10:25 +01:00
Stefan Weil
0cde3ede98
Add heuristic to fix swap (partially fixes issue #2586 )
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-05 14:27:28 +01:00
Stefan Weil
a2769aebb4
Replace GenericVector<TBOX> by std::vector<TBOX>
...
Fix also endianness handling for (de)serialisation of TBOX.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-05 14:27:28 +01:00
Stefan Weil
ff830775f9
Fix memory leak in DocumentCache
...
It was introduced in commit 5cac52173e
.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-01 11:31:48 +01:00
Stefan Weil
1d7a981203
Disable code for unused classes WordFeature and FloatWordFeature
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-26 21:42:17 +01:00
Stefan Weil
5cac52173e
Replace PointerVector by std::vector in class DocumentCache
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-26 21:42:07 +01:00
Stefan Weil
bc69e28de3
Update include statements for external header file allheaders.h
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-13 10:17:20 +01:00
Stefan Weil
fc4002dda8
Remove helpers.h from public API
...
Remove also outdated references to apitypes.h which no longer exists.
Signed-off-by: Stefan Weil <sw@weil.de>
2020-12-31 09:06:16 +01:00
Stefan Weil
4043204c2b
Use old genericvector.h
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-30 07:10:29 +01:00
Stefan Weil
f4e380f64a
Remove serialis.h from public API
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-29 11:28:50 +01:00
Stefan Weil
e2683e17fc
Remove unused DocumentData::SaveToBuffer
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-29 10:43:00 +01:00
Egor Pugin
79a86f2582
Move all tesseract symbols into tesseract namespace. Fix include order in many places.
2020-12-26 00:55:30 +03:00
zdenop
7fa200bfb7
Merge pull request #3064 from robinwatts/pushback12
...
Fix Memory leak when using TESSERACT_IMAGEDATA_AS_PIX
2020-07-15 19:08:58 +02:00
Robin Watts
7f45b719d1
Fix Memory leak when using TESSERACT_IMAGEDATA_AS_PIX
...
If building with TESSERACT_IMAGEDATA_AS_PIX, then tesseract
doesn't compress/decompress images, but rather holds the
data as internal Pix structures. Unfortunately, I forgot to
make the ImageData destructor free these, so memory leaked
during use. Fixed here.
2020-07-15 12:35:35 +01:00
Stefan Weil
cb3880fb15
Disable more code and data with GRAPHICS_DISABLED
...
Some runtime parameters which are only relevant with graphics enabled
were now removed from builds when graphics was disabled.
TableFinder::DisplayColSegmentGrid is never used, so remove it completely.
Builds with --disable-graphics significantly reduce the code size and avoid
some function calls which might be important for certain applications:
text data bss dec hex filename
3219230 41136 13920 3274286 31f62e .libs/libtesseract.so (--disable-graphics, old)
3211347 40976 13600 3265923 31d583 .libs/libtesseract.so (--disable-graphics, new)
3360942 43656 15392 3419990 342f56 .libs/libtesseract.so (default)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-07-09 11:23:33 +02:00
Stefan Weil
8137cf35a6
Use const char* for filename parameters
...
This replaces the proprietary STRING data type
(801 instead of 838 lines remaining).
It also removes STRING from osdetect.h and serialis.h.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-07-07 14:20:09 +02:00
zdenop
4ef709554b
Update imagedata.cpp
...
stop PreScale if pixScale failed (fixes #3025 )
2020-06-25 20:32:51 +02:00
Stefan Weil
62b085cb8d
ScrollView: Remove C API callcpp.{cpp,h}
...
Use C++ class ScrollView directly instead of using an intermediate C API.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-22 09:14:26 +02:00
Stefan Weil
d8500adcf4
Fix crash caused by missing thread synchronization (issues #757 , #1168 and #2191 )
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-14 15:53:17 +02:00
zdenop
b5d639dcc5
Merge pull request #2965 from robinwatts/pushback1
...
thanks.
2020-05-16 20:35:19 +02:00
Julian Gilbey
e7e6999d3b
Move comment about swap meaning for DeSerialize to correct function
2020-05-13 07:02:59 +01:00
Robin Watts
6bcb941bcf
Avoid tesseract writing Pix out/reading them back.
...
By default, when we ImageData::SetPix, we write the data out as a
PNG, just to read it back in to get a compressed buffer of data.
We then use this to generate a new Pix.
In builds of Tesseract on systems where we don't have temp files,
writing files out is problematic.
Not only that, but compressing/uncompressing is slow, and on minimal
builds of leptonica, where we've disabled the format writers to reduce
memory footprint, we get no compression anyway.
In such cases, it'd be far nicer just to keep the original Pix as
the internal data.
Also, when recovering the pixmap from the ImageData, if we know we're
only going to read from the data, we can avoid duplicating it and
just use the original. This is exactly the case when GRAPHICS_DISABLED
is set.
So, introduce a TESSERACT_IMAGEDATA_AS_PIX predefine that we can use
to cause the internal data to be a Pix rather than a compressed
buffer.
Given we don't do compression, and they were writing to memory,
this was all just more effort than we needed.
Also, if we're using GRAPHICS_DISABLED, we might as well just
pixCopy rather than pixClone as only the scaler uses this.
2020-05-04 21:01:22 +01:00
Egor Pugin
2a37f5dd62
Update includes to use <>.
2019-10-29 14:50:11 +03:00
amitdo
e1bae15547
Fix #include path of public headers
2019-10-28 19:10:30 +02:00
Stefan Weil
994ec697d8
Remove member functions STRING::string and StringParam::string
...
They were redundant because there exist member functions 'c_str' which do the same.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-09-23 08:33:08 +02:00
Stefan Weil
fcfdb7e56f
Remove unused include statements
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 14:48:31 +02:00
Stefan Weil
a6d723bf10
Replace SVSync::StartThread by std::thread and use std::this_thread::yield
...
Using yield instead of a sleep makes running imagedata_test much faster.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 14:30:51 +02:00