tesseract  v4.0.0-17-g361f3264
Open Source OCR Engine
opencl_device_selection.h
1 // Licensed under the Apache License, Version 2.0 (the "License");
2 // you may not use this file except in compliance with the License.
3 // You may obtain a copy of the License at
4 // http://www.apache.org/licenses/LICENSE-2.0
5 // Unless required by applicable law or agreed to in writing, software
6 // distributed under the License is distributed on an "AS IS" BASIS,
7 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8 // See the License for the specific language governing permissions and
9 // limitations under the License.
10 
11 #ifndef DEVICE_SELECTION_H
12 #define DEVICE_SELECTION_H
13 
14 #ifdef USE_OPENCL
15 
16 #ifdef _MSC_VER
17 #define _CRT_SECURE_NO_WARNINGS
18 #endif
19 
20 #include <cstdio>
21 #include <cstdlib>
22 #include <cstring>
23 
24 #ifdef __APPLE__
25 #include <OpenCL/cl.h>
26 #else
27 #include <CL/cl.h>
28 #endif
29 
30 struct TessDeviceScore;
31 
32 // device type
33 enum ds_device_type {
34  DS_DEVICE_NATIVE_CPU = 0,
35  DS_DEVICE_OPENCL_DEVICE
36 };
37 
38 struct ds_device {
39  ds_device_type type;
40  cl_device_id oclDeviceID;
41  char* oclDeviceName;
42  char* oclDriverVersion;
43  // a pointer to the score data, the content/format is application defined.
44  TessDeviceScore* score;
45 };
46 
47 #endif // USE_OPENCL
48 #endif // DEVICE_SELECTION_H