Commit Graph

335 Commits

Author SHA1 Message Date
Stefan Weil
aea0d9a8d5 api: Remove unneeded NULL checks
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-04-30 19:23:24 +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
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
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
James R. Barlow
f54577e6be Fix #786 - 3.05 linkage fails on macOS Sierra with --enable-opencl
Also needed for 4.00.
2017-04-10 22:22:49 -07:00
Jeff Breidenbach
9038faf436 Better escaping for PDF title; fixes #636 2017-04-02 19:01:16 +02:00
Igor Pylypiv
cea24b7e44 Remove redundant condition from TessBaseAPI::AdaptToWordStr()
Expression (wordstr[w] != '\0') is always true if (wordstr[w] == ' ') is true.
2017-03-23 22:55:40 -07:00
Chris Mayo
b231aee212 tidy tesseract(1) adding missing options
Together with:
- fix "C\++"
- align executable --print-parameters message
2017-03-23 20:02:50 +00:00
Stefan Weil
7b33dad059 api: Remove unused variables
This fixes a compiler warning:

api/baseapi.cpp:1621:17: warning:
 variable 'font_name' set but not used [-Wunused-but-set-variable]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-03-08 07:38:46 +01:00
Stefan Weil
cd925fd812 Fix indentation after conditional [-Wmisleading-indentation]
The indentation is wrong since commit
fd0683f9e0 and results in a gcc warning:

api/baseapi.cpp: In member function 'bool tesseract::TessBaseAPI::ProcessPagesMultipageTiff(const l_uint8*, size_t, const char*, const char*, int, tesseract::TessResultRenderer*, int)':
api/baseapi.cpp:986:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (tessedit_page_number >= 0)
     ^~
api/baseapi.cpp:988:7: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
       pix = (data) ? pixReadMemFromMultipageTiff(data, size, &offset)
       ^~~

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-03-07 19:05:40 +01:00
Jeff Breidenbach
fd0683f9e0 remove obsolete OpenCl code from TessBaseAPI::ProcessPagesMultipageTiff; fixes #635 2017-01-29 16:43:10 +01:00
Ray Smith
f566a45b30 clang-tidy changes from sync 2017-01-25 16:20:19 -08:00
Ray Smith
a1c22fb0d0 Fixed issue #557 2017-01-25 16:05:59 -08:00
Ray Smith
ca16a08c10 Removed dead TODO 2017-01-25 15:54:11 -08:00
Zdenko Podobný
8ce58ac458 Fix C-API 2017-01-21 07:40:54 +01:00
James R. Barlow
bf638b9202 Fix PDF syntax error: "XObject" instead of "/XObject" when textonly_pdf=false 2017-01-20 13:36:38 -08:00
Zdenko Podobný
effa5741e6 Implement invisible text only for PDF 2017-01-20 21:26:34 +01:00
Jeff Breidenbach
a979494897 fix #665 process file list 2017-01-19 15:19:35 +01:00
Stefan Weil
534a237015 Move AVX / SSE messages to function PrintVersionInfo (crash fix)
This information is not needed for normal runs, so it is sufficient
to show it on request (like versions and OpenCL information).

This also fixes a crash caused by undefined order of global constructors:

