GDAL

- Main Page
- Related Pages
- Classes
- Files
- Download
- Issue Tracker

- File List
- File Members

gdalwarpkernel_opencl.h
1 /******************************************************************************
2 * $Id: gdalwarpkernel_opencl.h 34485 2016-06-30 22:42:39Z goatbar $
3 *
4 * Project: OpenCL Image Reprojector
5 * Purpose: Implementation of the GDALWarpKernel reprojector in OpenCL.
6 * Author: Seth Price, seth@pricepages.org
7 *
8 ******************************************************************************
9 * Copyright (c) 2010, Seth Price <seth@pricepages.org>
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a
12 * copy of this software and associated documentation files (the "Software"),
13 * to deal in the Software without restriction, including without limitation
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 * and/or sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included
19 * in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 * DEALINGS IN THE SOFTWARE.
28 ****************************************************************************/
29
30 #if defined(HAVE_OPENCL)
31
32 /* The following relates to the profiling calls to
33 clSetCommandQueueProperty() which are not available by default
34 with some OpenCL implementation (i.e. ATI) */
35
36 #if defined(DEBUG_OPENCL) && DEBUG_OPENCL == 1
37 #define CL_USE_DEPRECATED_OPENCL_1_0_APIS
38 #endif
39
40 #ifdef __APPLE__
41 #include <OpenCL/OpenCL.h>
42 #else
43 #include <CL/opencl.h>
44 #endif
45
46 #ifdef __cplusplus /* If this is a C++ compiler, use C linkage */
47 extern "C" {
48 #endif
49
50 typedef enum {
51 OCL_Bilinear=10,
52 OCL_Cubic=11,
53 OCL_CubicSpline=12,
54 OCL_Lanczos=13
55 } OCLResampAlg;
56
57 typedef enum
58 {
59 VENDOR_OTHER,
60 VENDOR_AMD,
61 VENDOR_INTEL
62 } OCLVendor;
63
64 struct oclWarper {
65 cl_command_queue queue;
66 cl_context context;
67 cl_device_id dev;
68 cl_kernel kern1;
69 cl_kernel kern4;
70
71 int srcWidth;
72 int srcHeight;
73 int dstWidth;
74 int dstHeight;
75
76 int useUnifiedSrcDensity;
77 int useUnifiedSrcValid;
78 int useDstDensity;
79 int useDstValid;
80
81 int numBands;
82 int numImages;
83 OCLResampAlg resampAlg;
84
85 cl_channel_type imageFormat;
86 cl_mem *realWorkCL;
87 union {
88 void **v;
89 char **c;
90 unsigned char **uc;
91 short **s;
92 unsigned short **us;
93 float **f;
94 } realWork;
95
96 cl_mem *imagWorkCL;
97 union {
98 void **v;
99 char **c;
100 unsigned char **uc;
101 short **s;
102 unsigned short **us;
103 float **f;
104 } imagWork;
105
106 cl_mem *dstRealWorkCL;
107 union {
108 void **v;
109 char **c;
110 unsigned char **uc;
111 short **s;
112 unsigned short **us;
113 float **f;
114 } dstRealWork;
115
116 cl_mem *dstImagWorkCL;
117 union {
118 void **v;
119 char **c;
120 unsigned char **uc;
121 short **s;
122 unsigned short **us;
123 float **f;
124 } dstImagWork;
125
126 unsigned int imgChSize1;
127 cl_channel_order imgChOrder1;
128 unsigned int imgChSize4;
129 cl_channel_order imgChOrder4;
130 char useVec;
131
132 cl_mem useBandSrcValidCL;
133 char *useBandSrcValid;
134
135 cl_mem nBandSrcValidCL;
136 float *nBandSrcValid;
137
138 cl_mem xyWorkCL;
139 float *xyWork;
140
141 int xyWidth;
142 int xyHeight;
143 int coordMult;
144
145 unsigned int xyChSize;
146 cl_channel_order xyChOrder;
147
148 cl_mem fDstNoDataRealCL;
149 float *fDstNoDataReal;
150
151 OCLVendor eCLVendor;
152 };
153
154 struct oclWarper* GDALWarpKernelOpenCL_createEnv(int srcWidth, int srcHeight,
155 int dstWidth, int dstHeight,
156 cl_channel_type imageFormat,
157 int numBands, int coordMult,
158 int useImag, int useBandSrcValid,
159 float *fDstDensity,
160 double *dfDstNoDataReal,
161 OCLResampAlg resampAlg, cl_int *envErr);
162
163 cl_int GDALWarpKernelOpenCL_setSrcValid(struct oclWarper *warper,
164 int *bandSrcValid, int bandNum);
165
166 cl_int GDALWarpKernelOpenCL_setSrcImg(struct oclWarper *warper, void *imgData,
167 int bandNum);
168
169 cl_int GDALWarpKernelOpenCL_setDstImg(struct oclWarper *warper, void *imgData,
170 int bandNum);
171
172 cl_int GDALWarpKernelOpenCL_setCoordRow(struct oclWarper *warper,
173 double *rowSrcX, double *rowSrcY,
174 double srcXOff, double srcYOff,
175 int *success, int rowNum);
176
177 cl_int GDALWarpKernelOpenCL_runResamp(struct oclWarper *warper,
178 float *unifiedSrcDensity,
179 unsigned int *unifiedSrcValid,
180 float *dstDensity,
181 unsigned int *dstValid,
182 double dfXScale, double dfYScale,
183 double dfXFilter, double dfYFilter,
184 int nXRadius, int nYRadius,
185 int nFiltInitX, int nFiltInitY);
186
187 cl_int GDALWarpKernelOpenCL_getRow(struct oclWarper *warper,
188 void **rowReal, void **rowImag,
189 int rowNum, int bandNum);
190
191 cl_int GDALWarpKernelOpenCL_deleteEnv(struct oclWarper *warper);
192
193 #ifdef __cplusplus /* If this is a C++ compiler, end C linkage */
194 }
195 #endif
196
197 #endif /* defined(HAVE_OPENCL) */

Generated for GDAL by 1.8.8.