14#ifndef GDALPANSHARPEN_H_INCLUDED
15#define GDALPANSHARPEN_H_INCLUDED
104 int nXOff,
int nYOff,
int nXSize,
105 int nYSize,
void *pDataBuf,
128 const void *pPanBuffer;
129 const void *pUpsampledSpectralBuffer;
142struct GDALPansharpenResampleJob
144 GDALDataset *poMEMDS =
nullptr;
153 void *pBuffer =
nullptr;
162 struct timeval *ptv =
nullptr;
166 std::string osLastErrorMsg{};
180 std::vector<int> anInputBands{};
181 std::vector<GDALDataset *> aVDS{};
182 std::vector<GDALRasterBand *> aMSBands{};
184 int bPositiveWeights = TRUE;
186 int nKernelRadius = 0;
189 static void PansharpenJobThreadFunc(
void *pUserData);
190 static void PansharpenResampleJobThreadFunc(
void *pUserData);
192 template <
class WorkDataType,
class OutDataType>
193 void WeightedBroveyWithNoData(
const WorkDataType *pPanBuffer,
194 const WorkDataType *pUpsampledSpectralBuffer,
195 OutDataType *pDataBuf,
size_t nValues,
197 WorkDataType nMaxValue)
const;
198 template <
class WorkDataType,
class OutDataType,
int bHasBitDepth>
199 void WeightedBrovey3(
const WorkDataType *pPanBuffer,
200 const WorkDataType *pUpsampledSpectralBuffer,
201 OutDataType *pDataBuf,
size_t nValues,
202 size_t nBandValues, WorkDataType nMaxValue)
const;
205 template <
class WorkDataType,
class OutDataType>
206 void WeightedBrovey(
const WorkDataType *pPanBuffer,
207 const WorkDataType *pUpsampledSpectralBuffer,
208 OutDataType *pDataBuf,
size_t nValues,
209 size_t nBandValues, WorkDataType nMaxValue)
const;
210 template <
class WorkDataType>
211 CPLErr WeightedBrovey(
const WorkDataType *pPanBuffer,
212 const WorkDataType *pUpsampledSpectralBuffer,
214 size_t nValues,
size_t nBandValues,
215 WorkDataType nMaxValue)
const;
218 template <
class WorkDataType>
219 CPLErr WeightedBrovey(
const WorkDataType *pPanBuffer,
220 const WorkDataType *pUpsampledSpectralBuffer,
222 size_t nValues,
size_t nBandValues)
const;
224 void WeightedBroveyPositiveWeights(
const T *pPanBuffer,
225 const T *pUpsampledSpectralBuffer,
226 T *pDataBuf,
size_t nValues,
227 size_t nBandValues, T nMaxValue)
const;
229 template <
class T,
int NINPUT,
int NOUTPUT>
230 size_t WeightedBroveyPositiveWeightsInternal(
231 const T *pPanBuffer,
const T *pUpsampledSpectralBuffer, T *pDataBuf,
232 size_t nValues,
size_t nBandValues, T nMaxValue)
const;
236 void WeightedBroveyGByteOrUInt16(
const T *pPanBuffer,
237 const T *pUpsampledSpectralBuffer,
238 T *pDataBuf,
size_t nValues,
239 size_t nBandValues, T nMaxValue)
const;
244 const void *pUpsampledSpectralBuffer,
void *pDataBuf,
245 size_t nValues,
size_t nBandValues,
Pool of worker threads.
Definition cpl_worker_thread_pool.h:64
Pansharpening operation class.
Definition gdalpansharpen.h:176
CPLErr ProcessRegion(int nXOff, int nYOff, int nXSize, int nYSize, void *pDataBuf, GDALDataType eBufDataType)
Executes a pansharpening operation on a rectangular region of the resulting dataset.
Definition gdalpansharpen.cpp:1162
GDALPansharpenOperation()
Pansharpening operation constructor.
~GDALPansharpenOperation()
Pansharpening operation destructor.
Definition gdalpansharpen.cpp:153
GDALPansharpenOptions * GetOptions()
Return options.
Definition gdalpansharpen.cpp:1835
CPLErr Initialize(const GDALPansharpenOptions *psOptions)
Initialize the pansharpening operation.
Definition gdalpansharpen.cpp:172
CPLErr
Error category.
Definition cpl_error.h:37
#define CPL_C_END
Macro to end a block of C symbols.
Definition cpl_port.h:289
#define CPL_C_START
Macro to start a block of C symbols.
Definition cpl_port.h:285
unsigned int GUInt32
Unsigned int32 type.
Definition cpl_port.h:167
#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:936
Public (C callable) GDAL entry points.
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition gdal.h:386
GDALDataType
Definition gdal.h:48
@ GDT_Unknown
Definition gdal.h:49
GDALRIOResampleAlg
RasterIO() resampling method.
Definition gdal.h:135
@ GRIORA_NearestNeighbour
Definition gdal.h:136
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition gdal_fwd.h:45
This file is legacy since GDAL 3.12, but will be kept at least in the whole GDAL 3....
CPLErr GDALPansharpenProcessRegion(GDALPansharpenOperationH hOperation, int nXOff, int nYOff, int nXSize, int nYSize, void *pDataBuf, GDALDataType eBufDataType)
Executes a pansharpening operation on a rectangular region of the resulting dataset.
Definition gdalpansharpen.cpp:1907
GDALPansharpenOperationH GDALCreatePansharpenOperation(const GDALPansharpenOptions *)
Instantiate a pansharpening operation.
Definition gdalpansharpen.cpp:1855
GDALPansharpenAlg
Pansharpening algorithms.
Definition gdalpansharpen.h:31
@ GDAL_PSH_WEIGHTED_BROVEY
Definition gdalpansharpen.h:33
void GDALDestroyPansharpenOptions(GDALPansharpenOptions *)
Destroy pansharpening options.
Definition gdalpansharpen.cpp:72
void * GDALPansharpenOperationH
Definition gdalpansharpen.h:98
GDALPansharpenOptions * GDALCreatePansharpenOptions(void)
Create pansharpening options.
Definition gdalpansharpen.cpp:52
GDALPansharpenOptions * GDALClonePansharpenOptions(const GDALPansharpenOptions *psOptions)
Clone pansharpening options.
Definition gdalpansharpen.cpp:96
void GDALDestroyPansharpenOperation(GDALPansharpenOperationH)
Destroy a pansharpening operation.
Definition gdalpansharpen.cpp:1874
Pansharpening options.
Definition gdalpansharpen.h:39
GDALPansharpenAlg ePansharpenAlg
Definition gdalpansharpen.h:41
int bHasNoData
Definition gdalpansharpen.h:79
int nBitDepth
Definition gdalpansharpen.h:49
double * padfWeights
Definition gdalpansharpen.h:55
int nThreads
Number of threads or -1 to mean ALL_CPUS.
Definition gdalpansharpen.h:89
int nWeightCount
Definition gdalpansharpen.h:52
GDALRasterBandH * pahInputSpectralBands
Array of nInputSpectralBands input spectral bands.
Definition gdalpansharpen.h:69
int * panOutPansharpenedBands
Definition gdalpansharpen.h:76
GDALRIOResampleAlg eResampleAlg
Definition gdalpansharpen.h:45
GDALRasterBandH hPanchroBand
Definition gdalpansharpen.h:58
int nInputSpectralBands
Definition gdalpansharpen.h:61
int nOutPansharpenedBands
Definition gdalpansharpen.h:72
double dfNoData
NoData value of the panchromatic and spectral bands (only taken into account if bHasNoData = TRUE).
Definition gdalpansharpen.h:84