Commit Graph

1536 Commits

Author SHA1 Message Date
zdenop
871e500db7 Merge pull request #471 from ciupicri/patch-1
Fix a typo in tesseract(1) man page
2016-11-22 09:10:28 +01:00
zdenop
6f302a94d1 Merge pull request #489 from stweil/merge
add option "make training-uninstall"
2016-11-22 09:09:28 +01:00
Zdenko Podobný
b0abed73b9 add option "make training-uninstall" 2016-11-22 08:42:55 +01:00
zdenop
ac3b40de2f Merge pull request #478 from stweil/w
Fix some compiler warnings
2016-11-22 08:30:57 +01:00
zdenop
478011024a Merge pull request #488 from stweil/conflict
Fix an unfixed merge conflict
2016-11-22 08:29:59 +01:00
Stefan Weil
0c9235ebc2 Fix typos in new LSTM code
All of them were found and fixed by codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-22 08:25:43 +01:00
Stefan Weil
a7d2758876 opencl: Fix typo in name of local variable
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-22 08:25:43 +01:00
Stefan Weil
2fbc8cf4a9 Fix typo in documentation
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-22 08:25:43 +01:00
Stefan Weil
a0fc4320b7 Fix an unfixed merge conflict
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-22 08:24:44 +01:00
Ray Smith
9c7e99b041 Merged with commit 4ca6ba985b 2016-11-21 08:27:02 -08:00
Ray Smith
dd216f69e7 Added more missing license headers 2016-11-18 15:56:43 -08:00
Ray Smith
5913d7344f Added missing license headers 2016-11-18 15:53:11 -08:00
Stefan Weil
4f45940050 training: Fix compiler warnings (deprecated register keyword)
training/commontraining.cpp:824:3: warning:
 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
...

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-14 22:34:15 +01:00
Stefan Weil
7e90200d26 Fix some compiler warnings (unused function parameters)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-13 17:20:06 +01:00
zdenop
8bff1e618f Merge pull request #475 from stweil/fix
opencl: Fix type of parameters for OpenCL functions
2016-11-13 17:17:49 +01:00
Stefan Weil
4ca6ba985b opencl: Fix type of parameter for clGetProgramInfo
CL_PROGRAM_NUM_DEVICES expects a cl_uint.

Passing size_t results in a wrong value for numDevices on hosts where
sizeof(cl_uint) != sizeof(size_t).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-12 22:12:54 +01:00
Stefan Weil
ec5b1bdfa3 opencl: Fix type of parameter for clGetContextInfo
CL_CONTEXT_NUM_DEVICES expects a cl_uint.

Passing size_t results in a wrong value for numDevices on hosts where
sizeof(cl_uint) != sizeof(size_t). This results in errors like these:

  Tesseract Open Source OCR Engine v3.05.00dev with Leptonica
  OpenCL error code is -44 at   when clCreateKernel kernel_HistogramRectAllChannels .
  OpenCL error code is -44 at   when clCreateKernel kernel_HistogramRectAllChannelsReduction .
  OpenCL error code is -48 at   when clSetKernelArg imageBuffer .
  ...

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-12 22:12:49 +01:00
Stefan Weil
94be4be4be ccutil/ambigs: Optimize tesseract::UnicharIdArrayUtils::compare
The compare method is called very often, so even small improvements
are important.

