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