Commit Graph

48 Commits

Author SHA1 Message Date
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
58304cbfdd Don't compile OpenCL code when OpenCL is disabled
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-26 15:40:23 +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
558462358a automake: Flat build for src/opencl
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-26 16:20:46 +01:00
Egor Pugin
2a37f5dd62 Update includes to use <>. 2019-10-29 14:50:11 +03:00
amitdo
2f8884a64e Fix autotools build 2019-10-28 21:23:58 +02:00
amitdo
e1bae15547 Fix #include path of public headers 2019-10-28 19:10:30 +02:00
Stefan Weil
ba17bc8204 OpenCL: Add static attribute for kernel_src
It is only used in openclwrapper.cpp.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-12 15:13:45 +02:00
Stefan Weil
9195a904a7 Use auto data type for results of std::ftell
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-18 10:56:17 +02:00
Stefan Weil
d42413dd17 OpenCL: Remove PERF_COUNT framework
It was rarely used, but added a lot of code and an unconditional
dependency on openclwrapper.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-02-09 10:58:15 +01:00
Stefan Weil
66e31bfd8c OpenCL: Fix alloc-dealloc mismatch
Bug message from AddressSanitizer:

    ==7153==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs free) on 0x602000072cb0
        #0 0x7ffff70c6a10 in free (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1a10)
        #1 0x555557188638 in writeProfileToFile ../../../../../src/opencl/openclwrapper.cpp:541

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-19 08:06:26 +01:00
Stefan Weil
ad19183b92 OpenCL: Fix heap buffer overflow
Bug message from AddressSanitizer:

    ==6158==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7fffe774b7fc at pc 0x555557086b54 bp 0x7fffffffcee0 sp 0x7fffffffced8
    READ of size 1 at 0x7fffe774b7fc thread T0
        #0 0x555557086b53 in tesseract::HistogramRect(Pix*, int, int, int, int, int, int*) ../../../../../src/ccstruct/otsuthr.cpp:163

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-19 07:58:16 +01:00
Stefan Weil
e0fc4f2945 Remove opencl_device_selection.h
Always use OpenCL device selection if OpenCL is enabled.

This fixes a regression which was introduced by commit
5c6a57b727 which removed
the definition for USE_DEVICE_SELECTION.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-09 12:09:56 +01:00
Stefan Weil
595bb7df16 OpenCL: Remove unused code
The OpenCL kernel pixSubtract is never used, so remove it.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-05 16:41:20 +01:00
Stefan Weil
2d2b269e02 OpenclDevice: Catch negative index (CID 1395110)
This fixes a warning from CoverityScan.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-16 16:53:24 +02:00
Stefan Weil
d86d520fd0 Remove tab character in source files
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-12 11:31:10 +02:00
zdenop
14b83d3090 use tprintf instead of printf to be able disable messages by quiet option
(issue #1240)
2018-09-29 13:49:08 +02:00
Stefan Weil
0f3206d5fe Format code (replace ( xxx ) by (xxx))
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-29 08:21:25 +02:00
Zdenko Podobný
5d22fdfeed replace deprecated C++ headers (reported by clan-tidy) - partially supersedes PR #1605 2018-09-18 18:51:11 +02:00
Stefan Weil
6092a8f865 Fix CID 1395109 (Logically dead code)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-22 13:55:37 +02:00
Stefan Weil
88ebfea4b5 opencl: Fix crash and clean code a bit
OpenclDevice::getDeviceSelection crashed when outdated information
was read from file and device.score was not set.

Change also the struct definitions from C to C++ and
eliminate some type casts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-08 18:38:11 +02:00
Stefan Weil
8ad7f049ea Fix empty statements
* Add break in default case to avoid potential problems with
  future case statements following the default case.

* Remove empty statement.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 15:17:54 +02:00
Stefan Weil
c8b5a29ce9 Remove unneeded type casts
This removes unneded type casts to (char*) and (const char*).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-04 14:23:55 +02:00
Stefan Weil
57970443b4 Fix CID 1393661 (Arguments in wrong order)
It did not cause a problem as both arguments were 0.

Update also the function prototype of HistogramRectOCL to
accept a void pointer which allows removing a type cast.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-01 19:40:44 +02:00
Stefan Weil
1b303e5d37 Fix CID 1393662 Resource leak
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-01 19:27:01 +02:00
Stefan Weil
d3c4642d8f Fix CID 1393662 (Resource leak) 2018-07-01 19:27:01 +02:00
Stefan Weil
98758fb300 opencl: Use std::vector and clean code
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-01 19:27:01 +02:00
Stefan Weil
53795a88b5 Fix CID 1158180 Argument cannot be negative
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-01 19:18:32 +02:00
Stefan Weil
de072cc01e Format OpenCL code
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 18:32:53 +02:00
Stefan Weil
740a821c76 Fix CID 1393673 (Ignoring number of bytes read)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:25:09 +02:00
Stefan Weil
075dc984e9 Fix CID 1393671 (Uninitialized scalar variable)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:10:25 +02:00
Stefan Weil
8f33d10bfb Fix CID 1393670 (Resource leak)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:10:16 +02:00
Stefan Weil
12a601fffa Fix CID 1393669 (Resource leak)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:21 +02:00
Stefan Weil
1de55c8604 Fix CID 1393668 (Uninitialized scalar variable)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:21 +02:00
Stefan Weil
1e1f35cd5c Fix CID 1393667 (Copy into fixed size buffer)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:21 +02:00
Stefan Weil
85794ca188 Fix CID 1393666 (Big parameter passed by value)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:21 +02:00
Stefan Weil
3d2f73503e Fix CID 1393665 (Uninitialized scalar variable)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:21 +02:00
Stefan Weil
a95917a6a4 Fix CID 1393664 (Uninitialized scalar variable)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:21 +02:00
Stefan Weil
c9737c7f93 Fix CID 1393663 (Big parameter passed by value)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:20 +02:00
Stefan Weil
53596f7837 Fix CID 1393662 (Resource leak)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:19 +02:00
Stefan Weil
fcff2f2ce2 Fix CID 1242849 (Unused value)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 11:46:19 +02:00
Stefan Weil
eabd10d8f2 Fix CID 1158180 (Argument cannot be negative) and clean code a bit
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 11:41:41 +02:00
Stefan Weil
4cc103cd42 Fix CID 1157757 (Logically dead code)
deviceNameStart cannot be NULL here.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 10:36:45 +02:00
Stefan Weil
509a6f0ce0 Fix some typos (most found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-05-27 18:49:43 +02:00
Alexander Zaitsev
0248c7ff9d Rename all C-style headers (e.g. <stdio.h>) to C++ style (<cstdio>). 2018-05-20 00:52:04 +03:00
Stefan Weil
4f9493c409 Partial fix for autotools configuration after source tree reorganisation
This should fix "make" and "make training".

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-04-25 21:33:28 +02:00
Stefan Weil
9ceb0c6430 Fix line endings
Replace DOS line endings (CRLF) by standard (LF only).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-04-25 19:04:50 +02:00
Egor Pugin
e95ff1159e Move sources into src dir. Update build scripts. 2018-04-25 11:02:54 +03:00