forked from OSGeo/gdal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdalwarpkernel_opencl.h
187 lines (149 loc) · 4.86 KB
/
gdalwarpkernel_opencl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/******************************************************************************
* $Id$
*
* Project: OpenCL Image Reprojector
* Purpose: Implementation of the GDALWarpKernel reprojector in OpenCL.
* Author: Seth Price, seth@pricepages.org
*
******************************************************************************
* Copyright (c) 2010, Seth Price <seth@pricepages.org>
*
* SPDX-License-Identifier: MIT
****************************************************************************/
#if defined(HAVE_OPENCL)
/* The following relates to the profiling calls to
clSetCommandQueueProperty() which are not available by default
with some OpenCL implementation (i.e. ATI) */
#if defined(DEBUG_OPENCL) && DEBUG_OPENCL == 1
#define CL_USE_DEPRECATED_OPENCL_1_0_APIS
#endif
#define CL_TARGET_OPENCL_VERSION 100
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/opencl.h>
#endif
#ifdef __cplusplus /* If this is a C++ compiler, use C linkage */
extern "C"
{
#endif
typedef enum
{
OCL_Bilinear = 10,
OCL_Cubic = 11,
OCL_CubicSpline = 12,
OCL_Lanczos = 13
} OCLResampAlg;
typedef enum
{
VENDOR_OTHER,
VENDOR_AMD,
VENDOR_INTEL
} OCLVendor;
struct oclWarper
{
cl_command_queue queue;
cl_context context;
cl_device_id dev;
cl_kernel kern1;
cl_kernel kern4;
int srcWidth;
int srcHeight;
int dstWidth;
int dstHeight;
int useUnifiedSrcDensity;
int useUnifiedSrcValid;
int useDstDensity;
int useDstValid;
int numBands;
int numImages;
OCLResampAlg resampAlg;
cl_channel_type imageFormat;
cl_mem *realWorkCL;
union
{
void **v;
char **c;
unsigned char **uc;
short **s;
unsigned short **us;
float **f;
} realWork;
cl_mem *imagWorkCL;
union
{
void **v;
char **c;
unsigned char **uc;
short **s;
unsigned short **us;
float **f;
} imagWork;
cl_mem *dstRealWorkCL;
union
{
void **v;
char **c;
unsigned char **uc;
short **s;
unsigned short **us;
float **f;
} dstRealWork;
cl_mem *dstImagWorkCL;
union
{
void **v;
char **c;
unsigned char **uc;
short **s;
unsigned short **us;
float **f;
} dstImagWork;
unsigned int imgChSize1;
cl_channel_order imgChOrder1;
unsigned int imgChSize4;
cl_channel_order imgChOrder4;
char useVec;
cl_mem useBandSrcValidCL;
char *useBandSrcValid;
cl_mem nBandSrcValidCL;
float *nBandSrcValid;
cl_mem xyWorkCL;
float *xyWork;
int xyWidth;
int xyHeight;
int coordMult;
unsigned int xyChSize;
cl_channel_order xyChOrder;
cl_mem fDstNoDataRealCL;
float *fDstNoDataReal;
OCLVendor eCLVendor;
};
struct oclWarper *GDALWarpKernelOpenCL_createEnv(
int srcWidth, int srcHeight, int dstWidth, int dstHeight,
cl_channel_type imageFormat, int numBands, int coordMult, int useImag,
int useBandSrcValid, float *fDstDensity, double *dfDstNoDataReal,
OCLResampAlg resampAlg, cl_int *envErr);
cl_int GDALWarpKernelOpenCL_setSrcValid(struct oclWarper *warper,
int *bandSrcValid, int bandNum);
cl_int GDALWarpKernelOpenCL_setSrcImg(struct oclWarper *warper,
void *imgData, int bandNum);
cl_int GDALWarpKernelOpenCL_setDstImg(struct oclWarper *warper,
void *imgData, int bandNum);
cl_int GDALWarpKernelOpenCL_setCoordRow(struct oclWarper *warper,
double *rowSrcX, double *rowSrcY,
double srcXOff, double srcYOff,
int *success, int rowNum);
cl_int GDALWarpKernelOpenCL_runResamp(
struct oclWarper *warper, float *unifiedSrcDensity,
unsigned int *unifiedSrcValid, float *dstDensity,
unsigned int *dstValid, double dfXScale, double dfYScale,
double dfXFilter, double dfYFilter, int nXRadius, int nYRadius,
int nFiltInitX, int nFiltInitY);
cl_int GDALWarpKernelOpenCL_getRow(struct oclWarper *warper, void **rowReal,
void **rowImag, int rowNum, int bandNum);
cl_int GDALWarpKernelOpenCL_deleteEnv(struct oclWarper *warper);
#ifdef __cplusplus /* If this is a C++ compiler, end C linkage */
}
#endif
#endif /* defined(HAVE_OPENCL) */