libtiff is no longer needed for OpenCL, so remove that dependency.
It is still suggested for Windows to redirect warning messages
from the tesseract executable to the console.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
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>
opencl_device_selection.h contains lots of code which is only used in
openclwrapper.cpp. This results in several compiler warnings:
opencl/opencl_device_selection.h:396:18: warning:
‘ds_status readProfileFromFile(ds_profile*, ds_score_deserializer, const char*)’ defined but not used [-Wunused-function]
opencl/opencl_device_selection.h:257:18: warning:
‘ds_status writeProfileToFile(ds_profile*, ds_score_serializer, const char*)’ defined but not used [-Wunused-function]
opencl/opencl_device_selection.h:196:18: warning:
‘ds_status profileDevices(ds_profile*, ds_evaluation_type, ds_perf_evaluator, void*, unsigned int*)’ defined but not used [-Wunused-function]
opencl/opencl_device_selection.h:90:18: warning:
‘ds_status initDSProfile(ds_profile**, const char*)’ defined but not used [-Wunused-function]
opencl/opencl_device_selection.h:70:18: warning:
‘ds_status releaseDSProfile(ds_profile*, ds_score_release)’ defined but not used [-Wunused-function]
Move that functions and all related code to openclwrapper.cpp.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
With Debian package beignet-opencl-icd 1.2.1-1, Tesseract + OpenCL fails:
[DS] Profile file not available (tesseract_opencl_profile_devices.dat); performing profiling.
[DS] Device: "Intel(R) HD Graphics IvyBridge M GT2" (OpenCL) evaluation...
ASSERTION FAILED: sel.hasDoubleType()
at file /home/geier/beignet/backend/src/backend/gen_insn_selection.cpp, function void gbe::ConvertInstructionPattern::convertDoubleToSmallInts(gbe::Selection::Opaque&, const gbe::ir::ConvertInstruction&, bool&) const, line 5269
Trace/breakpoint trap
Using a pure float expression (instead of double) fixes this issue.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
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>
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>
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>
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>
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>
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>
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>
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>
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>