00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #if defined(HAVE_OPENCL)
00031
00032
00033
00034
00035
00036 #define CL_USE_DEPRECATED_OPENCL_1_0_APIS
00037
00038 #ifdef __APPLE__
00039 #include <OpenCL/OpenCL.h>
00040 #else
00041 #include <CL/opencl.h>
00042 #endif
00043
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif
00047
00048 typedef enum {
00049 OCL_Bilinear=10,
00050 OCL_Cubic=11,
00051 OCL_CubicSpline=12,
00052 OCL_Lanczos=13
00053 } OCLResampAlg;
00054
00055 struct oclWarper {
00056 cl_command_queue queue;
00057 cl_context context;
00058 cl_device_id dev;
00059 cl_kernel kern1;
00060 cl_kernel kern4;
00061
00062 int srcWidth;
00063 int srcHeight;
00064 int dstWidth;
00065 int dstHeight;
00066
00067 int useUnifiedSrcDensity;
00068 int useUnifiedSrcValid;
00069 int useDstDensity;
00070 int useDstValid;
00071
00072 int numBands;
00073 int numImages;
00074 OCLResampAlg resampAlg;
00075
00076 cl_channel_type imageFormat;
00077 cl_mem *realWorkCL;
00078 union {
00079 void **v;
00080 char **c;
00081 unsigned char **uc;
00082 short **s;
00083 unsigned short **us;
00084 float **f;
00085 } realWork;
00086
00087 cl_mem *imagWorkCL;
00088 union {
00089 void **v;
00090 char **c;
00091 unsigned char **uc;
00092 short **s;
00093 unsigned short **us;
00094 float **f;
00095 } imagWork;
00096
00097 cl_mem *dstRealWorkCL;
00098 union {
00099 void **v;
00100 char **c;
00101 unsigned char **uc;
00102 short **s;
00103 unsigned short **us;
00104 float **f;
00105 } dstRealWork;
00106
00107 cl_mem *dstImagWorkCL;
00108 union {
00109 void **v;
00110 char **c;
00111 unsigned char **uc;
00112 short **s;
00113 unsigned short **us;
00114 float **f;
00115 } dstImagWork;
00116
00117 unsigned int imgChSize1;
00118 cl_channel_order imgChOrder1;
00119 unsigned int imgChSize4;
00120 cl_channel_order imgChOrder4;
00121 char useVec;
00122
00123 cl_mem useBandSrcValidCL;
00124 char *useBandSrcValid;
00125
00126 cl_mem nBandSrcValidCL;
00127 float *nBandSrcValid;
00128
00129 cl_mem xyWorkCL;
00130 float *xyWork;
00131
00132 int xyWidth;
00133 int xyHeight;
00134 int coordMult;
00135
00136 unsigned int xyChSize;
00137 cl_channel_order xyChOrder;
00138
00139 cl_mem fDstNoDataRealCL;
00140 float *fDstNoDataReal;
00141
00142 int bIsATI;
00143 };
00144
00145 struct oclWarper* GDALWarpKernelOpenCL_createEnv(int srcWidth, int srcHeight,
00146 int dstWidth, int dstHeight,
00147 cl_channel_type imageFormat,
00148 int numBands, int coordMult,
00149 int useImag, int useBandSrcValid,
00150 float *fDstDensity,
00151 double *dfDstNoDataReal,
00152 OCLResampAlg resampAlg, cl_int *envErr);
00153
00154 cl_int GDALWarpKernelOpenCL_setSrcValid(struct oclWarper *warper,
00155 int *bandSrcValid, int bandNum);
00156
00157 cl_int GDALWarpKernelOpenCL_setSrcImg(struct oclWarper *warper, void *imgData,
00158 int bandNum);
00159
00160 cl_int GDALWarpKernelOpenCL_setDstImg(struct oclWarper *warper, void *imgData,
00161 int bandNum);
00162
00163 cl_int GDALWarpKernelOpenCL_setCoordRow(struct oclWarper *warper,
00164 double *rowSrcX, double *rowSrcY,
00165 double srcXOff, double srcYOff,
00166 int *success, int rowNum);
00167
00168 cl_int GDALWarpKernelOpenCL_runResamp(struct oclWarper *warper,
00169 float *unifiedSrcDensity,
00170 unsigned int *unifiedSrcValid,
00171 float *dstDensity,
00172 unsigned int *dstValid,
00173 double dfXScale, double dfYScale,
00174 double dfXFilter, double dfYFilter,
00175 int nXRadius, int nYRadius,
00176 int nFiltInitX, int nFiltInitY);
00177
00178 cl_int GDALWarpKernelOpenCL_getRow(struct oclWarper *warper,
00179 void **rowReal, void **rowImag,
00180 int rowNum, int bandNum);
00181
00182 cl_int GDALWarpKernelOpenCL_deleteEnv(struct oclWarper *warper);
00183
00184 #ifdef __cplusplus
00185 }
00186 #endif
00187
00188 #endif
00189