GDAL
gdal_alg_priv.h
1 /******************************************************************************
2  * $Id: gdal_alg_priv.h 28826 2015-03-30 17:51:14Z rouault $
3  *
4  * Project: GDAL Image Processing Algorithms
5  * Purpose: Prototypes and definitions for various GDAL based algorithms:
6  * private declarations.
7  * Author: Andrey Kiselev, dron@ak4719.spb.edu
8  *
9  ******************************************************************************
10  * Copyright (c) 2008, Andrey Kiselev <dron@ak4719.spb.edu>
11  * Copyright (c) 2010-2013, Even Rouault <even dot rouault at mines-paris dot org>
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included
21  * in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  ****************************************************************************/
31 
32 #ifndef GDAL_ALG_PRIV_H_INCLUDED
33 #define GDAL_ALG_PRIV_H_INCLUDED
34 
35 #include "gdal_alg.h"
36 
37 CPL_C_START
38 
40 typedef enum { GBV_UserBurnValue = 0, GBV_Z = 1, GBV_M = 2
44 } GDALBurnValueSrc;
45 
46 typedef enum {
47  GRMA_Replace = 0,
48  GRMA_Add = 1,
49 } GDALRasterMergeAlg;
50 
51 typedef struct {
52  unsigned char * pabyChunkBuf;
53  int nXSize;
54  int nYSize;
55  int nBands;
56  GDALDataType eType;
57  double *padfBurnValue;
58  GDALBurnValueSrc eBurnValueSource;
59  GDALRasterMergeAlg eMergeAlg;
61 
62 /************************************************************************/
63 /* Low level rasterizer API. */
64 /************************************************************************/
65 
66 typedef void (*llScanlineFunc)( void *, int, int, int, double );
67 typedef void (*llPointFunc)( void *, int, int, double );
68 
69 void GDALdllImagePoint( int nRasterXSize, int nRasterYSize,
70  int nPartCount, int *panPartSize,
71  double *padfX, double *padfY, double *padfVariant,
72  llPointFunc pfnPointFunc, void *pCBData );
73 
74 void GDALdllImageLine( int nRasterXSize, int nRasterYSize,
75  int nPartCount, int *panPartSize,
76  double *padfX, double *padfY, double *padfVariant,
77  llPointFunc pfnPointFunc, void *pCBData );
78 
79 void GDALdllImageLineAllTouched(int nRasterXSize, int nRasterYSize,
80  int nPartCount, int *panPartSize,
81  double *padfX, double *padfY,
82  double *padfVariant,
83  llPointFunc pfnPointFunc, void *pCBData );
84 
85 void GDALdllImageFilledPolygon(int nRasterXSize, int nRasterYSize,
86  int nPartCount, int *panPartSize,
87  double *padfX, double *padfY,
88  double *padfVariant,
89  llScanlineFunc pfnScanlineFunc, void *pCBData );
90 
91 CPL_C_END
92 
93 /************************************************************************/
94 /* Polygon Enumerator */
95 /************************************************************************/
96 
97 #define GP_NODATA_MARKER -51502112
98 
100 
101 {
102 private:
103  void MergePolygon( int nSrcId, int nDstId );
104  int NewPolygon( GInt32 nValue );
105 
106 public: // these are intended to be readonly.
107 
108  GInt32 *panPolyIdMap;
109  GInt32 *panPolyValue;
110 
111  int nNextPolygonId;
112  int nPolyAlloc;
113 
114  int nConnectedness;
115 
116 public:
117  GDALRasterPolygonEnumerator( int nConnectedness=4 );
119 
120  void ProcessLine( GInt32 *panLastLineVal, GInt32 *panThisLineVal,
121  GInt32 *panLastLineId, GInt32 *panThisLineId,
122  int nXSize );
123 
124  void CompleteMerges();
125 
126  void Clear();
127 };
128 
129 #ifdef OGR_ENABLED
130 /************************************************************************/
131 /* Polygon Enumerator */
132 /* */
133 /* Buffers has float values instead og GInt32 */
134 /************************************************************************/
136 
137 {
138 private:
139  void MergePolygon( int nSrcId, int nDstId );
140  int NewPolygon( float fValue );
141 
142 public: // these are intended to be readonly.
143 
144  GInt32 *panPolyIdMap;
145  float *pafPolyValue;
146 
147  int nNextPolygonId;
148  int nPolyAlloc;
149 
150  int nConnectedness;
151 
152 public:
153  GDALRasterFPolygonEnumerator( int nConnectedness=4 );
155 
156  void ProcessLine( float *pafLastLineVal, float *pafThisLineVal,
157  GInt32 *panLastLineId, GInt32 *panThisLineId,
158  int nXSize );
159 
160  void CompleteMerges();
161 
162  void Clear();
163 };
164 #endif
165 
166 typedef void* (*GDALTransformDeserializeFunc)( CPLXMLNode *psTree );
167 
168 void* GDALRegisterTransformDeserializer(const char* pszTransformName,
169  GDALTransformerFunc pfnTransformerFunc,
170  GDALTransformDeserializeFunc pfnDeserializeFunc);
171 void GDALUnregisterTransformDeserializer(void* pData);
172 
173 void GDALCleanupTransformDeserializerMutex();
174 
175 /* Transformer cloning */
176 
177 void* GDALCreateTPSTransformerInt( int nGCPCount, const GDAL_GCP *pasGCPList,
178  int bReversed, char** papszOptions );
179 
180 void CPL_DLL * GDALCloneTransformer( void *pTranformerArg );
181 
182 /************************************************************************/
183 /* Color table related */
184 /************************************************************************/
185 
186 int
187 GDALComputeMedianCutPCTInternal( GDALRasterBandH hRed,
188  GDALRasterBandH hGreen,
189  GDALRasterBandH hBlue,
190  GByte* pabyRedBand,
191  GByte* pabyGreenBand,
192  GByte* pabyBlueBand,
193  int (*pfnIncludePixel)(int,int,void*),
194  int nColors,
195  int nBits,
196  int* panHistogram,
197  GDALColorTableH hColorTable,
198  GDALProgressFunc pfnProgress,
199  void * pProgressArg );
200 
201 int GDALDitherRGB2PCTInternal( GDALRasterBandH hRed,
202  GDALRasterBandH hGreen,
203  GDALRasterBandH hBlue,
204  GDALRasterBandH hTarget,
205  GDALColorTableH hColorTable,
206  int nBits,
207  GInt16* pasDynamicColorMap,
208  int bDither,
209  GDALProgressFunc pfnProgress,
210  void * pProgressArg );
211 
212 #define PRIME_FOR_65536 98317
213 #define MEDIAN_CUT_AND_DITHER_BUFFER_SIZE_65536 (6 * sizeof(int) * PRIME_FOR_65536)
214 
215 /************************************************************************/
216 /* Float comparison function. */
217 /************************************************************************/
218 
225 #define MAX_ULPS 10
226 
227 GBool GDALFloatEquals(float A, float B);
228 
229 #endif /* ndef GDAL_ALG_PRIV_H_INCLUDED */
GDALDataType
Definition: gdal.h:57
Definition: gdal_alg_priv.h:51
Document node structure.
Definition: cpl_minixml.h:65
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:230
Definition: gdal_alg_priv.h:99
int(* GDALTransformerFunc)(void *pTransformerArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
Definition: gdal_alg.h:114
Public (C callable) GDAL algorithm entry points, and definitions.
Definition: gdal_alg_priv.h:135
void * GDALColorTableH
Opaque type used for the C bindings of the C++ GDALColorTable class.
Definition: gdal.h:236
Ground Control Point.
Definition: gdal.h:442

Generated for GDAL by doxygen 1.8.11.