tesseract  3.05.02
opencl_device_selection.h
Go to the documentation of this file.
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 <stdlib.h>
21 #include <stdio.h>
22 #include <string.h>
23 
24 #ifdef __APPLE__
25 #include <OpenCL/cl.h>
26 #else
27 #include <CL/cl.h>
28 #endif
29 
30 // device type
31 typedef enum {
32  DS_DEVICE_NATIVE_CPU = 0,
33  DS_DEVICE_OPENCL_DEVICE
34 } ds_device_type;
35 
36 typedef struct {
37  ds_device_type type;
38  cl_device_id oclDeviceID;
39  char* oclDeviceName;
40  char* oclDriverVersion;
41  // a pointer to the score data, the content/format is application defined.
42  void* score;
43 } ds_device;
44 
45 #endif // USE_OPENCL
46 #endif // DEVICE_SELECTION_H