Go to the documentation of this file.
31 #ifndef GDALWARPER_H_INCLUDED
32 #define GDALWARPER_H_INCLUDED
44 #include "cpl_multiproc.h"
80 (*GDALMaskFunc)(
void *pMaskFuncArg,
83 int nXSize,
int nYSize,
84 GByte **papabyImageData,
85 int bMaskIsFloat,
void *pMask );
88 GDALWarpNoDataMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
89 int nXOff,
int nYOff,
int nXSize,
int nYSize,
90 GByte **papabyImageData,
int bMaskIsFloat,
91 void *pValidityMask,
int* pbOutAllValid );
94 GDALWarpDstAlphaMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
95 int nXOff,
int nYOff,
int nXSize,
int nYSize,
97 int bMaskIsFloat,
void *pValidityMask );
99 GDALWarpSrcAlphaMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
100 int nXOff,
int nYOff,
int nXSize,
int nYSize,
102 int bMaskIsFloat,
void *pValidityMask,
int* pbOutAllOpaque );
105 GDALWarpSrcMaskMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
106 int nXOff,
int nYOff,
int nXSize,
int nYSize,
108 int bMaskIsFloat,
void *pValidityMask );
111 GDALWarpCutlineMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
112 int nXOff,
int nYOff,
int nXSize,
int nYSize,
114 int bMaskIsFloat,
void *pValidityMask );
210 CPLErr (*pfnPreWarpChunkProcessor)(
void *pKern,
void *pArg );
215 CPLErr (*pfnPostWarpChunkProcessor)(
void *pKern,
void *pArg);
232 void CPL_DLL CPL_STDCALL
235 void CPL_DLL CPL_STDCALL
238 void CPL_DLL CPL_STDCALL
241 void CPL_DLL CPL_STDCALL
244 void CPL_DLL CPL_STDCALL
247 void CPL_DLL CPL_STDCALL
250 void CPL_DLL CPL_STDCALL
264 CPLErr CPL_DLL CPL_STDCALL
269 GDALProgressFunc pfnProgress,
void *pProgressArg,
272 CPLErr CPL_DLL CPL_STDCALL
274 const char *pszDstFilename,
const char *pszDstWKT,
278 GDALProgressFunc pfnProgress,
void *pProgressArg,
287 const char *pszSrcWKT,
const char *pszDstWKT,
293 const char *pszSrcWKT,
const char *pszDstWKT,
300 int nPixels,
int nLines,
double *padfGeoTransform,
303 CPLErr CPL_DLL CPL_STDCALL
309 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
320 #define WARP_EXTRA_ELTS 1
431 void* GWKThreadsCreate(
char** papszWarpOptions,
433 void* pTransformerArg);
434 void GWKThreadsEnd(
void* psThreadDataIn);
448 typedef struct _GDALWarpChunk GDALWarpChunk;
459 int ValidateOptions();
461 CPLErr ComputeSourceWindow(
int nDstXOff,
int nDstYOff,
462 int nDstXSize,
int nDstYSize,
463 int *pnSrcXOff,
int *pnSrcYOff,
464 int *pnSrcXSize,
int *pnSrcYSize,
465 double *pdfSrcXExtraSize,
double *pdfSrcYExtraSize,
466 double* pdfSrcFillRatio );
468 void ComputeSourceWindowStartingFromSource(
469 int nDstXOff,
int nDstYOff,
470 int nDstXSize,
int nDstYSize,
471 double* padfSrcMinX,
double* padfSrcMinY,
472 double* padfSrcMaxX,
double* padfSrcMaxY);
475 const char *pszType );
478 CPLMutex *hWarpMutex;
482 GDALWarpChunk *pasChunkList;
485 unsigned long nLastTimeReported;
489 void WipeChunkList();
490 CPLErr CollectChunkListInternal(
int nDstXOff,
int nDstYOff,
491 int nDstXSize,
int nDstYSize );
492 void CollectChunkList(
int nDstXOff,
int nDstYOff,
493 int nDstXSize,
int nDstYSize );
494 void ReportTiming(
const char * );
501 void* CreateDestinationBuffer(
int nDstXSize,
int nDstYSize,
502 int *pbWasInitialized =
nullptr );
503 static void DestroyDestinationBuffer(
void* pDstBuffer);
507 CPLErr ChunkAndWarpImage(
int nDstXOff,
int nDstYOff,
508 int nDstXSize,
int nDstYSize );
509 CPLErr ChunkAndWarpMulti(
int nDstXOff,
int nDstYOff,
510 int nDstXSize,
int nDstYSize );
511 CPLErr WarpRegion(
int nDstXOff,
int nDstYOff,
512 int nDstXSize,
int nDstYSize,
513 int nSrcXOff=0,
int nSrcYOff=0,
514 int nSrcXSize=0,
int nSrcYSize=0,
515 double dfProgressBase=0.0,
double dfProgressScale=1.0);
516 CPLErr WarpRegion(
int nDstXOff,
int nDstYOff,
517 int nDstXSize,
int nDstYSize,
518 int nSrcXOff,
int nSrcYOff,
519 int nSrcXSize,
int nSrcYSize,
520 double dfSrcXExtraSize,
double dfSrcYExtraSize,
521 double dfProgressBase,
double dfProgressScale);
522 CPLErr WarpRegionToBuffer(
int nDstXOff,
int nDstYOff,
523 int nDstXSize,
int nDstYSize,
526 int nSrcXOff=0,
int nSrcYOff=0,
527 int nSrcXSize=0,
int nSrcYSize=0,
528 double dfProgressBase=0.0,
double dfProgressScale=1.0);
529 CPLErr WarpRegionToBuffer(
int nDstXOff,
int nDstYOff,
530 int nDstXSize,
int nDstYSize,
533 int nSrcXOff,
int nSrcYOff,
534 int nSrcXSize,
int nSrcYSize,
535 double dfSrcXExtraSize,
double dfSrcYExtraSize,
536 double dfProgressBase,
double dfProgressScale);
551 int,
int,
int,
int,
int,
int,
int,
int );
554 int,
int,
int,
int );
563 typedef double (*FilterFuncType)(
double dfX);
567 typedef double (*FilterFunc4ValuesType)(
double* padfVals);
568 FilterFunc4ValuesType GWKGetFilterFunc4Values(
GDALResampleAlg eResampleAlg);
int nSrcYSize
Height of the source image.
Definition: gdalwarper.h:347
int nXRadius
X size of window to filter.
Definition: gdalwarper.h:382
float * pafUnifiedSrcDensity
Unified source density of size nSrcXSize * nSrcYSize + WARP_EXTRA_ELTS.
Definition: gdalwarper.h:360
@ GRA_Med
Definition: gdalwarper.h:61
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:240
double dfXFilter
X size of filter kernel.
Definition: gdalwarper.h:378
double * padfSrcNoDataImag
Definition: gdalwarper.h:162
double dfProgressScale
Scale value for progress computation.
Definition: gdalwarper.h:413
GDALProgressFunc pfnProgress
Definition: gdalwarper.h:173
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:215
int nFiltInitX
X filtering offset.
Definition: gdalwarper.h:386
GDALDatasetH GDALAutoCreateWarpedVRTEx(GDALDatasetH hSrcDS, const char *pszSrcWKT, const char *pszDstWKT, GDALResampleAlg eResampleAlg, double dfMaxError, const GDALWarpOptions *psOptions, CSLConstList papszTransformerOptions)
Create virtual warped dataset automatically.
Definition: vrtwarped.cpp:130
void * pTransformerArg
Definition: gdalwarper.h:182
void * pPostWarpProcessorArg
Unused.
Definition: gdalwarper.h:217
double dfYFilter
Y size of filter kernel.
Definition: gdalwarper.h:380
double * padfDstNoDataImag
Definition: gdalwarper.h:169
GByte ** papabySrcImage
Array of nBands source images of size nSrcXSize * nSrcYSize.
Definition: gdalwarper.h:353
GDALResampleAlg eResample
Resample algorithm.
Definition: gdalwarper.h:338
char ** papszWarpOptions
Warp options.
Definition: gdalwarper.h:335
GDALMaskFunc pfnDstDensityMaskFunc
Unused.
Definition: gdalwarper.h:200
int(* GDALTransformerFunc)(void *pTransformerArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
Definition: gdal_alg.h:114
int nDstYOff
Y offset of the destination buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:398
double dfYScale
Y resampling scale, i.e.
Definition: gdalwarper.h:376
@ GRA_CubicSpline
Definition: gdalwarper.h:54
void * pDstDensityMaskFuncArg
Unused.
Definition: gdalwarper.h:202
CPLErr GDALWarpRegionToBuffer(GDALWarpOperationH, int, int, int, int, void *, GDALDataType, int, int, int, int)
Definition: gdalwarpoperation.cpp:2283
void GDALWarpInitSrcNoDataReal(GDALWarpOptions *, double dNoDataReal)
Initialize padfSrcNoDataReal with specified value.
Definition: gdalwarper.cpp:1362
void * pSrcDensityMaskFuncArg
Unused.
Definition: gdalwarper.h:197
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:104
Definitions for CPL mini XML Parser/Serializer.
@ GWKAOM_Min
Definition: gdalwarper.h:73
void GDALDestroyWarpOptions(GDALWarpOptions *)
Destroy a warp options structure.
Definition: gdalwarper.cpp:1241
@ GRA_Sum
Definition: gdalwarper.h:64
int nBandCount
Definition: gdalwarper.h:143
int nSrcYOff
Y offset of the source buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:393
GDALDatasetH GDALCreateWarpedVRT(GDALDatasetH hSrcDS, int nPixels, int nLines, double *padfGeoTransform, GDALWarpOptions *psOptions)
Create virtual warped dataset.
Definition: vrtwarped.cpp:307
This class represents the lowest level of abstraction of warping.
Definition: gdalwarper.h:330
@ GWKAOM_Average
Definition: gdalwarper.h:69
GWKAverageOrModeAlg
Definition: gdalwarper.h:68
GDALDataType
Definition: gdal.h:60
@ GRA_Q1
Definition: gdalwarper.h:62
int nYRadius
Y size of window to filter.
Definition: gdalwarper.h:384
Document node structure.
Definition: cpl_minixml.h:70
High level image warping class.
Definition: gdalwarper.h:451
double dfXScale
X resampling scale, i.e.
Definition: gdalwarper.h:374
double dfSrcXExtraSize
Extra pixels (included in nSrcXSize) reserved for filter window.
Definition: gdalwarper.h:349
void GDALWarpInitDstNoDataReal(GDALWarpOptions *, double dNoDataReal)
Initialize padfDstNoDataReal with specified value.
Definition: gdalwarper.cpp:1342
char ** papszWarpOptions
A string list of additional options controlling the warp operation in name=value format.
Definition: gdalwarper.h:124
float * pafDstDensity
Destination density of size nDstXSize * nDstYSize.
Definition: gdalwarper.h:371
void GDALWarpInitDstNoDataImag(GDALWarpOptions *, double dNoDataImag)
Initialize padfDstNoDataImag with specified value.
Definition: gdalwarper.cpp:1400
GDALMaskFunc pfnSrcValidityMaskFunc
Unused.
Definition: gdalwarper.h:190
void * pProgressArg
Definition: gdalwarper.h:176
@ GRA_Lanczos
Definition: gdalwarper.h:55
int nFiltInitY
Y filtering offset.
Definition: gdalwarper.h:388
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:337
@ GRA_Average
Definition: gdalwarper.h:56
Warp control options for use with GDALWarpOperation::Initialize()
Definition: gdalwarper.h:122
@ GWKAOM_Max
Definition: gdalwarper.h:72
int nSrcAlphaBand
Definition: gdalwarper.h:152
void GDALDestroyWarpOperation(GDALWarpOperationH)
Definition: gdalwarpoperation.cpp:798
void * pProgress
User data provided to pfnProgress.
Definition: gdalwarper.h:408
int * panSrcBands
Definition: gdalwarper.h:146
double dfSrcYExtraSize
Extra pixels (included in nSrcYSize) reserved for filter window.
Definition: gdalwarper.h:351
GDALTransformerFunc pfnTransformer
Pixel transformation function.
Definition: gdalwarper.h:401
GDALDatasetH hSrcDS
Definition: gdalwarper.h:137
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1216
@ GRA_Cubic
Definition: gdalwarper.h:53
@ GWKAOM_Sum
Definition: gdalwarper.h:75
GDALWarpOptions * GDALCloneWarpOptions(const GDALWarpOptions *)
Clone a warp options structure.
Definition: gdalwarper.cpp:1282
void ** papSrcPerBandValidityMaskFuncArg
Unused.
Definition: gdalwarper.h:187
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
void * pTransformerArg
User data provided to pfnTransformer.
Definition: gdalwarper.h:403
@ GRA_Min
Definition: gdalwarper.h:60
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:339
double * padfDstNoDataReal
Definition: gdalwarper.h:165
int nBands
Number of input and output bands (excluding alpha bands)
Definition: gdalwarper.h:342
int * panDstBands
Definition: gdalwarper.h:149
GUInt32 * panUnifiedSrcValid
Unified validity mask of size (nSrcXSize * nSrcYSize + WARP_EXTRA_ELTS) / 8.
Definition: gdalwarper.h:358
void * GDALWarpOperationH
Opaque type representing a GDALWarpOperation object.
Definition: gdalwarper.h:544
CPLErr GDALWarpRegion(GDALWarpOperationH, int, int, int, int, int, int, int, int)
Definition: gdalwarpoperation.cpp:1660
@ GWKAOM_Fmode
Definition: gdalwarper.h:70
GDALMaskFunc * papfnSrcPerBandValidityMaskFunc
Unused.
Definition: gdalwarper.h:185
GDALResampleAlg
Definition: gdalwarper.h:50
@ GRA_Bilinear
Definition: gdalwarper.h:52
@ GRA_Max
Definition: gdalwarper.h:59
GDALDatasetH hDstDS
Definition: gdalwarper.h:140
Public (C callable) GDAL algorithm entry points, and definitions.
void GDALWarpInitSrcNoDataImag(GDALWarpOptions *, double dNoDataImag)
Initialize padfSrcNoDataImag with specified value.
Definition: gdalwarper.cpp:1419
void * pDstValidityMaskFuncArg
Unused.
Definition: gdalwarper.h:207
void GDALWarpInitDefaultBandMapping(GDALWarpOptions *, int nBandCount)
Init src and dst band mappings such that Bands[i] = i+1 for nBandCount Does nothing if psOptionsIn->n...
Definition: gdalwarper.cpp:1530
double * padfDstNoDataReal
Array of nBands value for destination nodata.
Definition: gdalwarper.h:416
CPLErr GDALChunkAndWarpImage(GDALWarpOperationH, int, int, int, int)
Definition: gdalwarpoperation.cpp:980
GDALMaskFunc pfnSrcDensityMaskFunc
Unused.
Definition: gdalwarper.h:195
void * pPreWarpProcessorArg
Unused.
Definition: gdalwarper.h:212
GByte ** papabyDstImage
Array of nBands destination images of size nDstXSize * nDstYSize.
Definition: gdalwarper.h:367
double dfCutlineBlendDist
Definition: gdalwarper.h:223
void * hCutline
Definition: gdalwarper.h:220
GDALDataType eWorkingDataType
Working data type.
Definition: gdalwarper.h:340
@ GRA_Mode
Definition: gdalwarper.h:57
double * padfSrcNoDataReal
Definition: gdalwarper.h:158
GDALResampleAlg eResampleAlg
Definition: gdalwarper.h:130
CPLErr GDALChunkAndWarpMulti(GDALWarpOperationH, int, int, int, int)
Definition: gdalwarpoperation.cpp:1215
CPLErr
Error category.
Definition: cpl_error.h:53
int nDstAlphaBand
Definition: gdalwarper.h:155
GDALTransformerFunc pfnTransformer
Definition: gdalwarper.h:179
int nSrcXOff
X offset of the source buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:391
@ GWKAOM_Quant
Definition: gdalwarper.h:74
int nDstXOff
X offset of the destination buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:396
int nDstYSize
Height of the destination image.
Definition: gdalwarper.h:365
void GDALWarpInitNoDataReal(GDALWarpOptions *, double dNoDataReal)
Initialize padfSrcNoDataReal and padfDstNoDataReal with specified value.
Definition: gdalwarper.cpp:1382
GDALMaskFunc pfnDstValidityMaskFunc
Unused.
Definition: gdalwarper.h:205
GDALWarpOperationH GDALCreateWarpOperation(const GDALWarpOptions *)
Definition: gdalwarpoperation.cpp:777
@ GRA_NearestNeighbour
Definition: gdalwarper.h:51
int nDstXSize
Width of the destination image.
Definition: gdalwarper.h:363
@ GWKAOM_Imode
Definition: gdalwarper.h:71
void GDALWarpResolveWorkingDataType(GDALWarpOptions *)
If the working data type is unknown, this method will determine a valid working data type to support ...
Definition: gdalwarper.cpp:1439
GUInt32 * panDstValid
Validify mask of size (nDstXSize * nDstYSize) / 8.
Definition: gdalwarper.h:369
CPLErr GDALInitializeWarpedVRT(GDALDatasetH hDS, GDALWarpOptions *psWO)
Set warp info on virtual warped dataset.
Definition: vrtwarped.cpp:1211
void * pSrcValidityMaskFuncArg
Unused.
Definition: gdalwarper.h:192
double dfWarpMemoryLimit
Definition: gdalwarper.h:127
int nSrcXSize
Width of the source image.
Definition: gdalwarper.h:345
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:1007
GDALProgressFunc pfnProgress
Progress function.
Definition: gdalwarper.h:406
GDALWarpOptions * GDALCreateWarpOptions(void)
Create a warp options structure.
Definition: gdalwarper.cpp:1222
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:258
GDALDataType eWorkingDataType
Definition: gdalwarper.h:134
@ GRA_Q3
Definition: gdalwarper.h:63
GUInt32 ** papanBandSrcValid
Array of nBands validity mask of size (nSrcXSize * nSrcYSize + WARP_EXTRA_ELTS) / 8.
Definition: gdalwarper.h:356
double dfProgressBase
Base/offset value for progress computation.
Definition: gdalwarper.h:411
void * GDALDriverH
Opaque type used for the C bindings of the C++ GDALDriver class.
Definition: gdal.h:264
unsigned int GUInt32
Unsigned int32 type.
Definition: cpl_port.h:207