The new code avoids one comparison in each loop iteration.
This results in smaller code (60 bytes for x86_64, gcc).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-12 19:21:57 +01:00
Zdenko Podobný
a4615929ff allow combination of enable/disable 2016-11-11 22:03:16 +01:00
Ray Smith
f24ef67df4 Limited max height to 48 even in variable height input, enabled neural nets via ocr engine mode 2016-11-08 14:01:04 -08:00
Cristian Ciupitu
71e217f8a9 Fix a typo in tesseract(1) man page
C++ needs to escaped as C\+\+ in the AsciiDoc source code.
2016-11-08 23:20:48 +02:00
Ray Smith
c1c1e426b3 Added new LSTM-based neural network line recognizer 2016-11-07 15:38:07 -08:00
Ray Smith
5d21ecfad3 Rendering/hash map changes part 2 2016-11-07 11:56:07 -08:00
Ray Smith
a987e6d87c Major bug fixes to pango renderer and resolved issue of hash_map vs unordered_map 2016-11-07 11:35:45 -08:00
Ray Smith
2c837dffc3 Result of clang tidy on recent merge 2016-11-07 10:46:33 -08:00
zdenop
182ca5bc1e Merge pull request #470 from stweil/fix
Fix crash caused by undefined value of local variable
2016-11-07 17:23:31 +01:00
zdenop
22d53e6d58 Merge pull request #469 from stweil/opencl2
opencl: Remove unused function getNumDeviceWithEmptyScore
2016-11-07 15:32:46 +01:00
Stefan Weil
1e60a8d71c Fix crash caused by undefined value of local variable
Commit b1f03cb697 added a call of function
FreeFeatureSet to fix a memory leak, but introduced a new bug because the
local variable FloatFeatures was not always assigned a value.

Now FloatFeatures is always assigned a value, and we only need a single
place where FreeFeatureSet is called.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-07 12:31:20 +01:00
Stefan Weil
a1b9e98df5 opencl: Remove unused function getNumDeviceWithEmptyScore
This fixes compiler warnings.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-07 09:41:05 +01:00
zdenop
f8bc09a23a Merge pull request #467 from stweil/opencl2
opencl: Fix two small bugs (both found by gcc)
2016-11-06 17:43:47 +01:00
Stefan Weil
10886d3f91 opencl: Add missing argument for L_WARNING
gcc report:

In file included from /usr/include/leptonica/alltypes.h:36:0,
                 from /usr/include/leptonica/allheaders.h:34,
                 from openclwrapper.h:2,
                 from openclwrapper.cpp:11:
openclwrapper.cpp: In static member function 'static PIX* OpenclDevice::pixReadMemTiffCl(const l_uint8*, size_t, l_int32)':
/usr/include/leptonica/environ.h:442:68: warning: format '%d' expects a matching 'int' argument [-Wformat=]
              (void)fprintf(stderr, "Warning in %s: " a, __VA_ARGS__), \
                                                                    ^
/usr/include/leptonica/environ.h:427:61: note: in definition of macro 'IF_SEV'
       ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f))
                                                             ^
opencl/openclwrapper.cpp:1162:3: note: in expansion of macro 'L_WARNING'
   L_WARNING("tiff page %d not found", procName);
   ^

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-05 20:57:30 +01:00
Stefan Weil
90dad1f2ae opencl: Fix wrong implementation of function getNumDeviceWithEmptyScore
gcc report:

opencl_device_selection.h: In function 'ds_status getNumDeviceWithEmptyScore(ds_profile*, unsigned int*)':
opencl_device_selection.h:589:13: warning: value computed is not used [-Wunused-value]
       *num++;
             ^

This is caused by a buggy implementation which increases the value of num
instead of *num.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-05 20:57:30 +01:00
zdenop
8972c0e916 Merge pull request #463 from stweil/opencl
opencl: Move declaration of MORPH_BC from .h to .cpp file
2016-11-01 21:20:39 +01:00
Stefan Weil
1a0aadabd3 opencl: Move declaration of MORPH_BC from .h to .cpp file
It is only used locally in opencl/openclwrapper.cpp.

For all other files which include openclwrapper.h, the compiler
complained about an unused static variable:

opencl/openclwrapper.h:175:16: warning:
 ‘MORPH_BC’ defined but not used [-Wunused-variable]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-01 20:15:29 +01:00
