31 #ifndef GDALWARPER_H_INCLUDED 32 #define GDALWARPER_H_INCLUDED 44 #include "cpl_multiproc.h" 78 (*GDALMaskFunc)(
void *pMaskFuncArg,
81 int nXSize,
int nYSize,
82 GByte **papabyImageData,
83 int bMaskIsFloat,
void *pMask );
86 GDALWarpNoDataMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
87 int nXOff,
int nYOff,
int nXSize,
int nYSize,
88 GByte **papabyImageData,
int bMaskIsFloat,
89 void *pValidityMask,
int* pbOutAllValid );
92 GDALWarpDstAlphaMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
93 int nXOff,
int nYOff,
int nXSize,
int nYSize,
95 int bMaskIsFloat,
void *pValidityMask );
97 GDALWarpSrcAlphaMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
98 int nXOff,
int nYOff,
int nXSize,
int nYSize,
100 int bMaskIsFloat,
void *pValidityMask,
int* pbOutAllOpaque );
103 GDALWarpSrcMaskMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
104 int nXOff,
int nYOff,
int nXSize,
int nYSize,
106 int bMaskIsFloat,
void *pValidityMask );
109 GDALWarpCutlineMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
110 int nXOff,
int nYOff,
int nXSize,
int nYSize,
112 int bMaskIsFloat,
void *pValidityMask );
206 CPLErr (*pfnPreWarpChunkProcessor)(
void *pKern,
void *pArg );
211 CPLErr (*pfnPostWarpChunkProcessor)(
void *pKern,
void *pArg);
239 CPLErr CPL_DLL CPL_STDCALL
244 GDALProgressFunc pfnProgress,
void *pProgressArg,
247 CPLErr CPL_DLL CPL_STDCALL
249 const char *pszDstFilename,
const char *pszDstWKT,
253 GDALProgressFunc pfnProgress,
void *pProgressArg,
262 const char *pszSrcWKT,
const char *pszDstWKT,
268 int nPixels,
int nLines,
double *padfGeoTransform,
271 CPLErr CPL_DLL CPL_STDCALL
288 #define WARP_EXTRA_ELTS 1 397 void* GWKThreadsCreate(
char** papszWarpOptions,
399 void* pTransformerArg);
400 void GWKThreadsEnd(
void* psThreadDataIn);
414 typedef struct _GDALWarpChunk GDALWarpChunk;
422 int ValidateOptions();
424 CPLErr ComputeSourceWindow(
int nDstXOff,
int nDstYOff,
425 int nDstXSize,
int nDstYSize,
426 int *pnSrcXOff,
int *pnSrcYOff,
427 int *pnSrcXSize,
int *pnSrcYSize,
428 int *pnSrcXExtraSize,
int *pnSrcYExtraSize,
429 double* pdfSrcFillRatio );
432 const char *pszType );
435 CPLMutex *hWarpMutex;
439 GDALWarpChunk *pasChunkList;
442 unsigned long nLastTimeReported;
446 void WipeChunkList();
447 CPLErr CollectChunkList(
int nDstXOff,
int nDstYOff,
448 int nDstXSize,
int nDstYSize );
449 void ReportTiming(
const char * );
459 CPLErr ChunkAndWarpImage(
int nDstXOff,
int nDstYOff,
460 int nDstXSize,
int nDstYSize );
461 CPLErr ChunkAndWarpMulti(
int nDstXOff,
int nDstYOff,
462 int nDstXSize,
int nDstYSize );
463 CPLErr WarpRegion(
int nDstXOff,
int nDstYOff,
464 int nDstXSize,
int nDstYSize,
465 int nSrcXOff=0,
int nSrcYOff=0,
466 int nSrcXSize=0,
int nSrcYSize=0,
467 double dfProgressBase=0.0,
double dfProgressScale=1.0);
468 CPLErr WarpRegion(
int nDstXOff,
int nDstYOff,
469 int nDstXSize,
int nDstYSize,
470 int nSrcXOff,
int nSrcYOff,
471 int nSrcXSize,
int nSrcYSize,
472 int nSrcXExtraSize,
int nSrcYExtraSize,
473 double dfProgressBase,
double dfProgressScale);
474 CPLErr WarpRegionToBuffer(
int nDstXOff,
int nDstYOff,
475 int nDstXSize,
int nDstYSize,
478 int nSrcXOff=0,
int nSrcYOff=0,
479 int nSrcXSize=0,
int nSrcYSize=0,
480 double dfProgressBase=0.0,
double dfProgressScale=1.0);
481 CPLErr WarpRegionToBuffer(
int nDstXOff,
int nDstYOff,
482 int nDstXSize,
int nDstYSize,
485 int nSrcXOff,
int nSrcYOff,
486 int nSrcXSize,
int nSrcYSize,
487 int nSrcXExtraSize,
int nSrcYExtraSize,
488 double dfProgressBase,
double dfProgressScale);
503 int,
int,
int,
int,
int,
int,
int,
int );
506 int,
int,
int,
int );
515 typedef double (*FilterFuncType)(
double dfX);
519 typedef double (*FilterFunc4ValuesType)(
double* padfVals);
520 FilterFunc4ValuesType GWKGetFilterFunc4Values(
GDALResampleAlg eResampleAlg);
void * pDstValidityMaskFuncArg
Unused.
Definition: gdalwarper.h:203
int nSrcXOff
X offset of the source buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:357
Definition: gdalwarper.h:63
int nFiltInitX
X filtering offset.
Definition: gdalwarper.h:352
int nSrcXExtraSize
Extra pixels (included in nSrcXSize) reserved for filter window.
Definition: gdalwarper.h:315
GDALDataType
Definition: gdal.h:57
double dfYScale
Y resampling scale, i.e.
Definition: gdalwarper.h:342
Document node structure.
Definition: cpl_minixml.h:66
This class represents the lowest level of abstraction of warping.
Definition: gdalwarper.h:297
Definitions for CPL mini XML Parser/Serializer.
Definition: gdalwarper.h:54
Definition: gdalwarper.h:61
GByte ** papabySrcImage
Array of nBands source images of size nSrcXSize * nSrcYSize.
Definition: gdalwarper.h:319
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:352
double dfXScale
X resampling scale, i.e.
Definition: gdalwarper.h:340
Definition: gdalwarper.h:72
CPLErr GDALInitializeWarpedVRT(GDALDatasetH hDS, GDALWarpOptions *psWO)
Set warp info on virtual warped dataset.
Definition: vrtwarped.cpp:1049
GUInt32 * panUnifiedSrcValid
Unified validity mask of size (nSrcXSize * nSrcYSize + WARP_EXTRA_ELTS) / 8.
Definition: gdalwarper.h:324
int nDstXSize
Width of the destination image.
Definition: gdalwarper.h:329
int * panDstBands
Definition: gdalwarper.h:147
void * pProgressArg
Definition: gdalwarper.h:172
int nDstXOff
X offset of the destination buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:362
unsigned int GUInt32
Unsigned int32 type.
Definition: cpl_port.h:199
double dfWarpMemoryLimit
Definition: gdalwarper.h:125
int nSrcAlphaBand
Definition: gdalwarper.h:150
Definition: gdalwarper.h:62
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:241
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:207
GDALMaskFunc pfnSrcDensityMaskFunc
Unused.
Definition: gdalwarper.h:191
CPLErr GDALWarpRegionToBuffer(GDALWarpOperationH, int, int, int, int, void *, GDALDataType, int, int, int, int)
Definition: gdalwarpoperation.cpp:2188
char ** papszWarpOptions
Warp options.
Definition: gdalwarper.h:301
void ** papSrcPerBandValidityMaskFuncArg
Unused.
Definition: gdalwarper.h:183
Definition: gdalwarper.h:55
void * pSrcDensityMaskFuncArg
Unused.
Definition: gdalwarper.h:193
Definition: gdalwarper.h:56
void * pPostWarpProcessorArg
Unused.
Definition: gdalwarper.h:213
GUInt32 * panDstValid
Validify mask of size (nDstXSize * nDstYSize) / 8.
Definition: gdalwarper.h:335
double * padfDstNoDataReal
Definition: gdalwarper.h:162
GWKAverageOrModeAlg
Definition: gdalwarper.h:67
GDALDataType eWorkingDataType
Working data type.
Definition: gdalwarper.h:306
float * pafUnifiedSrcDensity
Unified source density of size nSrcXSize * nSrcYSize + WARP_EXTRA_ELTS.
Definition: gdalwarper.h:326
double * padfSrcNoDataImag
Definition: gdalwarper.h:159
int nFiltInitY
Y filtering offset.
Definition: gdalwarper.h:354
GDALResampleAlg eResampleAlg
Definition: gdalwarper.h:128
CPLErr GDALChunkAndWarpMulti(GDALWarpOperationH, int, int, int, int)
Definition: gdalwarpoperation.cpp:1057
GDALMaskFunc pfnDstValidityMaskFunc
Unused.
Definition: gdalwarper.h:201
CPLErr GDALWarpRegion(GDALWarpOperationH, int, int, int, int, int, int, int, int)
Definition: gdalwarpoperation.cpp:1584
GDALDatasetH GDALCreateWarpedVRT(GDALDatasetH hSrcDS, int nPixels, int nLines, double *padfGeoTransform, GDALWarpOptions *psOptions)
Create virtual warped dataset.
Definition: vrtwarped.cpp:242
Definition: gdalwarper.h:68
GDALTransformerFunc pfnTransformer
Definition: gdalwarper.h:175
double dfProgressScale
Scale value for progress computation.
Definition: gdalwarper.h:379
void GDALDestroyWarpOperation(GDALWarpOperationH)
Definition: gdalwarpoperation.cpp:690
void GDALDestroyWarpOptions(GDALWarpOptions *)
Destroy a warp options structure.
Definition: gdalwarper.cpp:1274
void * pSrcValidityMaskFuncArg
Unused.
Definition: gdalwarper.h:188
CPLErr GDALReprojectImage(GDALDatasetH hSrcDS, const char *pszSrcWKT, GDALDatasetH hDstDS, const char *pszDstWKT, GDALResampleAlg eResampleAlg, double dfWarpMemoryLimit, double dfMaxError, GDALProgressFunc pfnProgress, void *pProgressArg, GDALWarpOptions *psOptions)
Reproject image.
Definition: gdalwarper.cpp:97
double * padfDstNoDataImag
Definition: gdalwarper.h:165
GDALMaskFunc pfnSrcValidityMaskFunc
Unused.
Definition: gdalwarper.h:186
Definition: gdalwarper.h:69
Definition: gdalwarper.h:60
Definition: gdalwarper.h:71
GDALMaskFunc pfnDstDensityMaskFunc
Unused.
Definition: gdalwarper.h:196
int nDstYOff
Y offset of the destination buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:364
GDALResampleAlg eResample
Resample algorithm.
Definition: gdalwarper.h:304
void * pPreWarpProcessorArg
Unused.
Definition: gdalwarper.h:208
GDALResampleAlg
Definition: gdalwarper.h:50
double dfProgressBase
Base/offset value for progress computation.
Definition: gdalwarper.h:377
Warp control options for use with GDALWarpOperation::Initialize()
Definition: gdalwarper.h:120
GDALProgressFunc pfnProgress
Definition: gdalwarper.h:169
void * pDstDensityMaskFuncArg
Unused.
Definition: gdalwarper.h:198
Definition: gdalwarper.h:53
int nSrcYExtraSize
Extra pixels (included in nSrcYSize) reserved for filter window.
Definition: gdalwarper.h:317
High level image warping class.
Definition: gdalwarper.h:417
int nXRadius
X size of window to filter.
Definition: gdalwarper.h:348
GDALWarpOptions * GDALCloneWarpOptions(const GDALWarpOptions *)
Clone a warp options structure.
Definition: gdalwarper.cpp:1315
void * pTransformerArg
Definition: gdalwarper.h:178
int nSrcYSize
Height of the source image.
Definition: gdalwarper.h:313
GDALProgressFunc pfnProgress
Progress function.
Definition: gdalwarper.h:372
Definition: gdalwarper.h:59
Definition: gdalwarper.h:52
int * panSrcBands
Definition: gdalwarper.h:144
double * padfDstNoDataReal
Array of nBands value for destination nodata.
Definition: gdalwarper.h:382
int(* GDALTransformerFunc)(void *pTransformerArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
Definition: gdal_alg.h:114
void * GDALDriverH
Opaque type used for the C bindings of the C++ GDALDriver class.
Definition: gdal.h:247
char ** papszWarpOptions
A string list of additional options controlling the warp operation in name=value format.
Definition: gdalwarper.h:122
int nDstYSize
Height of the destination image.
Definition: gdalwarper.h:331
GDALWarpOptions * GDALCreateWarpOptions(void)
Create a warp options structure.
Definition: gdalwarper.cpp:1255
Definition: gdalwarper.h:73
double dfXFilter
X size of filter kernel.
Definition: gdalwarper.h:344
int nBands
Number of input and output bands (excluding alpha bands)
Definition: gdalwarper.h:308
CPLErr GDALChunkAndWarpImage(GDALWarpOperationH, int, int, int, int)
Definition: gdalwarpoperation.cpp:817
Definition: gdalwarper.h:51
Public (C callable) GDAL algorithm entry points, and definitions.
void * pTransformerArg
User data provided to pfnTransformer.
Definition: gdalwarper.h:369
GDALMaskFunc * papfnSrcPerBandValidityMaskFunc
Unused.
Definition: gdalwarper.h:181
int nSrcXSize
Width of the source image.
Definition: gdalwarper.h:311
GDALDatasetH hSrcDS
Definition: gdalwarper.h:135
int nBandCount
Definition: gdalwarper.h:141
float * pafDstDensity
Destination density of size nDstXSize * nDstYSize.
Definition: gdalwarper.h:337
GDALDataType eWorkingDataType
Definition: gdalwarper.h:132
CPLErr GDALCreateAndReprojectImage(GDALDatasetH hSrcDS, const char *pszSrcWKT, const char *pszDstFilename, const char *pszDstWKT, GDALDriverH hDstDriver, char **papszCreateOptions, GDALResampleAlg eResampleAlg, double dfWarpMemoryLimit, double dfMaxError, GDALProgressFunc pfnProgress, void *pProgressArg, GDALWarpOptions *psOptions)
Reproject an image and create the target reprojected image.
Definition: gdalwarper.cpp:269
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:354
GDALTransformerFunc pfnTransformer
Pixel transformation function.
Definition: gdalwarper.h:367
int nYRadius
Y size of window to filter.
Definition: gdalwarper.h:350
GDALDatasetH hDstDS
Definition: gdalwarper.h:138
Definition: gdalwarper.h:57
void * hCutline
Definition: gdalwarper.h:216
double dfYFilter
Y size of filter kernel.
Definition: gdalwarper.h:346
double dfCutlineBlendDist
Definition: gdalwarper.h:219
GDALDatasetH GDALAutoCreateWarpedVRT(GDALDatasetH hSrcDS, const char *pszSrcWKT, const char *pszDstWKT, GDALResampleAlg eResampleAlg, double dfMaxError, const GDALWarpOptions *psOptions)
Create virtual warped dataset automatically.
Definition: vrtwarped.cpp:100
double * padfSrcNoDataReal
Definition: gdalwarper.h:156
void * GDALWarpOperationH
Opaque type representing a GDALWarpOperation object.
Definition: gdalwarper.h:496
void * pProgress
User data provided to pfnProgress.
Definition: gdalwarper.h:374
int nSrcYOff
Y offset of the source buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:359
Definition: gdalwarper.h:70
CPLErr
Error category.
Definition: cpl_error.h:52
GDALWarpOperationH GDALCreateWarpOperation(const GDALWarpOptions *)
Definition: gdalwarpoperation.cpp:669
GByte ** papabyDstImage
Array of nBands destination images of size nDstXSize * nDstYSize.
Definition: gdalwarper.h:333
int nDstAlphaBand
Definition: gdalwarper.h:153
GUInt32 ** papanBandSrcValid
Array of nBands validity mask of size (nSrcXSize * nSrcYSize + WARP_EXTRA_ELTS) / 8...
Definition: gdalwarper.h:322