Go to the documentation of this file.
31 #ifndef GDALWARPER_H_INCLUDED
32 #define GDALWARPER_H_INCLUDED
44 #include "cpl_multiproc.h"
85 (*GDALMaskFunc)(
void *pMaskFuncArg,
88 int nXSize,
int nYSize,
89 GByte **papabyImageData,
90 int bMaskIsFloat,
void *pMask );
93 GDALWarpNoDataMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
94 int nXOff,
int nYOff,
int nXSize,
int nYSize,
95 GByte **papabyImageData,
int bMaskIsFloat,
96 void *pValidityMask,
int* pbOutAllValid );
99 GDALWarpDstAlphaMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
100 int nXOff,
int nYOff,
int nXSize,
int nYSize,
102 int bMaskIsFloat,
void *pValidityMask );
104 GDALWarpSrcAlphaMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
105 int nXOff,
int nYOff,
int nXSize,
int nYSize,
107 int bMaskIsFloat,
void *pValidityMask,
int* pbOutAllOpaque );
110 GDALWarpSrcMaskMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
111 int nXOff,
int nYOff,
int nXSize,
int nYSize,
113 int bMaskIsFloat,
void *pValidityMask );
116 GDALWarpCutlineMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
117 int nXOff,
int nYOff,
int nXSize,
int nYSize,
119 int bMaskIsFloat,
void *pValidityMask );
215 CPLErr (*pfnPreWarpChunkProcessor)(
void *pKern,
void *pArg );
220 CPLErr (*pfnPostWarpChunkProcessor)(
void *pKern,
void *pArg);
237 void CPL_DLL CPL_STDCALL
240 void CPL_DLL CPL_STDCALL
243 void CPL_DLL CPL_STDCALL
246 void CPL_DLL CPL_STDCALL
249 void CPL_DLL CPL_STDCALL
252 void CPL_DLL CPL_STDCALL
255 void CPL_DLL CPL_STDCALL
269 CPLErr CPL_DLL CPL_STDCALL
274 GDALProgressFunc pfnProgress,
void *pProgressArg,
277 CPLErr CPL_DLL CPL_STDCALL
279 const char *pszDstFilename,
const char *pszDstWKT,
283 GDALProgressFunc pfnProgress,
void *pProgressArg,
292 const char *pszSrcWKT,
const char *pszDstWKT,
298 const char *pszSrcWKT,
const char *pszDstWKT,
305 int nPixels,
int nLines,
double *padfGeoTransform,
308 CPLErr CPL_DLL CPL_STDCALL
314 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
328 #define WARP_EXTRA_ELTS 1
430 bool bApplyVerticalShift =
false;
432 double dfMultFactorVerticalShift = 1.0;
443 void* GWKThreadsCreate(
char** papszWarpOptions,
445 void* pTransformerArg);
446 void GWKThreadsEnd(
void* psThreadDataIn);
460 typedef struct _GDALWarpChunk GDALWarpChunk;
471 int ValidateOptions();
473 CPLErr ComputeSourceWindow(
int nDstXOff,
int nDstYOff,
474 int nDstXSize,
int nDstYSize,
475 int *pnSrcXOff,
int *pnSrcYOff,
476 int *pnSrcXSize,
int *pnSrcYSize,
477 double *pdfSrcXExtraSize,
double *pdfSrcYExtraSize,
478 double* pdfSrcFillRatio );
480 void ComputeSourceWindowStartingFromSource(
481 int nDstXOff,
int nDstYOff,
482 int nDstXSize,
int nDstYSize,
483 double* padfSrcMinX,
double* padfSrcMinY,
484 double* padfSrcMaxX,
double* padfSrcMaxY);
487 const char *pszType );
490 CPLMutex *hWarpMutex;
494 GDALWarpChunk *pasChunkList;
497 unsigned long nLastTimeReported;
503 std::vector<std::pair<double, double>> aDstXYSpecialPoints{};
505 bool m_bIsTranslationOnPixelBoundaries =
false;
507 void WipeChunkList();
508 CPLErr CollectChunkListInternal(
int nDstXOff,
int nDstYOff,
509 int nDstXSize,
int nDstYSize );
510 void CollectChunkList(
int nDstXOff,
int nDstYOff,
511 int nDstXSize,
int nDstYSize );
512 void ReportTiming(
const char * );
519 void* CreateDestinationBuffer(
int nDstXSize,
int nDstYSize,
520 int *pbWasInitialized =
nullptr );
521 static void DestroyDestinationBuffer(
void* pDstBuffer);
525 CPLErr ChunkAndWarpImage(
int nDstXOff,
int nDstYOff,
526 int nDstXSize,
int nDstYSize );
527 CPLErr ChunkAndWarpMulti(
int nDstXOff,
int nDstYOff,
528 int nDstXSize,
int nDstYSize );
529 CPLErr WarpRegion(
int nDstXOff,
int nDstYOff,
530 int nDstXSize,
int nDstYSize,
531 int nSrcXOff=0,
int nSrcYOff=0,
532 int nSrcXSize=0,
int nSrcYSize=0,
533 double dfProgressBase=0.0,
double dfProgressScale=1.0);
534 CPLErr WarpRegion(
int nDstXOff,
int nDstYOff,
535 int nDstXSize,
int nDstYSize,
536 int nSrcXOff,
int nSrcYOff,
537 int nSrcXSize,
int nSrcYSize,
538 double dfSrcXExtraSize,
double dfSrcYExtraSize,
539 double dfProgressBase,
double dfProgressScale);
540 CPLErr WarpRegionToBuffer(
int nDstXOff,
int nDstYOff,
541 int nDstXSize,
int nDstYSize,
544 int nSrcXOff=0,
int nSrcYOff=0,
545 int nSrcXSize=0,
int nSrcYSize=0,
546 double dfProgressBase=0.0,
double dfProgressScale=1.0);
547 CPLErr WarpRegionToBuffer(
int nDstXOff,
int nDstYOff,
548 int nDstXSize,
int nDstYSize,
551 int nSrcXOff,
int nSrcYOff,
552 int nSrcXSize,
int nSrcYSize,
553 double dfSrcXExtraSize,
double dfSrcYExtraSize,
554 double dfProgressBase,
double dfProgressScale);
569 int,
int,
int,
int,
int,
int,
int,
int );
572 int,
int,
int,
int );
581 typedef double (*FilterFuncType)(
double dfX);
585 typedef double (*FilterFunc4ValuesType)(
double* padfVals);
586 FilterFunc4ValuesType GWKGetFilterFunc4Values(
GDALResampleAlg eResampleAlg);
int nSrcYSize
Height of the source image.
Definition: gdalwarper.h:355
int nXRadius
X size of window to filter.
Definition: gdalwarper.h:390
float * pafUnifiedSrcDensity
Unified source density of size nSrcXSize * nSrcYSize + WARP_EXTRA_ELTS.
Definition: gdalwarper.h:368
@ 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:241
double dfXFilter
X size of filter kernel.
Definition: gdalwarper.h:386
double * padfSrcNoDataImag
Definition: gdalwarper.h:167
double dfProgressScale
Scale value for progress computation.
Definition: gdalwarper.h:421
GDALProgressFunc pfnProgress
Definition: gdalwarper.h:178
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:203
int nFiltInitX
X filtering offset.
Definition: gdalwarper.h:394
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:156
void * pTransformerArg
Definition: gdalwarper.h:187
void * pPostWarpProcessorArg
Unused.
Definition: gdalwarper.h:222
double dfYFilter
Y size of filter kernel.
Definition: gdalwarper.h:388
double * padfDstNoDataImag
Definition: gdalwarper.h:174
GByte ** papabySrcImage
Array of nBands source images of size nSrcXSize * nSrcYSize.
Definition: gdalwarper.h:361
GDALResampleAlg eResample
Resample algorithm.
Definition: gdalwarper.h:346
char ** papszWarpOptions
Warp options.
Definition: gdalwarper.h:343
GDALMaskFunc pfnDstDensityMaskFunc
Unused.
Definition: gdalwarper.h:205
int(* GDALTransformerFunc)(void *pTransformerArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
Definition: gdal_alg.h:115
int nDstYOff
Y offset of the destination buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:406
double dfYScale
Y resampling scale, i.e.
Definition: gdalwarper.h:384
@ GRA_CubicSpline
Definition: gdalwarper.h:54
void * pDstDensityMaskFuncArg
Unused.
Definition: gdalwarper.h:207
CPLErr GDALWarpRegionToBuffer(GDALWarpOperationH, int, int, int, int, void *, GDALDataType, int, int, int, int)
Definition: gdalwarpoperation.cpp:2336
void GDALWarpInitSrcNoDataReal(GDALWarpOptions *, double dNoDataReal)
Initialize padfSrcNoDataReal with specified value.
Definition: gdalwarper.cpp:1406
void * pSrcDensityMaskFuncArg
Unused.
Definition: gdalwarper.h:202
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:130
@ GWKAOM_Min
Definition: gdalwarper.h:77
void GDALDestroyWarpOptions(GDALWarpOptions *)
Destroy a warp options structure.
Definition: gdalwarper.cpp:1285
@ GRA_Sum
Definition: gdalwarper.h:64
int nBandCount
Definition: gdalwarper.h:148
int nSrcYOff
Y offset of the source buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:401
GDALDatasetH GDALCreateWarpedVRT(GDALDatasetH hSrcDS, int nPixels, int nLines, double *padfGeoTransform, GDALWarpOptions *psOptions)
Create virtual warped dataset.
Definition: vrtwarped.cpp:372
This class represents the lowest level of abstraction of warping.
Definition: gdalwarper.h:337
@ GWKAOM_Average
Definition: gdalwarper.h:73
GWKAverageOrModeAlg
Definition: gdalwarper.h:72
GDALDataType
Definition: gdal.h:63
@ GRA_Q1
Definition: gdalwarper.h:62
int nYRadius
Y size of window to filter.
Definition: gdalwarper.h:392
Document node structure.
Definition: cpl_minixml.h:69
Definition: gdalwarper.h:463
double dfXScale
X resampling scale, i.e.
Definition: gdalwarper.h:382
double dfSrcXExtraSize
Extra pixels (included in nSrcXSize) reserved for filter window.
Definition: gdalwarper.h:357
void GDALWarpInitDstNoDataReal(GDALWarpOptions *, double dNoDataReal)
Initialize padfDstNoDataReal with specified value.
Definition: gdalwarper.cpp:1386
char ** papszWarpOptions
Definition: gdalwarper.h:129
float * pafDstDensity
Destination density of size nDstXSize * nDstYSize.
Definition: gdalwarper.h:379
void GDALWarpInitDstNoDataImag(GDALWarpOptions *, double dNoDataImag)
Initialize padfDstNoDataImag with specified value.
Definition: gdalwarper.cpp:1444
GDALMaskFunc pfnSrcValidityMaskFunc
Unused.
Definition: gdalwarper.h:195
void * pProgressArg
Definition: gdalwarper.h:181
@ GRA_Lanczos
Definition: gdalwarper.h:55
int nFiltInitY
Y filtering offset.
Definition: gdalwarper.h:396
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:304
@ GRA_Average
Definition: gdalwarper.h:56
Warp control options for use with GDALWarpOperation::Initialize()
Definition: gdalwarper.h:127
@ GWKAOM_Max
Definition: gdalwarper.h:76
int nSrcAlphaBand
Definition: gdalwarper.h:157
void GDALDestroyWarpOperation(GDALWarpOperationH)
Definition: gdalwarpoperation.cpp:831
void * pProgress
User data provided to pfnProgress.
Definition: gdalwarper.h:416
int * panSrcBands
Definition: gdalwarper.h:151
double dfSrcYExtraSize
Extra pixels (included in nSrcYSize) reserved for filter window.
Definition: gdalwarper.h:359
GDALTransformerFunc pfnTransformer
Pixel transformation function.
Definition: gdalwarper.h:409
GDALDatasetH hSrcDS
Definition: gdalwarper.h:142
@ GWKAOM_RMS
Definition: gdalwarper.h:80
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1056
@ GRA_Cubic
Definition: gdalwarper.h:53
@ GWKAOM_Sum
Definition: gdalwarper.h:79
GDALWarpOptions * GDALCloneWarpOptions(const GDALWarpOptions *)
Clone a warp options structure.
Definition: gdalwarper.cpp:1326
void ** papSrcPerBandValidityMaskFuncArg
Unused.
Definition: gdalwarper.h:192
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:98
void * pTransformerArg
User data provided to pfnTransformer.
Definition: gdalwarper.h:411
@ GRA_Min
Definition: gdalwarper.h:60
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:306
double * padfDstNoDataReal
Definition: gdalwarper.h:170
int nBands
Number of input and output bands (excluding alpha bands)
Definition: gdalwarper.h:350
int * panDstBands
Definition: gdalwarper.h:154
@ GRA_RMS
Definition: gdalwarper.h:65
GUInt32 * panUnifiedSrcValid
Unified validity mask of size (nSrcXSize * nSrcYSize + WARP_EXTRA_ELTS) / 8.
Definition: gdalwarper.h:366
void * GDALWarpOperationH
Opaque type representing a GDALWarpOperation object.
Definition: gdalwarper.h:562
CPLErr GDALWarpRegion(GDALWarpOperationH, int, int, int, int, int, int, int, int)
Definition: gdalwarpoperation.cpp:1693
@ GWKAOM_Fmode
Definition: gdalwarper.h:74
GDALMaskFunc * papfnSrcPerBandValidityMaskFunc
Unused.
Definition: gdalwarper.h:190
GDALResampleAlg
Definition: gdalwarper.h:50
@ GRA_Bilinear
Definition: gdalwarper.h:52
@ GRA_Max
Definition: gdalwarper.h:59
GDALDatasetH hDstDS
Definition: gdalwarper.h:145
void GDALWarpInitSrcNoDataImag(GDALWarpOptions *, double dNoDataImag)
Initialize padfSrcNoDataImag with specified value.
Definition: gdalwarper.cpp:1463
void * pDstValidityMaskFuncArg
Unused.
Definition: gdalwarper.h:212
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:1588
double * padfDstNoDataReal
Array of nBands value for destination nodata.
Definition: gdalwarper.h:424
CPLErr GDALChunkAndWarpImage(GDALWarpOperationH, int, int, int, int)
Definition: gdalwarpoperation.cpp:1013
GDALMaskFunc pfnSrcDensityMaskFunc
Unused.
Definition: gdalwarper.h:200
void * pPreWarpProcessorArg
Unused.
Definition: gdalwarper.h:217
GByte ** papabyDstImage
Array of nBands destination images of size nDstXSize * nDstYSize.
Definition: gdalwarper.h:375
double dfCutlineBlendDist
Definition: gdalwarper.h:228
void * hCutline
Definition: gdalwarper.h:225
GDALDataType eWorkingDataType
Working data type.
Definition: gdalwarper.h:348
@ GRA_Mode
Definition: gdalwarper.h:57
double * padfSrcNoDataReal
Definition: gdalwarper.h:163
GDALResampleAlg eResampleAlg
Definition: gdalwarper.h:135
CPLErr GDALChunkAndWarpMulti(GDALWarpOperationH, int, int, int, int)
Definition: gdalwarpoperation.cpp:1248
CPLErr
Error category.
Definition: cpl_error.h:52
int nDstAlphaBand
Definition: gdalwarper.h:160
GDALTransformerFunc pfnTransformer
Definition: gdalwarper.h:184
int nSrcXOff
X offset of the source buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:399
@ GWKAOM_Quant
Definition: gdalwarper.h:78
int nDstXOff
X offset of the destination buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:404
int nDstYSize
Height of the destination image.
Definition: gdalwarper.h:373
void GDALWarpInitNoDataReal(GDALWarpOptions *, double dNoDataReal)
Initialize padfSrcNoDataReal and padfDstNoDataReal with specified value.
Definition: gdalwarper.cpp:1426
GDALMaskFunc pfnDstValidityMaskFunc
Unused.
Definition: gdalwarper.h:210
GDALWarpOperationH GDALCreateWarpOperation(const GDALWarpOptions *)
Definition: gdalwarpoperation.cpp:810
@ GRA_NearestNeighbour
Definition: gdalwarper.h:51
int nDstXSize
Width of the destination image.
Definition: gdalwarper.h:371
@ GWKAOM_Imode
Definition: gdalwarper.h:75
void GDALWarpResolveWorkingDataType(GDALWarpOptions *)
If the working data type is unknown, this method will determine a valid working data type to support ...
Definition: gdalwarper.cpp:1483
GUInt32 * panDstValid
Validify mask of size (nDstXSize * nDstYSize) / 8.
Definition: gdalwarper.h:377
CPLErr GDALInitializeWarpedVRT(GDALDatasetH hDS, GDALWarpOptions *psWO)
Set warp info on virtual warped dataset.
Definition: vrtwarped.cpp:1265
void * pSrcValidityMaskFuncArg
Unused.
Definition: gdalwarper.h:197
double dfWarpMemoryLimit
Definition: gdalwarper.h:132
int nSrcXSize
Width of the source image.
Definition: gdalwarper.h:353
#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:930
GDALProgressFunc pfnProgress
Progress function.
Definition: gdalwarper.h:414
GDALWarpOptions * GDALCreateWarpOptions(void)
Create a warp options structure.
Definition: gdalwarper.cpp:1266
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:269
GDALDataType eWorkingDataType
Definition: gdalwarper.h:139
@ GRA_Q3
Definition: gdalwarper.h:63
GUInt32 ** papanBandSrcValid
Array of nBands validity mask of size (nSrcXSize * nSrcYSize + WARP_EXTRA_ELTS) / 8.
Definition: gdalwarper.h:364
double dfProgressBase
Base/offset value for progress computation.
Definition: gdalwarper.h:419
void * GDALDriverH
Opaque type used for the C bindings of the C++ GDALDriver class.
Definition: gdal.h:275
unsigned int GUInt32
Unsigned int32 type.
Definition: cpl_port.h:195