zdenop
1dbc8c19a4 Merge pull request #461 from stweil/opencl
opencl: Clean handling of lmask32, rmask32
2016-10-31 10:37:32 +01:00
Stefan Weil
aea20224a1 opencl: Clean handling of lmask32, rmask32
Both arrays are only used in openclwrapper.cpp, so move them into that
file.

The first element of both arrays was unused. Remove it and fix the code
which reads the array elements accordingly. Sort this code, too.

These changes reduce the code size a little bit:

   text	   data	    bss	    dec	    hex	filename
2461743	   6676	2742784	5211203	 4f8443	1/api/tesseract (old)
2461599	   6676	2742784	5211059	 4f83b3	2/api/tesseract (new)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-31 09:56:59 +01:00
zdenop
610b2d2cd6 Merge pull request #459 from stweil/opencl
opencl: Add tiff library needed by openclwrapper
2016-10-30 13:34:00 +01:00
Stefan Weil
3f959e394c opencl: Add tiff library needed by openclwrapper
openclwrapper calls function TIFFReadRGBAImageOriented which is provided
by libtiff, so add that library to OPENCL_LIBS.

This fixes a linker error (unresolved symbol) when opencl is enabled.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-30 08:10:07 +01:00
zdenop
44e6e87eae Merge pull request #457 from stweil/opencl
opencl: Fix mismatched new[] / free
2016-10-29 18:43:18 +02:00
Stefan Weil
ab8209cbcb opencl: Fix mismatched new[] / free
valgrind report: Mismatched free() / delete / delete []

gpuInfo->mpArryDevsID is created by "new cl_device_id[1]",
so it must be destroyed by delete[].

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-29 16:51:48 +02:00
zdenop
7f57ac4a94 Merge pull request #456 from stweil/opencl
opencl: Fix some issues reported by gcc
2016-10-28 20:08:42 +02:00
Stefan Weil
f67381a707 opencl: Fix compiler warning [-Wwrite-strings]
gcc report:

opencl/openclwrapper.cpp:3245:22: warning:
 deprecated conversion from string constant to 'char*' [-Wwrite-strings]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-28 20:04:36 +02:00
Stefan Weil
bccf1c10f1 opencl: Fix delete operation
gcc report:

opencl/openclwrapper.cpp:3169:12: warning: deleting 'void*' is undefined

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-28 20:04:36 +02:00
Stefan Weil
3ac54b935c opencl: Fix compiler warning [-Wconversion-null]
gcc report:

opencl/openclwrapper.cpp:84:23: warning:
 converting to non-pointer type 'char' from NULL [-Wconversion-null]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-28 20:04:36 +02:00
Wootton, Michael
f46dfdc29d Fix a padding problem in ThresholdRectToPixOCL 2016-10-27 22:26:39 +02:00
Wootton, Michael
5db760215f Fix openCL crash at startup after device profiling 2016-10-27 22:16:22 +02:00
Stefan Weil
49c5a5754f Introduce POSIX data types
POSIX provides portable data types for signed and unsigned integer values
of different size.

This patch maps those POSIX data types to the Tesseract specific types.
In a next step, the Tesseract data types can be eliminated by replacing
them with the POSIX data types.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-26 09:03:58 +02:00
zdenop
299fce54a3 Merge pull request #449 from stweil/leak
Fix memory leaks at program termination
2016-10-26 08:30:45 +02:00
Stefan Weil
ea786e25a4 api/baseapi: Fix memory leaks at program termination
Calling TessBaseAPI::Clear() which calls TessBaseAPI::ClearResults()
which calls SavePixForCrash(0, NULL) is needed to release objects
allocated in global_crash_pixes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-25 19:11:10 +02:00
Stefan Weil
6fad5fc0a9 dict/dict: Fix memory leaks at program termination
Avoid dynamic memory allocation for the static variable 'cache'.
Now the destructor for that variable is called automatically
when Tesseract terminates and releases all associated memory.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-25 17:25:55 +02:00