When the global variable SIMDDetect::detector is initialized before the
global variable debug_file, the first tprintf call in simddetect.cpp
crashes because of a NULL pointer in debug_file. This was only seen when
running with a shared library (libtesseract.so).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-12-28 13:35:44 +01:00
Stefan Weil
19616b07ba lstm: Move class SIMDDetect to new source file and improve code
Modify also the code to use a singleton. This simplifies the code as
no locking is needed. It also slightly improves the performance because
no check whether the architecture was tested is needed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-12-27 13:25:08 +01:00
Zdenko Podobný
11f205707e Multi-page TIFF buffering is broken - fix #233 2016-12-24 09:17:02 +01:00
Stefan Weil
b262136b45 opencl: Show up to four OpenCL platforms
The old code only allowed one platform.
Add also strict error handling.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-12-23 10:25:56 +01:00
Stefan Weil
c07c46524a Add missing Leptonica linker flags (needed for macOS)
This fixes a build regression caused by commit
d70f3c3663.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-12-19 22:27:12 +01:00
Stefan Weil
7c684be724 Add missing linker flags for Leptonica
They were removed in commit d70f3c3663.
The old code implicitly added `-llept` by using the `AC_CHECK_LIB` macro.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-12-15 17:28:01 +01:00
zdenop
da4c064c2e Merge pull request #531 from stweil/guards
Fix header file guards and replace reserved identifiers
2016-12-15 08:29:32 +01:00
Ray Smith
9d6e4f6c50 Fixed capi to remove cube part 2 2016-12-14 11:37:51 -08:00
Ray Smith
4b0dae5e22 Fixed capi to remove cube 2016-12-14 11:35:46 -08:00
Ray Smith
81ebba0394 More makefile changes to remove cube 2016-12-14 11:17:06 -08:00
Ray Smith
9f5ba9105f Removed dependency on cube from the code 2016-12-14 10:55:15 -08:00
Stefan Weil
9ec0c4fa9c api: Add missing dependency on libtiff
It is needed because of a direct call to TIFFSetWarningHandler.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-12-13 13:29:34 +01:00
Stefan Weil
224eb8ae04 openmp: Fix OpenMP support
Replace OPENMP_CFLAGS by OPENMP_CXXFLAGS.
This completes commit 6140be6a55.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-12-11 22:48:26 +01:00
zdenop
3a47adcbe1 Merge pull request #544 from jbarlow83/master
Add new C API for detecting orientation and script, remove old one (4.00)
2016-12-09 13:34:18 +01:00
James R. Barlow
56b6f061cd Revise after code review 2016-12-08 15:08:48 -08:00
James R. Barlow
fb7298e82e Remove unsafe API TessBaseAPIDetectOS entirely 2016-12-07 13:26:54 -08:00
James R. Barlow
bc95798e01 Implement a new orientation and script detection API for C and C++
See issue #424.

The existing C API for TessBaseAPIDetectOS requires a C caller to successfully allocate struct OSResults which is actually a C++ class.  Generally it won't
be possible for a regular C compiler to do this properly.

It's also assumed that most API level users of Tesseract are only interested in Tesseract's best guess as to script and orientation, not the individual values for all possible scripts.

This introduces a new API with a better name that is more closely aligned with the output of 'tesseract -psm 0'.  Both tesseract -psm 0 and this API now share the same code in baseapi.cpp.
2016-12-07 13:21:05 -08:00
Jeff Breidenbach
ed4c4c6bf5 Produce warning for invalid resolution. Fix #453 2016-12-07 22:06:00 +01:00
Stefan Weil
217a4dda43 tesseract: Disable Leptonica messages
Disable debugging and informational messages from Leptonica
for release builds.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-12-07 21:37:23 +01:00
zdenop
7f7cea1ee6 Merge pull request #532 from stweil/openmp
openmp: Fix build with clang++ and compilers without OpenMP support
2016-12-07 14:47:08 +01:00
Ray Smith
d55f462c9c More clang-tidy from previous commits 2016-12-06 13:45:49 -08:00
Ray Smith
5deebe6c27 Fixed multilang for LSTM, pushed cube to one side without actually deleting it 2016-12-05 14:41:43 -08:00
Stefan Weil
6140be6a55 openmp: Fix build with clang++ and compilers without OpenMP support
Builds without support for OpenMP failed with the old code. Fix this:

* Add OPENMP_CXXFLAGS for ccmain.
* Replace unconditional -fopenmp by OPENMP_CXXFLAGS for lstm.
* Always use _OPENMP for conditional compilation.
* Remove OPENMP as there is already _OPENMP.
* Include omp.h conditionally.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-12-04 18:44:03 +01:00
Stefan Weil
4897796d57 Replace reserved identifiers used in #define guards header files
Use macro names as suggested by the Google C++ Style Guide
(https://google.github.io/styleguide/cppguide.html#The__define_Guard).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-12-04 15:43:03 +01:00
Stefan Weil
cefc420ddb Remove extra semicolons after member function definitions
clang++ report:
api/baseapi.h:852:4: warning:
 extra ';' after member function definition [-Wextra-semi]
[...]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-12-04 14:54:52 +01:00
zdenop
e4faf95586 Merge pull request #515 from stweil/parameters
Support standard parameter form --oem, --psm for tesseract executable
2016-12-01 20:37:30 +01:00
Stefan Weil
92d981b93a Change tesseract parameter -psm to --psm
For compatibility reasons the old variant is still supported.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-30 22:23:46 +01:00
Stefan Weil
d2f9264383 Change tesseract parameter -oem to --oem
It was introduced recently in commit f24ef67d, so there is no need
to support the old variant for compatibility reasons.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-30 22:23:46 +01:00
Stefan Weil
78d91701bd Simplify new operations
It is not necessary to check for null pointers after new.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-30 20:24:38 +01:00
Stefan Weil
85e37798cb Simplify delete operations
It is not necessary to check for null pointers.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-24 17:59:13 +01:00