GDAL
gdal_alg_priv.h
00001 /******************************************************************************
00002  * $Id: gdal_alg_priv.h 36411 2016-11-21 22:03:48Z rouault $
00003  *
00004  * Project:  GDAL Image Processing Algorithms
00005  * Purpose:  Prototypes and definitions for various GDAL based algorithms:
00006  *           private declarations.
00007  * Author:   Andrey Kiselev, dron@ak4719.spb.edu
00008  *
00009  ******************************************************************************
00010  * Copyright (c) 2008, Andrey Kiselev <dron@ak4719.spb.edu>
00011  * Copyright (c) 2010-2013, Even Rouault <even dot rouault at mines-paris dot org>
00012  *
00013  * Permission is hereby granted, free of charge, to any person obtaining a
00014  * copy of this software and associated documentation files (the "Software"),
00015  * to deal in the Software without restriction, including without limitation
00016  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00017  * and/or sell copies of the Software, and to permit persons to whom the
00018  * Software is furnished to do so, subject to the following conditions:
00019  *
00020  * The above copyright notice and this permission notice shall be included
00021  * in all copies or substantial portions of the Software.
00022  *
00023  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00024  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00025  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00026  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00027  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00028  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00029  * DEALINGS IN THE SOFTWARE.
00030  ****************************************************************************/
00031 
00032 #ifndef GDAL_ALG_PRIV_H_INCLUDED
00033 #define GDAL_ALG_PRIV_H_INCLUDED
00034 
00035 #ifndef DOXYGEN_SKIP
00036 
00037 #include "gdal_alg.h"
00038 
00039 CPL_C_START
00040 
00042 typedef enum {    GBV_UserBurnValue = 0, GBV_Z = 1,    GBV_M = 2
00046 } GDALBurnValueSrc;
00047 
00048 typedef enum {
00049     GRMA_Replace = 0,
00050     GRMA_Add = 1,
00051 } GDALRasterMergeAlg;
00052 
00053 typedef struct {
00054     unsigned char * pabyChunkBuf;
00055     int nXSize;
00056     int nYSize;
00057     int nBands;
00058     GDALDataType eType;
00059     double *padfBurnValue;
00060     GDALBurnValueSrc eBurnValueSource;
00061     GDALRasterMergeAlg eMergeAlg;
00062 } GDALRasterizeInfo;
00063 
00064 /************************************************************************/
00065 /*      Low level rasterizer API.                                       */
00066 /************************************************************************/
00067 
00068 typedef void (*llScanlineFunc)( void *, int, int, int, double );
00069 typedef void (*llPointFunc)( void *, int, int, double );
00070 
00071 void GDALdllImagePoint( int nRasterXSize, int nRasterYSize,
00072                         int nPartCount, int *panPartSize,
00073                         double *padfX, double *padfY, double *padfVariant,
00074                         llPointFunc pfnPointFunc, void *pCBData );
00075 
00076 void GDALdllImageLine( int nRasterXSize, int nRasterYSize,
00077                        int nPartCount, int *panPartSize,
00078                        double *padfX, double *padfY, double *padfVariant,
00079                        llPointFunc pfnPointFunc, void *pCBData );
00080 
00081 void GDALdllImageLineAllTouched( int nRasterXSize, int nRasterYSize,
00082                                  int nPartCount, int *panPartSize,
00083                                  double *padfX, double *padfY,
00084                                  double *padfVariant,
00085                                  llPointFunc pfnPointFunc, void *pCBData );
00086 
00087 void GDALdllImageFilledPolygon( int nRasterXSize, int nRasterYSize,
00088                                 int nPartCount, int *panPartSize,
00089                                 double *padfX, double *padfY,
00090                                 double *padfVariant,
00091                                 llScanlineFunc pfnScanlineFunc, void *pCBData );
00092 
00093 CPL_C_END
00094 
00095 /************************************************************************/
00096 /*                          Polygon Enumerator                          */
00097 /************************************************************************/
00098 
00099 #define GP_NODATA_MARKER -51502112
00100 
00101 template<class DataType, class EqualityTest> class GDALRasterPolygonEnumeratorT
00102 
00103 {
00104 private:
00105     void     MergePolygon( int nSrcId, int nDstId );
00106     int      NewPolygon( DataType nValue );
00107 
00108 public:  // these are intended to be readonly.
00109 
00110     GInt32   *panPolyIdMap;
00111     DataType   *panPolyValue;
00112 
00113     int      nNextPolygonId;
00114     int      nPolyAlloc;
00115 
00116     int      nConnectedness;
00117 
00118 public:
00119     explicit GDALRasterPolygonEnumeratorT( int nConnectedness=4 );
00120             ~GDALRasterPolygonEnumeratorT();
00121 
00122     void     ProcessLine( DataType *panLastLineVal, DataType *panThisLineVal,
00123                           GInt32 *panLastLineId,  GInt32 *panThisLineId,
00124                           int nXSize );
00125 
00126     void     CompleteMerges();
00127 
00128     void     Clear();
00129 };
00130 
00131 struct IntEqualityTest
00132 {
00133     bool operator()(GInt32 a, GInt32 b) { return a == b; }
00134 };
00135 
00136 typedef GDALRasterPolygonEnumeratorT<GInt32, IntEqualityTest> GDALRasterPolygonEnumerator;
00137 
00138 typedef void* (*GDALTransformDeserializeFunc)( CPLXMLNode *psTree );
00139 
00140 void* GDALRegisterTransformDeserializer(const char* pszTransformName,
00141                                        GDALTransformerFunc pfnTransformerFunc,
00142                                        GDALTransformDeserializeFunc pfnDeserializeFunc);
00143 void GDALUnregisterTransformDeserializer(void* pData);
00144 
00145 void GDALCleanupTransformDeserializerMutex();
00146 
00147 /* Transformer cloning */
00148 
00149 void* GDALCreateTPSTransformerInt( int nGCPCount, const GDAL_GCP *pasGCPList,
00150                                    int bReversed, char** papszOptions );
00151 
00152 void CPL_DLL * GDALCloneTransformer( void *pTransformerArg );
00153 
00154 /************************************************************************/
00155 /*      Color table related                                             */
00156 /************************************************************************/
00157 
00158 // Definitions exists for T = GUInt32 and T = GUIntBig.
00159 template<class T> int
00160 GDALComputeMedianCutPCTInternal( GDALRasterBandH hRed,
00161                                  GDALRasterBandH hGreen,
00162                                  GDALRasterBandH hBlue,
00163                                  GByte* pabyRedBand,
00164                                  GByte* pabyGreenBand,
00165                                  GByte* pabyBlueBand,
00166                                  int (*pfnIncludePixel)(int,int,void*),
00167                                  int nColors,
00168                                  int nBits,
00169                                  T* panHistogram,
00170                                  GDALColorTableH hColorTable,
00171                                  GDALProgressFunc pfnProgress,
00172                                  void * pProgressArg );
00173 
00174 int GDALDitherRGB2PCTInternal( GDALRasterBandH hRed,
00175                                GDALRasterBandH hGreen,
00176                                GDALRasterBandH hBlue,
00177                                GDALRasterBandH hTarget,
00178                                GDALColorTableH hColorTable,
00179                                int nBits,
00180                                GInt16* pasDynamicColorMap,
00181                                int bDither,
00182                                GDALProgressFunc pfnProgress,
00183                                void * pProgressArg );
00184 
00185 #define PRIME_FOR_65536 98317
00186 
00187 // See HashHistogram structure in gdalmediancut.cpp and ColorIndex structure in
00188 // gdaldither.cpp 6 * sizeof(int) should be the size of the largest of both
00189 // structures.
00190 #define MEDIAN_CUT_AND_DITHER_BUFFER_SIZE_65536 (6 * sizeof(int) * PRIME_FOR_65536)
00191 
00192 /************************************************************************/
00193 /*      Float comparison function.                                      */
00194 /************************************************************************/
00195 
00202 #define MAX_ULPS 10
00203 
00204 GBool GDALFloatEquals(float A, float B);
00205 
00206 struct FloatEqualityTest
00207 {
00208     bool operator()(float a, float b) { return GDALFloatEquals(a,b) == TRUE; }
00209 };
00210 
00211 #endif /* #ifndef DOXYGEN_SKIP */
00212 
00213 #endif /* ndef GDAL_ALG_PRIV_H_INCLUDED */

Generated for GDAL by doxygen 1.7.6.1.