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 );
86GDALWarpNoDataMasker(
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 );
92GDALWarpDstAlphaMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
93 int nXOff,
int nYOff,
int nXSize,
int nYSize,
95 int bMaskIsFloat,
void *pValidityMask );
97GDALWarpSrcAlphaMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
98 int nXOff,
int nYOff,
int nXSize,
int nYSize,
100 int bMaskIsFloat,
void *pValidityMask,
int* pbOutAllOpaque );
103GDALWarpSrcMaskMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
104 int nXOff,
int nYOff,
int nXSize,
int nYSize,
106 int bMaskIsFloat,
void *pValidityMask );
109GDALWarpCutlineMasker(
void *pMaskFuncArg,
int nBandCount,
GDALDataType eType,
110 int nXOff,
int nYOff,
int nXSize,
int nYSize,
112 int bMaskIsFloat,
void *pValidityMask );
208 CPLErr (*pfnPreWarpChunkProcessor)(
void *pKern,
void *pArg );
213 CPLErr (*pfnPostWarpChunkProcessor)(
void *pKern,
void *pArg);
230void CPL_DLL CPL_STDCALL
233void CPL_DLL CPL_STDCALL
236void CPL_DLL CPL_STDCALL
239void CPL_DLL CPL_STDCALL
242void CPL_DLL CPL_STDCALL
245void CPL_DLL CPL_STDCALL
248void CPL_DLL CPL_STDCALL
267 GDALProgressFunc pfnProgress,
void *pProgressArg,
272 const char *pszDstFilename,
const char *pszDstWKT,
276 GDALProgressFunc pfnProgress,
void *pProgressArg,
285 const char *pszSrcWKT,
const char *pszDstWKT,
291 int nPixels,
int nLines,
double *padfGeoTransform,
300#if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
311#define WARP_EXTRA_ELTS 1
422void* GWKThreadsCreate(
char** papszWarpOptions,
424 void* pTransformerArg);
425void GWKThreadsEnd(
void* psThreadDataIn);
439typedef struct _GDALWarpChunk GDALWarpChunk;
450 int ValidateOptions();
452 CPLErr ComputeSourceWindow(
int nDstXOff,
int nDstYOff,
453 int nDstXSize,
int nDstYSize,
454 int *pnSrcXOff,
int *pnSrcYOff,
455 int *pnSrcXSize,
int *pnSrcYSize,
456 double *pdfSrcXExtraSize,
double *pdfSrcYExtraSize,
457 double* pdfSrcFillRatio );
459 void ComputeSourceWindowStartingFromSource(
460 int nDstXOff,
int nDstYOff,
461 int nDstXSize,
int nDstYSize,
462 double* padfSrcMinX,
double* padfSrcMinY,
463 double* padfSrcMaxX,
double* padfSrcMaxY);
466 const char *pszType );
469 CPLMutex *hWarpMutex;
473 GDALWarpChunk *pasChunkList;
476 unsigned long nLastTimeReported;
480 void WipeChunkList();
481 CPLErr CollectChunkListInternal(
int nDstXOff,
int nDstYOff,
482 int nDstXSize,
int nDstYSize );
483 void CollectChunkList(
int nDstXOff,
int nDstYOff,
484 int nDstXSize,
int nDstYSize );
485 void ReportTiming(
const char * );
492 void* CreateDestinationBuffer(
int nDstXSize,
int nDstYSize,
493 int *pbWasInitialized =
nullptr );
494 static void DestroyDestinationBuffer(
void* pDstBuffer);
498 CPLErr ChunkAndWarpImage(
int nDstXOff,
int nDstYOff,
499 int nDstXSize,
int nDstYSize );
500 CPLErr ChunkAndWarpMulti(
int nDstXOff,
int nDstYOff,
501 int nDstXSize,
int nDstYSize );
502 CPLErr WarpRegion(
int nDstXOff,
int nDstYOff,
503 int nDstXSize,
int nDstYSize,
504 int nSrcXOff=0,
int nSrcYOff=0,
505 int nSrcXSize=0,
int nSrcYSize=0,
506 double dfProgressBase=0.0,
double dfProgressScale=1.0);
507 CPLErr WarpRegion(
int nDstXOff,
int nDstYOff,
508 int nDstXSize,
int nDstYSize,
509 int nSrcXOff,
int nSrcYOff,
510 int nSrcXSize,
int nSrcYSize,
511 double dfSrcXExtraSize,
double dfSrcYExtraSize,
512 double dfProgressBase,
double dfProgressScale);
513 CPLErr WarpRegionToBuffer(
int nDstXOff,
int nDstYOff,
514 int nDstXSize,
int nDstYSize,
517 int nSrcXOff=0,
int nSrcYOff=0,
518 int nSrcXSize=0,
int nSrcYSize=0,
519 double dfProgressBase=0.0,
double dfProgressScale=1.0);
520 CPLErr WarpRegionToBuffer(
int nDstXOff,
int nDstYOff,
521 int nDstXSize,
int nDstYSize,
524 int nSrcXOff,
int nSrcYOff,
525 int nSrcXSize,
int nSrcYSize,
526 double dfSrcXExtraSize,
double dfSrcYExtraSize,
527 double dfProgressBase,
double dfProgressScale);
542 int,
int,
int,
int,
int,
int,
int,
int );
545 int,
int,
int,
int );
554typedef double (*FilterFuncType)(
double dfX);
558typedef double (*FilterFunc4ValuesType)(
double* padfVals);
559FilterFunc4ValuesType GWKGetFilterFunc4Values(
GDALResampleAlg eResampleAlg);
This class represents the lowest level of abstraction of warping.
Definition: gdalwarper.h:321
int nXRadius
X size of window to filter.
Definition: gdalwarper.h:373
int nSrcYSize
Height of the source image.
Definition: gdalwarper.h:338
char ** papszWarpOptions
Warp options.
Definition: gdalwarper.h:326
int nFiltInitX
X filtering offset.
Definition: gdalwarper.h:377
double dfXScale
X resampling scale, i.e.
Definition: gdalwarper.h:365
double dfYFilter
Y size of filter kernel.
Definition: gdalwarper.h:371
int nDstXSize
Width of the destination image.
Definition: gdalwarper.h:354
double dfSrcXExtraSize
Extra pixels (included in nSrcXSize) reserved for filter window.
Definition: gdalwarper.h:340
double * padfDstNoDataReal
Array of nBands value for destination nodata.
Definition: gdalwarper.h:407
int nDstXOff
X offset of the destination buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:387
GDALResampleAlg eResample
Resample algorithm.
Definition: gdalwarper.h:329
GDALTransformerFunc pfnTransformer
Pixel transformation function.
Definition: gdalwarper.h:392
GUInt32 * panUnifiedSrcValid
Unified validity mask of size (nSrcXSize * nSrcYSize + WARP_EXTRA_ELTS) / 8.
Definition: gdalwarper.h:349
int nDstYSize
Height of the destination image.
Definition: gdalwarper.h:356
int nBands
Number of input and output bands (excluding alpha bands)
Definition: gdalwarper.h:333
double dfProgressBase
Base/offset value for progress computation.
Definition: gdalwarper.h:402
GDALDataType eWorkingDataType
Working data type.
Definition: gdalwarper.h:331
double dfSrcYExtraSize
Extra pixels (included in nSrcYSize) reserved for filter window.
Definition: gdalwarper.h:342
int nSrcXOff
X offset of the source buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:382
int nSrcYOff
Y offset of the source buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:384
int nDstYOff
Y offset of the destination buffer regarding the top-left corner of the image.
Definition: gdalwarper.h:389
int nFiltInitY
Y filtering offset.
Definition: gdalwarper.h:379
GDALProgressFunc pfnProgress
Progress function.
Definition: gdalwarper.h:397
GUInt32 ** papanBandSrcValid
Array of nBands validity mask of size (nSrcXSize * nSrcYSize + WARP_EXTRA_ELTS) / 8.
Definition: gdalwarper.h:347
void * pProgress
User data provided to pfnProgress.
Definition: gdalwarper.h:399
float * pafUnifiedSrcDensity
Unified source density of size nSrcXSize * nSrcYSize + WARP_EXTRA_ELTS.
Definition: gdalwarper.h:351
int nYRadius
Y size of window to filter.
Definition: gdalwarper.h:375
float * pafDstDensity
Destination density of size nDstXSize * nDstYSize.
Definition: gdalwarper.h:362
double dfXFilter
X size of filter kernel.
Definition: gdalwarper.h:369
double dfYScale
Y resampling scale, i.e.
Definition: gdalwarper.h:367
GByte ** papabyDstImage
Array of nBands destination images of size nDstXSize * nDstYSize.
Definition: gdalwarper.h:358
double dfProgressScale
Scale value for progress computation.
Definition: gdalwarper.h:404
int nSrcXSize
Width of the source image.
Definition: gdalwarper.h:336
void * pTransformerArg
User data provided to pfnTransformer.
Definition: gdalwarper.h:394
GByte ** papabySrcImage
Array of nBands source images of size nSrcXSize * nSrcYSize.
Definition: gdalwarper.h:344
GUInt32 * panDstValid
Validify mask of size (nDstXSize * nDstYSize) / 8.
Definition: gdalwarper.h:360
High level image warping class.
Definition: gdalwarper.h:442
CPLErr
Error category.
Definition: cpl_error.h:53
Definitions for CPL mini XML Parser/Serializer.
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:339
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:337
unsigned int GUInt32
Unsigned int32 type.
Definition: cpl_port.h:207
#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:997
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:215
GDALDataType
Definition: gdal.h:60
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:255
void * GDALDriverH
Opaque type used for the C bindings of the C++ GDALDriver class.
Definition: gdal.h:261
Public (C callable) GDAL algorithm entry points, and definitions.
int(* GDALTransformerFunc)(void *pTransformerArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
Definition: gdal_alg.h:114
CPLErr GDALWarpRegion(GDALWarpOperationH, int, int, int, int, int, int, int, int)
Definition: gdalwarpoperation.cpp:1659
void GDALDestroyWarpOperation(GDALWarpOperationH)
Definition: gdalwarpoperation.cpp:797
GDALWarpOperationH GDALCreateWarpOperation(const GDALWarpOptions *)
Definition: gdalwarpoperation.cpp:776
GWKAverageOrModeAlg
Definition: gdalwarper.h:67
@ GWKAOM_Fmode
Definition: gdalwarper.h:69
@ GWKAOM_Min
Definition: gdalwarper.h:72
@ GWKAOM_Quant
Definition: gdalwarper.h:73
@ GWKAOM_Imode
Definition: gdalwarper.h:70
@ GWKAOM_Average
Definition: gdalwarper.h:68
@ GWKAOM_Max
Definition: gdalwarper.h:71
void GDALWarpInitDstNoDataImag(GDALWarpOptions *, double dNoDataImag)
Initialize padfDstNoDataImag with specified value.
Definition: gdalwarper.cpp:1399
GDALResampleAlg
Definition: gdalwarper.h:50
@ GRA_CubicSpline
Definition: gdalwarper.h:54
@ GRA_Q1
Definition: gdalwarper.h:62
@ GRA_Max
Definition: gdalwarper.h:59
@ GRA_Cubic
Definition: gdalwarper.h:53
@ GRA_Min
Definition: gdalwarper.h:60
@ GRA_Lanczos
Definition: gdalwarper.h:55
@ GRA_Mode
Definition: gdalwarper.h:57
@ GRA_NearestNeighbour
Definition: gdalwarper.h:51
@ GRA_Q3
Definition: gdalwarper.h:63
@ GRA_Med
Definition: gdalwarper.h:61
@ GRA_Average
Definition: gdalwarper.h:56
@ GRA_Bilinear
Definition: gdalwarper.h:52
GDALDatasetH GDALCreateWarpedVRT(GDALDatasetH hSrcDS, int nPixels, int nLines, double *padfGeoTransform, GDALWarpOptions *psOptions)
Create virtual warped dataset.
Definition: vrtwarped.cpp:274
void GDALDestroyWarpOptions(GDALWarpOptions *)
Destroy a warp options structure.
Definition: gdalwarper.cpp:1241
void * GDALWarpOperationH
Opaque type representing a GDALWarpOperation object.
Definition: gdalwarper.h:535
CPLErr GDALWarpRegionToBuffer(GDALWarpOperationH, int, int, int, int, void *, GDALDataType, int, int, int, int)
Definition: gdalwarpoperation.cpp:2282
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
CPLErr GDALChunkAndWarpImage(GDALWarpOperationH, int, int, int, int)
Definition: gdalwarpoperation.cpp:979
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:1529
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
void GDALWarpInitSrcNoDataImag(GDALWarpOptions *, double dNoDataImag)
Initialize padfSrcNoDataImag with specified value.
Definition: gdalwarper.cpp:1418
CPLErr GDALInitializeWarpedVRT(GDALDatasetH hDS, GDALWarpOptions *psWO)
Set warp info on virtual warped dataset.
Definition: vrtwarped.cpp:1174
void GDALWarpInitSrcNoDataReal(GDALWarpOptions *, double dNoDataReal)
Initialize padfSrcNoDataReal with specified value.
Definition: gdalwarper.cpp:1361
void GDALWarpInitDstNoDataReal(GDALWarpOptions *, double dNoDataReal)
Initialize padfDstNoDataReal with specified value.
Definition: gdalwarper.cpp:1341
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
CPLErr GDALChunkAndWarpMulti(GDALWarpOperationH, int, int, int, int)
Definition: gdalwarpoperation.cpp:1214
GDALWarpOptions * GDALCreateWarpOptions(void)
Create a warp options structure.
Definition: gdalwarper.cpp:1222
void GDALWarpInitNoDataReal(GDALWarpOptions *, double dNoDataReal)
Initialize padfSrcNoDataReal and padfDstNoDataReal with specified value.
Definition: gdalwarper.cpp:1381
GDALWarpOptions * GDALCloneWarpOptions(const GDALWarpOptions *)
Clone a warp options structure.
Definition: gdalwarper.cpp:1282
void GDALWarpResolveWorkingDataType(GDALWarpOptions *)
If the working data type is unknown, this method will determine a valid working data type to support ...
Definition: gdalwarper.cpp:1438
Document node structure.
Definition: cpl_minixml.h:67
Warp control options for use with GDALWarpOperation::Initialize()
Definition: gdalwarper.h:120
int nSrcAlphaBand
Definition: gdalwarper.h:150
GDALDatasetH hDstDS
Definition: gdalwarper.h:138
char ** papszWarpOptions
A string list of additional options controlling the warp operation in name=value format.
Definition: gdalwarper.h:122
double * padfDstNoDataImag
Definition: gdalwarper.h:167
GDALMaskFunc pfnDstValidityMaskFunc
Unused.
Definition: gdalwarper.h:203
double * padfSrcNoDataReal
Definition: gdalwarper.h:156
void * pTransformerArg
Definition: gdalwarper.h:180
GDALDataType eWorkingDataType
Definition: gdalwarper.h:132
void * pSrcValidityMaskFuncArg
Unused.
Definition: gdalwarper.h:190
void * pDstDensityMaskFuncArg
Unused.
Definition: gdalwarper.h:200
int * panDstBands
Definition: gdalwarper.h:147
double dfCutlineBlendDist
Definition: gdalwarper.h:221
GDALProgressFunc pfnProgress
Definition: gdalwarper.h:171
GDALMaskFunc pfnSrcDensityMaskFunc
Unused.
Definition: gdalwarper.h:193
GDALDatasetH hSrcDS
Definition: gdalwarper.h:135
GDALMaskFunc pfnDstDensityMaskFunc
Unused.
Definition: gdalwarper.h:198
void * pPreWarpProcessorArg
Unused.
Definition: gdalwarper.h:210
void * pProgressArg
Definition: gdalwarper.h:174
int nDstAlphaBand
Definition: gdalwarper.h:153
int * panSrcBands
Definition: gdalwarper.h:144
GDALTransformerFunc pfnTransformer
Definition: gdalwarper.h:177
int nBandCount
Definition: gdalwarper.h:141
double dfWarpMemoryLimit
Definition: gdalwarper.h:125
void * pSrcDensityMaskFuncArg
Unused.
Definition: gdalwarper.h:195
GDALMaskFunc * papfnSrcPerBandValidityMaskFunc
Unused.
Definition: gdalwarper.h:183
GDALResampleAlg eResampleAlg
Definition: gdalwarper.h:128
GDALMaskFunc pfnSrcValidityMaskFunc
Unused.
Definition: gdalwarper.h:188
void * hCutline
Definition: gdalwarper.h:218
void * pDstValidityMaskFuncArg
Unused.
Definition: gdalwarper.h:205
void ** papSrcPerBandValidityMaskFuncArg
Unused.
Definition: gdalwarper.h:185
double * padfDstNoDataReal
Definition: gdalwarper.h:163
double * padfSrcNoDataImag
Definition: gdalwarper.h:160
void * pPostWarpProcessorArg
Unused.
Definition: gdalwarper.h:215