| Bsoft 1.9 Bernard's software package

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

tif_dirinfo.c
Go to the documentation of this file.
1 /* $Id: tif_dirinfo.c,v 1.65.2.9 2010-06-09 21:15:27 bfriesen Exp $ */
2
3 /*
4 * Copyright (c) 1988-1997 Sam Leffler
5 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
6 *
7 * Permission to use, copy, modify, distribute, and sell this software and
8 * its documentation for any purpose is hereby granted without fee, provided
9 * that (i) the above copyright notices and this permission notice appear in
10 * all copies of the software and related documentation, and (ii) the names of
11 * Sam Leffler and Silicon Graphics may not be used in any advertising or
12 * publicity relating to the software without the specific, prior written
13 * permission of Sam Leffler and Silicon Graphics.
14 *
15 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
17 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
18 *
19 * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
20 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
21 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
22 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24 * OF THIS SOFTWARE.
25 */
26
27 /*
28 * TIFF Library.
29 *
30 * Core Directory Tag Support.
31 */
32 #include "tiffiop.h"
33 #include <stdlib.h>
34 #include <string.h>
35
36 /*
37 * NB: NB: THIS ARRAY IS ASSUMED TO BE SORTED BY TAG.
38 * If a tag can have both LONG and SHORT types then the LONG must be
39 * placed before the SHORT for writing to work properly.
40 *
41 * NOTE: The second field (field_readcount) and third field (field_writecount)
42 * sometimes use the values TIFF_VARIABLE (-1), TIFF_VARIABLE2 (-3)
43 * and TIFFTAG_SPP (-2). The macros should be used but would throw off
44 * the formatting of the code, so please interprete the -1, -2 and -3
45 * values accordingly.
46 */
47 static const TIFFFieldInfo
48 tiffFieldInfo[] = {
49 { TIFFTAG_SUBFILETYPE, 1, 1, TIFF_LONG, FIELD_SUBFILETYPE,
50 1, 0, "SubfileType" },
51 /* XXX SHORT for compatibility w/ old versions of the library */
52 { TIFFTAG_SUBFILETYPE, 1, 1, TIFF_SHORT, FIELD_SUBFILETYPE,
53 1, 0, "SubfileType" },
54 { TIFFTAG_OSUBFILETYPE, 1, 1, TIFF_SHORT, FIELD_SUBFILETYPE,
55 1, 0, "OldSubfileType" },
56 { TIFFTAG_IMAGEWIDTH, 1, 1, TIFF_LONG, FIELD_IMAGEDIMENSIONS,
57 0, 0, "ImageWidth" },
58 { TIFFTAG_IMAGEWIDTH, 1, 1, TIFF_SHORT, FIELD_IMAGEDIMENSIONS,
59 0, 0, "ImageWidth" },
60 { TIFFTAG_IMAGELENGTH, 1, 1, TIFF_LONG, FIELD_IMAGEDIMENSIONS,
61 1, 0, "ImageLength" },
62 { TIFFTAG_IMAGELENGTH, 1, 1, TIFF_SHORT, FIELD_IMAGEDIMENSIONS,
63 1, 0, "ImageLength" },
64 { TIFFTAG_BITSPERSAMPLE, -1,-1, TIFF_SHORT, FIELD_BITSPERSAMPLE,
65 0, 0, "BitsPerSample" },
66 /* XXX LONG for compatibility with some broken TIFF writers */
67 { TIFFTAG_BITSPERSAMPLE, -1,-1, TIFF_LONG, FIELD_BITSPERSAMPLE,
68 0, 0, "BitsPerSample" },
69 { TIFFTAG_COMPRESSION, -1, 1, TIFF_SHORT, FIELD_COMPRESSION,
70 0, 0, "Compression" },
71 /* XXX LONG for compatibility with some broken TIFF writers */
72 { TIFFTAG_COMPRESSION, -1, 1, TIFF_LONG, FIELD_COMPRESSION,
73 0, 0, "Compression" },
74 { TIFFTAG_PHOTOMETRIC, 1, 1, TIFF_SHORT, FIELD_PHOTOMETRIC,
75 0, 0, "PhotometricInterpretation" },
76 /* XXX LONG for compatibility with some broken TIFF writers */
77 { TIFFTAG_PHOTOMETRIC, 1, 1, TIFF_LONG, FIELD_PHOTOMETRIC,
78 0, 0, "PhotometricInterpretation" },
79 { TIFFTAG_THRESHHOLDING, 1, 1, TIFF_SHORT, FIELD_THRESHHOLDING,
80 1, 0, "Threshholding" },
81 { TIFFTAG_CELLWIDTH, 1, 1, TIFF_SHORT, FIELD_IGNORE,
82 1, 0, "CellWidth" },
83 { TIFFTAG_CELLLENGTH, 1, 1, TIFF_SHORT, FIELD_IGNORE,
84 1, 0, "CellLength" },
85 { TIFFTAG_FILLORDER, 1, 1, TIFF_SHORT, FIELD_FILLORDER,
86 0, 0, "FillOrder" },
87 { TIFFTAG_DOCUMENTNAME, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
88 1, 0, "DocumentName" },
89 { TIFFTAG_IMAGEDESCRIPTION, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
90 1, 0, "ImageDescription" },
91 { TIFFTAG_MAKE, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
92 1, 0, "Make" },
93 { TIFFTAG_MODEL, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
94 1, 0, "Model" },
95 { TIFFTAG_STRIPOFFSETS, -1,-1, TIFF_LONG, FIELD_STRIPOFFSETS,
96 0, 0, "StripOffsets" },
97 { TIFFTAG_STRIPOFFSETS, -1,-1, TIFF_SHORT, FIELD_STRIPOFFSETS,
98 0, 0, "StripOffsets" },
99 { TIFFTAG_ORIENTATION, 1, 1, TIFF_SHORT, FIELD_ORIENTATION,
100 0, 0, "Orientation" },
101 { TIFFTAG_SAMPLESPERPIXEL, 1, 1, TIFF_SHORT, FIELD_SAMPLESPERPIXEL,
102 0, 0, "SamplesPerPixel" },
103 { TIFFTAG_ROWSPERSTRIP, 1, 1, TIFF_LONG, FIELD_ROWSPERSTRIP,
104 0, 0, "RowsPerStrip" },
105 { TIFFTAG_ROWSPERSTRIP, 1, 1, TIFF_SHORT, FIELD_ROWSPERSTRIP,
106 0, 0, "RowsPerStrip" },
107 { TIFFTAG_STRIPBYTECOUNTS, -1,-1, TIFF_LONG, FIELD_STRIPBYTECOUNTS,
108 0, 0, "StripByteCounts" },
109 { TIFFTAG_STRIPBYTECOUNTS, -1,-1, TIFF_SHORT, FIELD_STRIPBYTECOUNTS,
110 0, 0, "StripByteCounts" },
111 { TIFFTAG_MINSAMPLEVALUE, -2,-1, TIFF_SHORT, FIELD_MINSAMPLEVALUE,
112 1, 0, "MinSampleValue" },
113 { TIFFTAG_MAXSAMPLEVALUE, -2,-1, TIFF_SHORT, FIELD_MAXSAMPLEVALUE,
114 1, 0, "MaxSampleValue" },
115 { TIFFTAG_XRESOLUTION, 1, 1, TIFF_RATIONAL, FIELD_RESOLUTION,
116 1, 0, "XResolution" },
117 { TIFFTAG_YRESOLUTION, 1, 1, TIFF_RATIONAL, FIELD_RESOLUTION,
118 1, 0, "YResolution" },
119 { TIFFTAG_PLANARCONFIG, 1, 1, TIFF_SHORT, FIELD_PLANARCONFIG,
120 0, 0, "PlanarConfiguration" },
121 { TIFFTAG_PAGENAME, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
122 1, 0, "PageName" },
123 { TIFFTAG_XPOSITION, 1, 1, TIFF_RATIONAL, FIELD_POSITION,
124 1, 0, "XPosition" },
125 { TIFFTAG_YPOSITION, 1, 1, TIFF_RATIONAL, FIELD_POSITION,
126 1, 0, "YPosition" },
127 { TIFFTAG_FREEOFFSETS, -1,-1, TIFF_LONG, FIELD_IGNORE,
128 0, 0, "FreeOffsets" },
129 { TIFFTAG_FREEBYTECOUNTS, -1,-1, TIFF_LONG, FIELD_IGNORE,
130 0, 0, "FreeByteCounts" },
131 { TIFFTAG_GRAYRESPONSEUNIT, 1, 1, TIFF_SHORT, FIELD_IGNORE,
132 1, 0, "GrayResponseUnit" },
133 { TIFFTAG_GRAYRESPONSECURVE,-1,-1, TIFF_SHORT, FIELD_IGNORE,
134 1, 0, "GrayResponseCurve" },
135 { TIFFTAG_RESOLUTIONUNIT, 1, 1, TIFF_SHORT, FIELD_RESOLUTIONUNIT,
136 1, 0, "ResolutionUnit" },
137 { TIFFTAG_PAGENUMBER, 2, 2, TIFF_SHORT, FIELD_PAGENUMBER,
138 1, 0, "PageNumber" },
139 { TIFFTAG_COLORRESPONSEUNIT, 1, 1, TIFF_SHORT, FIELD_IGNORE,
140 1, 0, "ColorResponseUnit" },
141 { TIFFTAG_TRANSFERFUNCTION, -1,-1, TIFF_SHORT, FIELD_TRANSFERFUNCTION,
142 1, 0, "TransferFunction" },
143 { TIFFTAG_SOFTWARE, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
144 1, 0, "Software" },
145 { TIFFTAG_DATETIME, 20,20, TIFF_ASCII, FIELD_CUSTOM,
146 1, 0, "DateTime" },
147 { TIFFTAG_ARTIST, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
148 1, 0, "Artist" },
149 { TIFFTAG_HOSTCOMPUTER, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
150 1, 0, "HostComputer" },
151 { TIFFTAG_WHITEPOINT, 2, 2, TIFF_RATIONAL, FIELD_CUSTOM,
152 1, 0, "WhitePoint" },
153 { TIFFTAG_PRIMARYCHROMATICITIES,6,6,TIFF_RATIONAL, FIELD_CUSTOM,
154 1, 0, "PrimaryChromaticities" },
155 { TIFFTAG_COLORMAP, -1,-1, TIFF_SHORT, FIELD_COLORMAP,
156 1, 0, "ColorMap" },
157 { TIFFTAG_HALFTONEHINTS, 2, 2, TIFF_SHORT, FIELD_HALFTONEHINTS,
158 1, 0, "HalftoneHints" },
159 { TIFFTAG_TILEWIDTH, 1, 1, TIFF_LONG, FIELD_TILEDIMENSIONS,
160 0, 0, "TileWidth" },
161 { TIFFTAG_TILEWIDTH, 1, 1, TIFF_SHORT, FIELD_TILEDIMENSIONS,
162 0, 0, "TileWidth" },
163 { TIFFTAG_TILELENGTH, 1, 1, TIFF_LONG, FIELD_TILEDIMENSIONS,
164 0, 0, "TileLength" },
165 { TIFFTAG_TILELENGTH, 1, 1, TIFF_SHORT, FIELD_TILEDIMENSIONS,
166 0, 0, "TileLength" },
167 { TIFFTAG_TILEOFFSETS, -1, 1, TIFF_LONG, FIELD_STRIPOFFSETS,
168 0, 0, "TileOffsets" },
169 { TIFFTAG_TILEBYTECOUNTS, -1, 1, TIFF_LONG, FIELD_STRIPBYTECOUNTS,
170 0, 0, "TileByteCounts" },
171 { TIFFTAG_TILEBYTECOUNTS, -1, 1, TIFF_SHORT, FIELD_STRIPBYTECOUNTS,
172 0, 0, "TileByteCounts" },
173 { TIFFTAG_SUBIFD, -1,-1, TIFF_IFD, FIELD_SUBIFD,
174 1, 1, "SubIFD" },
175 { TIFFTAG_SUBIFD, -1,-1, TIFF_LONG, FIELD_SUBIFD,
176 1, 1, "SubIFD" },
177 { TIFFTAG_INKSET, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
178 0, 0, "InkSet" },
179 { TIFFTAG_INKNAMES, -1,-1, TIFF_ASCII, FIELD_INKNAMES,
180 1, 1, "InkNames" },
181 { TIFFTAG_NUMBEROFINKS, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
182 1, 0, "NumberOfInks" },
183 { TIFFTAG_DOTRANGE, 2, 2, TIFF_SHORT, FIELD_CUSTOM,
184 0, 0, "DotRange" },
185 { TIFFTAG_DOTRANGE, 2, 2, TIFF_BYTE, FIELD_CUSTOM,
186 0, 0, "DotRange" },
187 { TIFFTAG_TARGETPRINTER, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
188 1, 0, "TargetPrinter" },
189 { TIFFTAG_EXTRASAMPLES, -1,-1, TIFF_SHORT, FIELD_EXTRASAMPLES,
190 0, 1, "ExtraSamples" },
191 /* XXX for bogus Adobe Photoshop v2.5 files */
192 { TIFFTAG_EXTRASAMPLES, -1,-1, TIFF_BYTE, FIELD_EXTRASAMPLES,
193 0, 1, "ExtraSamples" },
194 { TIFFTAG_SAMPLEFORMAT, -1,-1, TIFF_SHORT, FIELD_SAMPLEFORMAT,
195 0, 0, "SampleFormat" },
196 { TIFFTAG_SMINSAMPLEVALUE, -2,-1, TIFF_ANY, FIELD_SMINSAMPLEVALUE,
197 1, 0, "SMinSampleValue" },
198 { TIFFTAG_SMAXSAMPLEVALUE, -2,-1, TIFF_ANY, FIELD_SMAXSAMPLEVALUE,
199 1, 0, "SMaxSampleValue" },
200 { TIFFTAG_CLIPPATH, -1, -3, TIFF_BYTE, FIELD_CUSTOM,
201 0, 1, "ClipPath" },
202 { TIFFTAG_XCLIPPATHUNITS, 1, 1, TIFF_SLONG, FIELD_CUSTOM,
203 0, 0, "XClipPathUnits" },
204 { TIFFTAG_XCLIPPATHUNITS, 1, 1, TIFF_SSHORT, FIELD_CUSTOM,
205 0, 0, "XClipPathUnits" },
206 { TIFFTAG_XCLIPPATHUNITS, 1, 1, TIFF_SBYTE, FIELD_CUSTOM,
207 0, 0, "XClipPathUnits" },
208 { TIFFTAG_YCLIPPATHUNITS, 1, 1, TIFF_SLONG, FIELD_CUSTOM,
209 0, 0, "YClipPathUnits" },
210 { TIFFTAG_YCLIPPATHUNITS, 1, 1, TIFF_SSHORT, FIELD_CUSTOM,
211 0, 0, "YClipPathUnits" },
212 { TIFFTAG_YCLIPPATHUNITS, 1, 1, TIFF_SBYTE, FIELD_CUSTOM,
213 0, 0, "YClipPathUnits" },
214 { TIFFTAG_YCBCRCOEFFICIENTS, 3, 3, TIFF_RATIONAL, FIELD_CUSTOM,
215 0, 0, "YCbCrCoefficients" },
216 { TIFFTAG_YCBCRSUBSAMPLING, 2, 2, TIFF_SHORT, FIELD_YCBCRSUBSAMPLING,
217 0, 0, "YCbCrSubsampling" },
218 { TIFFTAG_YCBCRPOSITIONING, 1, 1, TIFF_SHORT, FIELD_YCBCRPOSITIONING,
219 0, 0, "YCbCrPositioning" },
220 { TIFFTAG_REFERENCEBLACKWHITE, 6, 6, TIFF_RATIONAL, FIELD_REFBLACKWHITE,
221 1, 0, "ReferenceBlackWhite" },
222 /* XXX temporarily accept LONG for backwards compatibility */
223 { TIFFTAG_REFERENCEBLACKWHITE, 6, 6, TIFF_LONG, FIELD_REFBLACKWHITE,
224 1, 0, "ReferenceBlackWhite" },
225 { TIFFTAG_XMLPACKET, -3,-3, TIFF_BYTE, FIELD_CUSTOM,
226 0, 1, "XMLPacket" },
227 /* begin SGI tags */
228 { TIFFTAG_MATTEING, 1, 1, TIFF_SHORT, FIELD_EXTRASAMPLES,
229 0, 0, "Matteing" },
230 { TIFFTAG_DATATYPE, -2,-1, TIFF_SHORT, FIELD_SAMPLEFORMAT,
231 0, 0, "DataType" },
232 { TIFFTAG_IMAGEDEPTH, 1, 1, TIFF_LONG, FIELD_IMAGEDEPTH,
233 0, 0, "ImageDepth" },
234 { TIFFTAG_IMAGEDEPTH, 1, 1, TIFF_SHORT, FIELD_IMAGEDEPTH,
235 0, 0, "ImageDepth" },
236 { TIFFTAG_TILEDEPTH, 1, 1, TIFF_LONG, FIELD_TILEDEPTH,
237 0, 0, "TileDepth" },
238 { TIFFTAG_TILEDEPTH, 1, 1, TIFF_SHORT, FIELD_TILEDEPTH,
239 0, 0, "TileDepth" },
240 /* end SGI tags */
241 /* begin Pixar tags */
242 { TIFFTAG_PIXAR_IMAGEFULLWIDTH, 1, 1, TIFF_LONG, FIELD_CUSTOM,
243 1, 0, "ImageFullWidth" },
244 { TIFFTAG_PIXAR_IMAGEFULLLENGTH, 1, 1, TIFF_LONG, FIELD_CUSTOM,
245 1, 0, "ImageFullLength" },
246 { TIFFTAG_PIXAR_TEXTUREFORMAT, -1, -1, TIFF_ASCII, FIELD_CUSTOM,
247 1, 0, "TextureFormat" },
248 { TIFFTAG_PIXAR_WRAPMODES, -1, -1, TIFF_ASCII, FIELD_CUSTOM,
249 1, 0, "TextureWrapModes" },
250 { TIFFTAG_PIXAR_FOVCOT, 1, 1, TIFF_FLOAT, FIELD_CUSTOM,
251 1, 0, "FieldOfViewCotangent" },
252 { TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN, 16,16, TIFF_FLOAT,
253 FIELD_CUSTOM, 1, 0, "MatrixWorldToScreen" },
254 { TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA, 16,16, TIFF_FLOAT,
255 FIELD_CUSTOM, 1, 0, "MatrixWorldToCamera" },
256 { TIFFTAG_COPYRIGHT, -1, -1, TIFF_ASCII, FIELD_CUSTOM,
257 1, 0, "Copyright" },
258 /* end Pixar tags */
259 { TIFFTAG_RICHTIFFIPTC, -3, -3, TIFF_LONG, FIELD_CUSTOM,
260 0, 1, "RichTIFFIPTC" },
261 { TIFFTAG_PHOTOSHOP, -3, -3, TIFF_BYTE, FIELD_CUSTOM,
262 0, 1, "Photoshop" },
263 { TIFFTAG_EXIFIFD, 1, 1, TIFF_LONG, FIELD_CUSTOM,
264 0, 0, "EXIFIFDOffset" },
265 { TIFFTAG_ICCPROFILE, -3, -3, TIFF_UNDEFINED, FIELD_CUSTOM,
266 0, 1, "ICC Profile" },
267 { TIFFTAG_GPSIFD, 1, 1, TIFF_LONG, FIELD_CUSTOM,
268 0, 0, "GPSIFDOffset" },
269 { TIFFTAG_STONITS, 1, 1, TIFF_DOUBLE, FIELD_CUSTOM,
270 0, 0, "StoNits" },
271 { TIFFTAG_INTEROPERABILITYIFD, 1, 1, TIFF_LONG, FIELD_CUSTOM,
272 0, 0, "InteroperabilityIFDOffset" },
273 /* begin DNG tags */
274 { TIFFTAG_DNGVERSION, 4, 4, TIFF_BYTE, FIELD_CUSTOM,
275 0, 0, "DNGVersion" },
276 { TIFFTAG_DNGBACKWARDVERSION, 4, 4, TIFF_BYTE, FIELD_CUSTOM,
277 0, 0, "DNGBackwardVersion" },
278 { TIFFTAG_UNIQUECAMERAMODEL, -1, -1, TIFF_ASCII, FIELD_CUSTOM,
279 1, 0, "UniqueCameraModel" },
280 { TIFFTAG_LOCALIZEDCAMERAMODEL, -1, -1, TIFF_ASCII, FIELD_CUSTOM,
281 1, 0, "LocalizedCameraModel" },
282 { TIFFTAG_LOCALIZEDCAMERAMODEL, -1, -1, TIFF_BYTE, FIELD_CUSTOM,
283 1, 1, "LocalizedCameraModel" },
284 { TIFFTAG_CFAPLANECOLOR, -1, -1, TIFF_BYTE, FIELD_CUSTOM,
285 0, 1, "CFAPlaneColor" },
286 { TIFFTAG_CFALAYOUT, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
287 0, 0, "CFALayout" },
288 { TIFFTAG_LINEARIZATIONTABLE, -1, -1, TIFF_SHORT, FIELD_CUSTOM,
289 0, 1, "LinearizationTable" },
290 { TIFFTAG_BLACKLEVELREPEATDIM, 2, 2, TIFF_SHORT, FIELD_CUSTOM,
291 0, 0, "BlackLevelRepeatDim" },
292 { TIFFTAG_BLACKLEVEL, -1, -1, TIFF_LONG, FIELD_CUSTOM,
293 0, 1, "BlackLevel" },
294 { TIFFTAG_BLACKLEVEL, -1, -1, TIFF_SHORT, FIELD_CUSTOM,
295 0, 1, "BlackLevel" },
296 { TIFFTAG_BLACKLEVEL, -1, -1, TIFF_RATIONAL, FIELD_CUSTOM,
297 0, 1, "BlackLevel" },
298 { TIFFTAG_BLACKLEVELDELTAH, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM,
299 0, 1, "BlackLevelDeltaH" },
300 { TIFFTAG_BLACKLEVELDELTAV, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM,
301 0, 1, "BlackLevelDeltaV" },
302 { TIFFTAG_WHITELEVEL, -2, -2, TIFF_LONG, FIELD_CUSTOM,
303 0, 0, "WhiteLevel" },
304 { TIFFTAG_WHITELEVEL, -2, -2, TIFF_SHORT, FIELD_CUSTOM,
305 0, 0, "WhiteLevel" },
306 { TIFFTAG_DEFAULTSCALE, 2, 2, TIFF_RATIONAL, FIELD_CUSTOM,
307 0, 0, "DefaultScale" },
308 { TIFFTAG_BESTQUALITYSCALE, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
309 0, 0, "BestQualityScale" },
310 { TIFFTAG_DEFAULTCROPORIGIN, 2, 2, TIFF_LONG, FIELD_CUSTOM,
311 0, 0, "DefaultCropOrigin" },
312 { TIFFTAG_DEFAULTCROPORIGIN, 2, 2, TIFF_SHORT, FIELD_CUSTOM,
313 0, 0, "DefaultCropOrigin" },
314 { TIFFTAG_DEFAULTCROPORIGIN, 2, 2, TIFF_RATIONAL, FIELD_CUSTOM,
315 0, 0, "DefaultCropOrigin" },
316 { TIFFTAG_DEFAULTCROPSIZE, 2, 2, TIFF_LONG, FIELD_CUSTOM,
317 0, 0, "DefaultCropSize" },
318 { TIFFTAG_DEFAULTCROPSIZE, 2, 2, TIFF_SHORT, FIELD_CUSTOM,
319 0, 0, "DefaultCropSize" },
320 { TIFFTAG_DEFAULTCROPSIZE, 2, 2, TIFF_RATIONAL, FIELD_CUSTOM,
321 0, 0, "DefaultCropSize" },
322 { TIFFTAG_COLORMATRIX1, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM,
323 0, 1, "ColorMatrix1" },
324 { TIFFTAG_COLORMATRIX2, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM,
325 0, 1, "ColorMatrix2" },
326 { TIFFTAG_CAMERACALIBRATION1, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM,
327 0, 1, "CameraCalibration1" },
328 { TIFFTAG_CAMERACALIBRATION2, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM,
329 0, 1, "CameraCalibration2" },
330 { TIFFTAG_REDUCTIONMATRIX1, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM,
331 0, 1, "ReductionMatrix1" },
332 { TIFFTAG_REDUCTIONMATRIX2, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM,
333 0, 1, "ReductionMatrix2" },
334 { TIFFTAG_ANALOGBALANCE, -1, -1, TIFF_RATIONAL, FIELD_CUSTOM,
335 0, 1, "AnalogBalance" },
336 { TIFFTAG_ASSHOTNEUTRAL, -1, -1, TIFF_SHORT, FIELD_CUSTOM,
337 0, 1, "AsShotNeutral" },
338 { TIFFTAG_ASSHOTNEUTRAL, -1, -1, TIFF_RATIONAL, FIELD_CUSTOM,
339 0, 1, "AsShotNeutral" },
340 { TIFFTAG_ASSHOTWHITEXY, 2, 2, TIFF_RATIONAL, FIELD_CUSTOM,
341 0, 0, "AsShotWhiteXY" },
342 { TIFFTAG_BASELINEEXPOSURE, 1, 1, TIFF_SRATIONAL, FIELD_CUSTOM,
343 0, 0, "BaselineExposure" },
344 { TIFFTAG_BASELINENOISE, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
345 0, 0, "BaselineNoise" },
346 { TIFFTAG_BASELINESHARPNESS, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
347 0, 0, "BaselineSharpness" },
348 { TIFFTAG_BAYERGREENSPLIT, 1, 1, TIFF_LONG, FIELD_CUSTOM,
349 0, 0, "BayerGreenSplit" },
350 { TIFFTAG_LINEARRESPONSELIMIT, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
351 0, 0, "LinearResponseLimit" },
352 { TIFFTAG_CAMERASERIALNUMBER, -1, -1, TIFF_ASCII, FIELD_CUSTOM,
353 1, 0, "CameraSerialNumber" },
354 { TIFFTAG_LENSINFO, 4, 4, TIFF_RATIONAL, FIELD_CUSTOM,
355 0, 0, "LensInfo" },
356 { TIFFTAG_CHROMABLURRADIUS, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
357 0, 0, "ChromaBlurRadius" },
358 { TIFFTAG_ANTIALIASSTRENGTH, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
359 0, 0, "AntiAliasStrength" },
360 { TIFFTAG_SHADOWSCALE, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
361 0, 0, "ShadowScale" },
362 { TIFFTAG_DNGPRIVATEDATA, -1, -1, TIFF_BYTE, FIELD_CUSTOM,
363 0, 1, "DNGPrivateData" },
364 { TIFFTAG_MAKERNOTESAFETY, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
365 0, 0, "MakerNoteSafety" },
366 { TIFFTAG_CALIBRATIONILLUMINANT1, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
367 0, 0, "CalibrationIlluminant1" },
368 { TIFFTAG_CALIBRATIONILLUMINANT2, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
369 0, 0, "CalibrationIlluminant2" },
370 { TIFFTAG_RAWDATAUNIQUEID, 16, 16, TIFF_BYTE, FIELD_CUSTOM,
371 0, 0, "RawDataUniqueID" },
372 { TIFFTAG_ORIGINALRAWFILENAME, -1, -1, TIFF_ASCII, FIELD_CUSTOM,
373 1, 0, "OriginalRawFileName" },
374 { TIFFTAG_ORIGINALRAWFILENAME, -1, -1, TIFF_BYTE, FIELD_CUSTOM,
375 1, 1, "OriginalRawFileName" },
376 { TIFFTAG_ORIGINALRAWFILEDATA, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM,
377 0, 1, "OriginalRawFileData" },
378 { TIFFTAG_ACTIVEAREA, 4, 4, TIFF_LONG, FIELD_CUSTOM,
379 0, 0, "ActiveArea" },
380 { TIFFTAG_ACTIVEAREA, 4, 4, TIFF_SHORT, FIELD_CUSTOM,
381 0, 0, "ActiveArea" },
382 { TIFFTAG_MASKEDAREAS, -1, -1, TIFF_LONG, FIELD_CUSTOM,
383 0, 1, "MaskedAreas" },
384 { TIFFTAG_ASSHOTICCPROFILE, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM,
385 0, 1, "AsShotICCProfile" },
386 { TIFFTAG_ASSHOTPREPROFILEMATRIX, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM,
387 0, 1, "AsShotPreProfileMatrix" },
388 { TIFFTAG_CURRENTICCPROFILE, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM,
389 0, 1, "CurrentICCProfile" },
390 { TIFFTAG_CURRENTPREPROFILEMATRIX, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM,
391 0, 1, "CurrentPreProfileMatrix" },
392 /* end DNG tags */
393 };
394
395 static const TIFFFieldInfo
396 exifFieldInfo[] = {
397 { EXIFTAG_EXPOSURETIME, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
398 1, 0, "ExposureTime" },
399 { EXIFTAG_FNUMBER, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
400 1, 0, "FNumber" },
401 { EXIFTAG_EXPOSUREPROGRAM, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
402 1, 0, "ExposureProgram" },
403 { EXIFTAG_SPECTRALSENSITIVITY, -1, -1, TIFF_ASCII, FIELD_CUSTOM,
404 1, 0, "SpectralSensitivity" },
405 { EXIFTAG_ISOSPEEDRATINGS, -1, -1, TIFF_SHORT, FIELD_CUSTOM,
406 1, 1, "ISOSpeedRatings" },
407 { EXIFTAG_OECF, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM,
408 1, 1, "OptoelectricConversionFactor" },
409 { EXIFTAG_EXIFVERSION, 4, 4, TIFF_UNDEFINED, FIELD_CUSTOM,
410 1, 0, "ExifVersion" },
411 { EXIFTAG_DATETIMEORIGINAL, 20, 20, TIFF_ASCII, FIELD_CUSTOM,
412 1, 0, "DateTimeOriginal" },
413 { EXIFTAG_DATETIMEDIGITIZED, 20, 20, TIFF_ASCII, FIELD_CUSTOM,
414 1, 0, "DateTimeDigitized" },
415 { EXIFTAG_COMPONENTSCONFIGURATION, 4, 4, TIFF_UNDEFINED, FIELD_CUSTOM,
416 1, 0, "ComponentsConfiguration" },
417 { EXIFTAG_COMPRESSEDBITSPERPIXEL, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
418 1, 0, "CompressedBitsPerPixel" },
419 { EXIFTAG_SHUTTERSPEEDVALUE, 1, 1, TIFF_SRATIONAL, FIELD_CUSTOM,
420 1, 0, "ShutterSpeedValue" },
421 { EXIFTAG_APERTUREVALUE, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
422 1, 0, "ApertureValue" },
423 { EXIFTAG_BRIGHTNESSVALUE, 1, 1, TIFF_SRATIONAL, FIELD_CUSTOM,
424 1, 0, "BrightnessValue" },
425 { EXIFTAG_EXPOSUREBIASVALUE, 1, 1, TIFF_SRATIONAL, FIELD_CUSTOM,
426 1, 0, "ExposureBiasValue" },
427 { EXIFTAG_MAXAPERTUREVALUE, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
428 1, 0, "MaxApertureValue" },
429 { EXIFTAG_SUBJECTDISTANCE, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
430 1, 0, "SubjectDistance" },
431 { EXIFTAG_METERINGMODE, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
432 1, 0, "MeteringMode" },
433 { EXIFTAG_LIGHTSOURCE, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
434 1, 0, "LightSource" },
435 { EXIFTAG_FLASH, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
436 1, 0, "Flash" },
437 { EXIFTAG_FOCALLENGTH, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
438 1, 0, "FocalLength" },
439 { EXIFTAG_SUBJECTAREA, -1, -1, TIFF_SHORT, FIELD_CUSTOM,
440 1, 1, "SubjectArea" },
441 { EXIFTAG_MAKERNOTE, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM,
442 1, 1, "MakerNote" },
443 { EXIFTAG_USERCOMMENT, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM,
444 1, 1, "UserComment" },
445 { EXIFTAG_SUBSECTIME, -1, -1, TIFF_ASCII, FIELD_CUSTOM,
446 1, 0, "SubSecTime" },
447 { EXIFTAG_SUBSECTIMEORIGINAL, -1, -1, TIFF_ASCII, FIELD_CUSTOM,
448 1, 0, "SubSecTimeOriginal" },
449 { EXIFTAG_SUBSECTIMEDIGITIZED,-1, -1, TIFF_ASCII, FIELD_CUSTOM,
450 1, 0, "SubSecTimeDigitized" },
451 { EXIFTAG_FLASHPIXVERSION, 4, 4, TIFF_UNDEFINED, FIELD_CUSTOM,
452 1, 0, "FlashpixVersion" },
453 { EXIFTAG_COLORSPACE, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
454 1, 0, "ColorSpace" },
455 { EXIFTAG_PIXELXDIMENSION, 1, 1, TIFF_LONG, FIELD_CUSTOM,
456 1, 0, "PixelXDimension" },
457 { EXIFTAG_PIXELXDIMENSION, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
458 1, 0, "PixelXDimension" },
459 { EXIFTAG_PIXELYDIMENSION, 1, 1, TIFF_LONG, FIELD_CUSTOM,
460 1, 0, "PixelYDimension" },
461 { EXIFTAG_PIXELYDIMENSION, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
462 1, 0, "PixelYDimension" },
463 { EXIFTAG_RELATEDSOUNDFILE, 13, 13, TIFF_ASCII, FIELD_CUSTOM,
464 1, 0, "RelatedSoundFile" },
465 { EXIFTAG_FLASHENERGY, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
466 1, 0, "FlashEnergy" },
467 { EXIFTAG_SPATIALFREQUENCYRESPONSE, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM,
468 1, 1, "SpatialFrequencyResponse" },
469 { EXIFTAG_FOCALPLANEXRESOLUTION, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
470 1, 0, "FocalPlaneXResolution" },
471 { EXIFTAG_FOCALPLANEYRESOLUTION, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
472 1, 0, "FocalPlaneYResolution" },
473 { EXIFTAG_FOCALPLANERESOLUTIONUNIT, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
474 1, 0, "FocalPlaneResolutionUnit" },
475 { EXIFTAG_SUBJECTLOCATION, 2, 2, TIFF_SHORT, FIELD_CUSTOM,
476 1, 0, "SubjectLocation" },
477 { EXIFTAG_EXPOSUREINDEX, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
478 1, 0, "ExposureIndex" },
479 { EXIFTAG_SENSINGMETHOD, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
480 1, 0, "SensingMethod" },
481 { EXIFTAG_FILESOURCE, 1, 1, TIFF_UNDEFINED, FIELD_CUSTOM,
482 1, 0, "FileSource" },
483 { EXIFTAG_SCENETYPE, 1, 1, TIFF_UNDEFINED, FIELD_CUSTOM,
484 1, 0, "SceneType" },
485 { EXIFTAG_CFAPATTERN, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM,
486 1, 1, "CFAPattern" },
487 { EXIFTAG_CUSTOMRENDERED, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
488 1, 0, "CustomRendered" },
489 { EXIFTAG_EXPOSUREMODE, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
490 1, 0, "ExposureMode" },
491 { EXIFTAG_WHITEBALANCE, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
492 1, 0, "WhiteBalance" },
493 { EXIFTAG_DIGITALZOOMRATIO, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
494 1, 0, "DigitalZoomRatio" },
495 { EXIFTAG_FOCALLENGTHIN35MMFILM, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
496 1, 0, "FocalLengthIn35mmFilm" },
497 { EXIFTAG_SCENECAPTURETYPE, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
498 1, 0, "SceneCaptureType" },
499 { EXIFTAG_GAINCONTROL, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM,
500 1, 0, "GainControl" },
501 { EXIFTAG_CONTRAST, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
502 1, 0, "Contrast" },
503 { EXIFTAG_SATURATION, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
504 1, 0, "Saturation" },
505 { EXIFTAG_SHARPNESS, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
506 1, 0, "Sharpness" },
507 { EXIFTAG_DEVICESETTINGDESCRIPTION, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM,
508 1, 1, "DeviceSettingDescription" },
509 { EXIFTAG_SUBJECTDISTANCERANGE, 1, 1, TIFF_SHORT, FIELD_CUSTOM,
510 1, 0, "SubjectDistanceRange" },
511 { EXIFTAG_IMAGEUNIQUEID, 33, 33, TIFF_ASCII, FIELD_CUSTOM,
512 1, 0, "ImageUniqueID" }
513 };
514
515 const TIFFFieldInfo *
516 _TIFFGetFieldInfo(size_t *size)
517 {
518 *size = TIFFArrayCount(tiffFieldInfo);
519 return tiffFieldInfo;
520 }
521
522 const TIFFFieldInfo *
523 _TIFFGetExifFieldInfo(size_t *size)
524 {
525 *size = TIFFArrayCount(exifFieldInfo);
526 return exifFieldInfo;
527 }
528
529 void
530 _TIFFSetupFieldInfo(TIFF* tif, const TIFFFieldInfo info[], size_t n)
531 {
532 if (tif->tif_fieldinfo) {
533 size_t i;
534
535 for (i = 0; i < tif->tif_nfields; i++)
536 {
537 TIFFFieldInfo *fld = tif->tif_fieldinfo[i];
538 if (fld->field_bit == FIELD_CUSTOM &&
539 strncmp("Tag ", fld->field_name, 4) == 0) {
540 _TIFFfree(fld->field_name);
541 _TIFFfree(fld);
542 }
543 }
544
545 _TIFFfree(tif->tif_fieldinfo);
546 tif->tif_nfields = 0;
547 }
548 if (!_TIFFMergeFieldInfo(tif, info, n))
549 {
550 TIFFErrorExt(tif->tif_clientdata, "_TIFFSetupFieldInfo",
551 "Setting up field info failed");
552 }
553 }
554
555 static int
556 tagCompare(const void* a, const void* b)
557 {
558 const TIFFFieldInfo* ta = *(const TIFFFieldInfo**) a;
559 const TIFFFieldInfo* tb = *(const TIFFFieldInfo**) b;
560 /* NB: be careful of return values for 16-bit platforms */
561 if (ta->field_tag != tb->field_tag)
562 return (int)ta->field_tag - (int)tb->field_tag;
563 else
564 return (ta->field_type == TIFF_ANY) ?
565 0 : ((int)tb->field_type - (int)ta->field_type);
566 }
567
568 static int
569 tagNameCompare(const void* a, const void* b)
570 {
571 const TIFFFieldInfo* ta = *(const TIFFFieldInfo**) a;
572 const TIFFFieldInfo* tb = *(const TIFFFieldInfo**) b;
573 int ret = strcmp(ta->field_name, tb->field_name);
574
575 if (ret)
576 return ret;
577 else
578 return (ta->field_type == TIFF_ANY) ?
579 0 : ((int)tb->field_type - (int)ta->field_type);
580 }
581
582 void
583 TIFFMergeFieldInfo(TIFF* tif, const TIFFFieldInfo info[], int n)
584 {
585 if (_TIFFMergeFieldInfo(tif, info, n) < 0)
586 {
587 TIFFErrorExt(tif->tif_clientdata, "TIFFMergeFieldInfo",
588 "Merging block of %d fields failed", n);
589 }
590 }
591
592 int
593 _TIFFMergeFieldInfo(TIFF* tif, const TIFFFieldInfo info[], int n)
594 {
595 static const char module[] = "_TIFFMergeFieldInfo";
596 static const char reason[] = "for field info array";
597 TIFFFieldInfo** tp;
598 int i;
599
600 tif->tif_foundfield = NULL;
601
602 if (tif->tif_nfields > 0) {
603 tif->tif_fieldinfo = (TIFFFieldInfo**)
604 _TIFFCheckRealloc(tif, tif->tif_fieldinfo,
605 (tif->tif_nfields + n),
606 sizeof (TIFFFieldInfo*), reason);
607 } else {
608 tif->tif_fieldinfo = (TIFFFieldInfo**)
609 _TIFFCheckMalloc(tif, n, sizeof (TIFFFieldInfo*),
610 reason);
611 }
612 if (!tif->tif_fieldinfo) {
613 TIFFErrorExt(tif->tif_clientdata, module,
614 "Failed to allocate field info array");
615 return 0;
616 }
617 tp = tif->tif_fieldinfo + tif->tif_nfields;
618 for (i = 0; i < n; i++)
619 {
620 const TIFFFieldInfo *fip =
621 _TIFFFindFieldInfo(tif, info[i].field_tag, info[i].field_type);
622
623 /* only add definitions that aren't already present */
624 if (!fip) {
625 *tp++ = (TIFFFieldInfo*) (info + i);
626 tif->tif_nfields++;
627 }
628 }
629
630 /* Sort the field info by tag number */
631 qsort(tif->tif_fieldinfo, tif->tif_nfields,
632 sizeof (TIFFFieldInfo*), tagCompare);
633
634 return n;
635 }
636
637 void
638 _TIFFPrintFieldInfo(TIFF* tif, FILE* fd)
639 {
640 size_t i;
641
642 fprintf(fd, "%s: \n", tif->tif_name);
643 for (i = 0; i < tif->tif_nfields; i++) {
644 const TIFFFieldInfo* fip = tif->tif_fieldinfo[i];
645 fprintf(fd, "field[%2d] %5lu, %2d, %2d, %d, %2d, %5s, %5s, %s\n"
646 , (int)i
647 , (unsigned long) fip->field_tag
648 , fip->field_readcount, fip->field_writecount
649 , fip->field_type
650 , fip->field_bit
651 , fip->field_oktochange ? "TRUE" : "FALSE"
652 , fip->field_passcount ? "TRUE" : "FALSE"
653 , fip->field_name
654 );
655 }
656 }
657
658 /*
659 * Return size of TIFFDataType in bytes
660 */
661 int
662 TIFFDataWidth(TIFFDataType type)
663 {
664 switch(type)
665 {
666 case 0: /* nothing */
667 case 1: /* TIFF_BYTE */
668 case 2: /* TIFF_ASCII */
669 case 6: /* TIFF_SBYTE */
670 case 7: /* TIFF_UNDEFINED */
671 return 1;
672 case 3: /* TIFF_SHORT */
673 case 8: /* TIFF_SSHORT */
674 return 2;
675 case 4: /* TIFF_LONG */
676 case 9: /* TIFF_SLONG */
677 case 11: /* TIFF_FLOAT */
678 case 13: /* TIFF_IFD */
679 return 4;
680 case 5: /* TIFF_RATIONAL */
681 case 10: /* TIFF_SRATIONAL */
682 case 12: /* TIFF_DOUBLE */
683 return 8;
684 default:
685 return 0; /* will return 0 for unknown types */
686 }
687 }
688
689 /*
690 * Return size of TIFFDataType in bytes.
691 *
692 * XXX: We need a separate function to determine the space needed
693 * to store the value. For TIFF_RATIONAL values TIFFDataWidth() returns 8,
694 * but we use 4-byte float to represent rationals.
695 */
696 int
697 _TIFFDataSize(TIFFDataType type)
698 {
699 switch (type) {
700 case TIFF_BYTE:
701 case TIFF_SBYTE:
702 case TIFF_ASCII:
703 case TIFF_UNDEFINED:
704 return 1;
705 case TIFF_SHORT:
706 case TIFF_SSHORT:
707 return 2;
708 case TIFF_LONG:
709 case TIFF_SLONG:
710 case TIFF_FLOAT:
711 case TIFF_IFD:
712 case TIFF_RATIONAL:
713 case TIFF_SRATIONAL:
714 return 4;
715 case TIFF_DOUBLE:
716 return 8;
717 default:
718 return 0;
719 }
720 }
721
722 /*
723 * Return nearest TIFFDataType to the sample type of an image.
724 */
725 TIFFDataType
726 _TIFFSampleToTagType(TIFF* tif)
727 {
728 uint32 bps = TIFFhowmany8(tif->tif_dir.td_bitspersample);
729
730 switch (tif->tif_dir.td_sampleformat) {
731 case SAMPLEFORMAT_IEEEFP:
732 return (bps == 4 ? TIFF_FLOAT : TIFF_DOUBLE);
733 case SAMPLEFORMAT_INT:
734 return (bps <= 1 ? TIFF_SBYTE :
735 bps <= 2 ? TIFF_SSHORT : TIFF_SLONG);
736 case SAMPLEFORMAT_UINT:
737 return (bps <= 1 ? TIFF_BYTE :
738 bps <= 2 ? TIFF_SHORT : TIFF_LONG);
739 case SAMPLEFORMAT_VOID:
740 return (TIFF_UNDEFINED);
741 }
742 /*NOTREACHED*/
743 return (TIFF_UNDEFINED);
744 }
745
746 const TIFFFieldInfo*
747 _TIFFFindFieldInfo(TIFF* tif, ttag_t tag, TIFFDataType dt)
748 {
749 TIFFFieldInfo key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0};
750 TIFFFieldInfo* pkey = &key;
751 const TIFFFieldInfo **ret;
752
753 if (tif->tif_foundfield && tif->tif_foundfield->field_tag == tag &&
754 (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type))
755 return tif->tif_foundfield;
756
757 /* If we are invoked with no field information, then just return. */
758 if ( !tif->tif_fieldinfo ) {
759 return NULL;
760 }
761
762 /* NB: use sorted search (e.g. binary search) */
763 key.field_tag = tag;
764 key.field_type = dt;
765
766 ret = (const TIFFFieldInfo **) bsearch(&pkey,
767 tif->tif_fieldinfo,
768 tif->tif_nfields,
769 sizeof(TIFFFieldInfo *),
770 tagCompare);
771 return tif->tif_foundfield = (ret ? *ret : NULL);
772 }
773
774 const TIFFFieldInfo*
775 _TIFFFindFieldInfoByName(TIFF* tif, const char *field_name, TIFFDataType dt)
776 {
777 TIFFFieldInfo key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0};
778 TIFFFieldInfo* pkey = &key;
779 const TIFFFieldInfo **ret;
780
781 if (tif->tif_foundfield
782 && streq(tif->tif_foundfield->field_name, field_name)
783 && (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type))
784 return (tif->tif_foundfield);
785
786 /* If we are invoked with no field information, then just return. */
787 if ( !tif->tif_fieldinfo ) {
788 return NULL;
789 }
790
791 /* NB: use sorted search (e.g. binary search) */
792 key.field_name = (char *)field_name;
793 key.field_type = dt;
794
795 ret = (const TIFFFieldInfo **) lfind(&pkey,
796 tif->tif_fieldinfo,
797 &tif->tif_nfields,
798 sizeof(TIFFFieldInfo *),
799 tagNameCompare);
800 return tif->tif_foundfield = (ret ? *ret : NULL);
801 }
802
803 const TIFFFieldInfo*
804 _TIFFFieldWithTag(TIFF* tif, ttag_t tag)
805 {
806 const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);
807 if (!fip) {
808 TIFFErrorExt(tif->tif_clientdata, "TIFFFieldWithTag",
809 "Internal error, unknown tag 0x%x",
810 (unsigned int) tag);
811 assert(fip != NULL);
812 /*NOTREACHED*/
813 }
814 return (fip);
815 }
816
817 const TIFFFieldInfo*
818 _TIFFFieldWithName(TIFF* tif, const char *field_name)
819 {
820 const TIFFFieldInfo* fip =
821 _TIFFFindFieldInfoByName(tif, field_name, TIFF_ANY);
822 if (!fip) {
823 TIFFErrorExt(tif->tif_clientdata, "TIFFFieldWithName",
824 "Internal error, unknown tag %s", field_name);
825 assert(fip != NULL);
826 /*NOTREACHED*/
827 }
828 return (fip);
829 }
830
831 const TIFFFieldInfo*
832 _TIFFFindOrRegisterFieldInfo( TIFF *tif, ttag_t tag, TIFFDataType dt )
833
834 {
835 const TIFFFieldInfo *fld;
836
837 fld = _TIFFFindFieldInfo( tif, tag, dt );
838 if( fld == NULL )
839 {
840 fld = _TIFFCreateAnonFieldInfo( tif, tag, dt );
841 if (!_TIFFMergeFieldInfo(tif, fld, 1))
842 return NULL;
843 }
844
845 return fld;
846 }
847
848 TIFFFieldInfo*
849 _TIFFCreateAnonFieldInfo(TIFF *tif, ttag_t tag, TIFFDataType field_type)
850 {
851 TIFFFieldInfo *fld;
852 (void) tif;
853
854 fld = (TIFFFieldInfo *) _TIFFmalloc(sizeof (TIFFFieldInfo));
855 if (fld == NULL)
856 return NULL;
857 _TIFFmemset( fld, 0, sizeof(TIFFFieldInfo) );
858
859 fld->field_tag = tag;
860 fld->field_readcount = TIFF_VARIABLE2;
861 fld->field_writecount = TIFF_VARIABLE2;
862 fld->field_type = field_type;
863 fld->field_bit = FIELD_CUSTOM;
864 fld->field_oktochange = TRUE;
865 fld->field_passcount = TRUE;
866 fld->field_name = (char *) _TIFFmalloc(32);
867 if (fld->field_name == NULL) {
868 _TIFFfree(fld);
869 return NULL;
870 }
871
872 /*
873 * note that this name is a special sign to TIFFClose() and
874 * _TIFFSetupFieldInfo() to free the field
875 */
876 sprintf(fld->field_name, "Tag %d", (int) tag);
877
878 return fld;
879 }
880
881 /* vim: set ts=8 sts=8 sw=8 noet: */
882 /*
883 * Local Variables:
884 * mode: c
885 * c-basic-offset: 8
886 * fill-column: 78
887 * End:
888 */
TRUE
#define TRUE
Definition: twiddle.c:33
TIFFTAG_REDUCTIONMATRIX2
#define TIFFTAG_REDUCTIONMATRIX2
Definition: tiff.h:462
TIFFTAG_FREEBYTECOUNTS
#define TIFFTAG_FREEBYTECOUNTS
Definition: tiff.h:249
TIFFTAG_SUBFILETYPE
#define TIFFTAG_SUBFILETYPE
Definition: tiff.h:157
ttag_t
uint32 ttag_t
Definition: tiffio.h:61
FIELD_IGNORE
#define FIELD_IGNORE
Definition: tif_dir.h:102
TIFFTAG_ORIGINALRAWFILENAME
#define TIFFTAG_ORIGINALRAWFILENAME
Definition: tiff.h:498
TIFF_UNDEFINED
Definition: tiff.h:145
TIFFTAG_CELLWIDTH
#define TIFFTAG_CELLWIDTH
Definition: tiff.h:216
FIELD_CUSTOM
#define FIELD_CUSTOM
Definition: tiffio.h:301
TIFFTAG_INTEROPERABILITYIFD
#define TIFFTAG_INTEROPERABILITYIFD
Definition: tiff.h:429
TIFFTAG_LINEARIZATIONTABLE
#define TIFFTAG_LINEARIZATIONTABLE
Definition: tiff.h:439
EXIFTAG_DEVICESETTINGDESCRIPTION
#define EXIFTAG_DEVICESETTINGDESCRIPTION
Definition: tiff.h:639
EXIFTAG_FLASHENERGY
#define EXIFTAG_FLASHENERGY
Definition: tiff.h:618
TIFFTAG_COPYRIGHT
#define TIFFTAG_COPYRIGHT
Definition: tiff.h:387
FIELD_MINSAMPLEVALUE
#define FIELD_MINSAMPLEVALUE
Definition: tif_dir.h:120
FIELD_RESOLUTION
#define FIELD_RESOLUTION
Definition: tif_dir.h:107
TIFFTAG_BITSPERSAMPLE
#define TIFFTAG_BITSPERSAMPLE
Definition: tiff.h:167
TIFFTAG_ROWSPERSTRIP
#define TIFFTAG_ROWSPERSTRIP
Definition: tiff.h:236
TIFFTAG_DNGVERSION
#define TIFFTAG_DNGVERSION
Definition: tiff.h:431
TIFF_ANY
#define TIFF_ANY
Definition: tiffio.h:296
TIFFDirectory::td_bitspersample
uint16 td_bitspersample
Definition: tif_dir.h:44
TIFFTAG_ICCPROFILE
#define TIFFTAG_ICCPROFILE
Definition: tiff.h:416
TIFFMergeFieldInfo
void TIFFMergeFieldInfo(TIFF *tif, const TIFFFieldInfo info[], int n)
Definition: tif_dirinfo.c:583
FIELD_STRIPOFFSETS
#define FIELD_STRIPOFFSETS
Definition: tif_dir.h:126
TIFFTAG_STRIPBYTECOUNTS
#define TIFFTAG_STRIPBYTECOUNTS
Definition: tiff.h:237
TIFFTAG_COLORMAP
#define TIFFTAG_COLORMAP
Definition: tiff.h:287
TIFF_LONG
Definition: tiff.h:142
_TIFFGetFieldInfo
const TIFFFieldInfo * _TIFFGetFieldInfo(size_t *size)
Definition: tif_dirinfo.c:516
TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN
#define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN
Definition: tiff.h:382
EXIFTAG_SUBJECTAREA
#define EXIFTAG_SUBJECTAREA
Definition: tiff.h:607
TIFFTAG_EXTRASAMPLES
#define TIFFTAG_EXTRASAMPLES
Definition: tiff.h:307
TIFFTAG_ORIENTATION
#define TIFFTAG_ORIENTATION
Definition: tiff.h:226
FIELD_IMAGEDIMENSIONS
#define FIELD_IMAGEDIMENSIONS
Definition: tif_dir.h:105
TIFF_BYTE
Definition: tiff.h:139
TIFFTAG_ORIGINALRAWFILEDATA
#define TIFFTAG_ORIGINALRAWFILEDATA
Definition: tiff.h:500
TIFFTAG_IMAGEWIDTH
#define TIFFTAG_IMAGEWIDTH
Definition: tiff.h:165
EXIFTAG_COLORSPACE
#define EXIFTAG_COLORSPACE
Definition: tiff.h:614
TIFFTAG_YRESOLUTION
#define TIFFTAG_YRESOLUTION
Definition: tiff.h:241
FIELD_THRESHHOLDING
#define FIELD_THRESHHOLDING
Definition: tif_dir.h:115
EXIFTAG_EXPOSUREINDEX
#define EXIFTAG_EXPOSUREINDEX
Definition: tiff.h:624
TIFFTAG_CALIBRATIONILLUMINANT2
#define TIFFTAG_CALIBRATIONILLUMINANT2
Definition: tiff.h:494
TIFFTAG_DATATYPE
#define TIFFTAG_DATATYPE
Definition: tiff.h:363
TIFFTAG_MINSAMPLEVALUE
#define TIFFTAG_MINSAMPLEVALUE
Definition: tiff.h:238
TIFFTAG_BLACKLEVELREPEATDIM
#define TIFFTAG_BLACKLEVELREPEATDIM
Definition: tiff.h:440
EXIFTAG_IMAGEUNIQUEID
#define EXIFTAG_IMAGEUNIQUEID
Definition: tiff.h:643
TIFFTAG_INKNAMES
#define TIFFTAG_INKNAMES
Definition: tiff.h:303
TIFF_ASCII
Definition: tiff.h:140
TIFFTAG_FILLORDER
#define TIFFTAG_FILLORDER
Definition: tiff.h:218
_TIFFGetExifFieldInfo
const TIFFFieldInfo * _TIFFGetExifFieldInfo(size_t *size)
Definition: tif_dirinfo.c:523
TIFFTAG_BASELINEEXPOSURE
#define TIFFTAG_BASELINEEXPOSURE
Definition: tiff.h:471
TIFFTAG_COLORMATRIX2
#define TIFFTAG_COLORMATRIX2
Definition: tiff.h:456
EXIFTAG_FOCALPLANEXRESOLUTION
#define EXIFTAG_FOCALPLANEXRESOLUTION
Definition: tiff.h:620
EXIFTAG_FOCALPLANERESOLUTIONUNIT
#define EXIFTAG_FOCALPLANERESOLUTIONUNIT
Definition: tiff.h:622
FIELD_HALFTONEHINTS
#define FIELD_HALFTONEHINTS
Definition: tif_dir.h:134
EXIFTAG_MAKERNOTE
#define EXIFTAG_MAKERNOTE
Definition: tiff.h:608
TIFFTAG_DOTRANGE
#define TIFFTAG_DOTRANGE
Definition: tiff.h:305
TIFFTAG_STRIPOFFSETS
#define TIFFTAG_STRIPOFFSETS
Definition: tiff.h:225
TIFFTAG_SUBIFD
#define TIFFTAG_SUBIFD
Definition: tiff.h:299
TIFFTAG_PIXAR_FOVCOT
#define TIFFTAG_PIXAR_FOVCOT
Definition: tiff.h:381
TIFFTAG_THRESHHOLDING
#define TIFFTAG_THRESHHOLDING
Definition: tiff.h:212
EXIFTAG_PIXELYDIMENSION
#define EXIFTAG_PIXELYDIMENSION
Definition: tiff.h:616
TIFFTAG_GPSIFD
#define TIFFTAG_GPSIFD
Definition: tiff.h:419
_TIFFFindOrRegisterFieldInfo
const TIFFFieldInfo * _TIFFFindOrRegisterFieldInfo(TIFF *tif, ttag_t tag, TIFFDataType dt)
Definition: tif_dirinfo.c:832
TIFFTAG_PIXAR_IMAGEFULLWIDTH
#define TIFFTAG_PIXAR_IMAGEFULLWIDTH
Definition: tiff.h:374
TIFFTAG_YCBCRSUBSAMPLING
#define TIFFTAG_YCBCRSUBSAMPLING
Definition: tiff.h:346
TIFFTAG_SOFTWARE
#define TIFFTAG_SOFTWARE
Definition: tiff.h:277
tiff::tif_clientdata
thandle_t tif_clientdata
Definition: tiffiop.h:185
FIELD_RESOLUTIONUNIT
#define FIELD_RESOLUTIONUNIT
Definition: tif_dir.h:123
TIFFTAG_YPOSITION
#define TIFFTAG_YPOSITION
Definition: tiff.h:247
TIFFTAG_SMINSAMPLEVALUE
#define TIFFTAG_SMINSAMPLEVALUE
Definition: tiff.h:318
TIFFTAG_REFERENCEBLACKWHITE
#define TIFFTAG_REFERENCEBLACKWHITE
Definition: tiff.h:350
tiffiop.h
TIFF_SRATIONAL
Definition: tiff.h:148
_TIFFMergeFieldInfo
int _TIFFMergeFieldInfo(TIFF *tif, const TIFFFieldInfo info[], int n)
Definition: tif_dirinfo.c:593
TIFFTAG_PLANARCONFIG
#define TIFFTAG_PLANARCONFIG
Definition: tiff.h:242
TIFFTAG_EXIFIFD
#define TIFFTAG_EXIFIFD
Definition: tiff.h:414
EXIFTAG_ISOSPEEDRATINGS
#define EXIFTAG_ISOSPEEDRATINGS
Definition: tiff.h:587
TIFFTAG_MATTEING
#define TIFFTAG_MATTEING
Definition: tiff.h:362
TIFFTAG_DATETIME
#define TIFFTAG_DATETIME
Definition: tiff.h:278
tiff::tif_name
char * tif_name
Definition: tiffiop.h:103
TIFFTAG_ANTIALIASSTRENGTH
#define TIFFTAG_ANTIALIASSTRENGTH
Definition: tiff.h:485
TIFFTAG_PRIMARYCHROMATICITIES
#define TIFFTAG_PRIMARYCHROMATICITIES
Definition: tiff.h:286
tiff
Definition: tiffiop.h:102
FIELD_YCBCRSUBSAMPLING
#define FIELD_YCBCRSUBSAMPLING
Definition: tif_dir.h:135
TIFFTAG_CURRENTPREPROFILEMATRIX
#define TIFFTAG_CURRENTPREPROFILEMATRIX
Definition: tiff.h:510
TIFFTAG_CAMERACALIBRATION2
#define TIFFTAG_CAMERACALIBRATION2
Definition: tiff.h:459
SAMPLEFORMAT_INT
#define SAMPLEFORMAT_INT
Definition: tiff.h:313
FIELD_SMAXSAMPLEVALUE
#define FIELD_SMAXSAMPLEVALUE
Definition: tif_dir.h:131
EXIFTAG_DATETIMEORIGINAL
#define EXIFTAG_DATETIMEORIGINAL
Definition: tiff.h:591
EXIFTAG_EXPOSURETIME
#define EXIFTAG_EXPOSURETIME
Definition: tiff.h:583
TIFFTAG_TILEBYTECOUNTS
#define TIFFTAG_TILEBYTECOUNTS
Definition: tiff.h:292
TIFFTAG_YCBCRCOEFFICIENTS
#define TIFFTAG_YCBCRCOEFFICIENTS
Definition: tiff.h:345
EXIFTAG_LIGHTSOURCE
#define EXIFTAG_LIGHTSOURCE
Definition: tiff.h:604
FIELD_SUBIFD
#define FIELD_SUBIFD
Definition: tif_dir.h:140
FIELD_TRANSFERFUNCTION
#define FIELD_TRANSFERFUNCTION
Definition: tif_dir.h:138
TIFFTAG_CURRENTICCPROFILE
#define TIFFTAG_CURRENTICCPROFILE
Definition: tiff.h:509
FIELD_FILLORDER
#define FIELD_FILLORDER
Definition: tif_dir.h:116
TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA
#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA
Definition: tiff.h:383
b
long b
Definition: jpegint.h:371
FIELD_MAXSAMPLEVALUE
#define FIELD_MAXSAMPLEVALUE
Definition: tif_dir.h:121
EXIFTAG_WHITEBALANCE
#define EXIFTAG_WHITEBALANCE
Definition: tiff.h:631
FIELD_BITSPERSAMPLE
#define FIELD_BITSPERSAMPLE
Definition: tif_dir.h:112
TIFFTAG_YCBCRPOSITIONING
#define TIFFTAG_YCBCRPOSITIONING
Definition: tiff.h:347
TIFFTAG_PIXAR_WRAPMODES
#define TIFFTAG_PIXAR_WRAPMODES
Definition: tiff.h:380
TIFFTAG_MAKERNOTESAFETY
#define TIFFTAG_MAKERNOTESAFETY
Definition: tiff.h:489
TIFFTAG_TILEWIDTH
#define TIFFTAG_TILEWIDTH
Definition: tiff.h:289
TIFFTAG_IMAGEDESCRIPTION
#define TIFFTAG_IMAGEDESCRIPTION
Definition: tiff.h:222
EXIFTAG_SATURATION
#define EXIFTAG_SATURATION
Definition: tiff.h:637
FIELD_STRIPBYTECOUNTS
#define FIELD_STRIPBYTECOUNTS
Definition: tif_dir.h:125
TIFFTAG_MASKEDAREAS
#define TIFFTAG_MASKEDAREAS
Definition: tiff.h:504
TIFF_NOTYPE
Definition: tiff.h:138
EXIFTAG_FLASH
#define EXIFTAG_FLASH
Definition: tiff.h:605
_TIFFSetupFieldInfo
void _TIFFSetupFieldInfo(TIFF *tif, const TIFFFieldInfo info[], size_t n)
Definition: tif_dirinfo.c:530
streq
#define streq(a, b)
Definition: mkg3states.c:44
EXIFTAG_RELATEDSOUNDFILE
#define EXIFTAG_RELATEDSOUNDFILE
Definition: tiff.h:617
EXIFTAG_EXPOSUREBIASVALUE
#define EXIFTAG_EXPOSUREBIASVALUE
Definition: tiff.h:600
TIFFTAG_LENSINFO
#define TIFFTAG_LENSINFO
Definition: tiff.h:483
TIFFTAG_TILELENGTH
#define TIFFTAG_TILELENGTH
Definition: tiff.h:290
TIFFTAG_CAMERACALIBRATION1
#define TIFFTAG_CAMERACALIBRATION1
Definition: tiff.h:458
TIFFFieldInfo::field_passcount
unsigned char field_passcount
Definition: tiffio.h:310
EXIFTAG_USERCOMMENT
#define EXIFTAG_USERCOMMENT
Definition: tiff.h:609
TIFFTAG_CAMERASERIALNUMBER
#define TIFFTAG_CAMERASERIALNUMBER
Definition: tiff.h:482
EXIFTAG_SHUTTERSPEEDVALUE
#define EXIFTAG_SHUTTERSPEEDVALUE
Definition: tiff.h:597
TIFFTAG_ANALOGBALANCE
#define TIFFTAG_ANALOGBALANCE
Definition: tiff.h:464
TIFFTAG_IMAGELENGTH
#define TIFFTAG_IMAGELENGTH
Definition: tiff.h:166
FIELD_PLANARCONFIG
#define FIELD_PLANARCONFIG
Definition: tif_dir.h:122
TIFF_SSHORT
Definition: tiff.h:146
tiff::tif_nfields
size_t tif_nfields
Definition: tiffiop.h:195
TIFFTAG_TILEOFFSETS
#define TIFFTAG_TILEOFFSETS
Definition: tiff.h:291
EXIFTAG_SUBJECTLOCATION
#define EXIFTAG_SUBJECTLOCATION
Definition: tiff.h:623
EXIFTAG_FILESOURCE
#define EXIFTAG_FILESOURCE
Definition: tiff.h:626
TIFFTAG_SAMPLESPERPIXEL
#define TIFFTAG_SAMPLESPERPIXEL
Definition: tiff.h:235
TIFFTAG_BAYERGREENSPLIT
#define TIFFTAG_BAYERGREENSPLIT
Definition: tiff.h:476
EXIFTAG_FOCALLENGTH
#define EXIFTAG_FOCALLENGTH
Definition: tiff.h:606
SAMPLEFORMAT_VOID
#define SAMPLEFORMAT_VOID
Definition: tiff.h:315
TIFFTAG_DNGBACKWARDVERSION
#define TIFFTAG_DNGBACKWARDVERSION
Definition: tiff.h:432
EXIFTAG_EXIFVERSION
#define EXIFTAG_EXIFVERSION
Definition: tiff.h:590
TIFFTAG_BASELINENOISE
#define TIFFTAG_BASELINENOISE
Definition: tiff.h:473
TIFFTAG_FREEOFFSETS
#define TIFFTAG_FREEOFFSETS
Definition: tiff.h:248
EXIFTAG_EXPOSUREPROGRAM
#define EXIFTAG_EXPOSUREPROGRAM
Definition: tiff.h:585
TIFFTAG_ASSHOTWHITEXY
#define TIFFTAG_ASSHOTWHITEXY
Definition: tiff.h:468
TIFFTAG_DOCUMENTNAME
#define TIFFTAG_DOCUMENTNAME
Definition: tiff.h:221
EXIFTAG_FOCALPLANEYRESOLUTION
#define EXIFTAG_FOCALPLANEYRESOLUTION
Definition: tiff.h:621
TIFFTAG_BESTQUALITYSCALE
#define TIFFTAG_BESTQUALITYSCALE
Definition: tiff.h:495
EXIFTAG_SUBSECTIMEORIGINAL
#define EXIFTAG_SUBSECTIMEORIGINAL
Definition: tiff.h:611
TIFFTAG_XMLPACKET
#define TIFFTAG_XMLPACKET
Definition: tiff.h:351
TIFFTAG_BLACKLEVELDELTAH
#define TIFFTAG_BLACKLEVELDELTAH
Definition: tiff.h:443
SAMPLEFORMAT_UINT
#define SAMPLEFORMAT_UINT
Definition: tiff.h:312
TIFFTAG_ASSHOTICCPROFILE
#define TIFFTAG_ASSHOTICCPROFILE
Definition: tiff.h:506
TIFFTAG_GRAYRESPONSECURVE
#define TIFFTAG_GRAYRESPONSECURVE
Definition: tiff.h:256
EXIFTAG_EXPOSUREMODE
#define EXIFTAG_EXPOSUREMODE
Definition: tiff.h:630
TIFFFieldInfo
Definition: tiffio.h:303
EXIFTAG_SHARPNESS
#define EXIFTAG_SHARPNESS
Definition: tiff.h:638
EXIFTAG_COMPRESSEDBITSPERPIXEL
#define EXIFTAG_COMPRESSEDBITSPERPIXEL
Definition: tiff.h:596
EXIFTAG_DIGITALZOOMRATIO
#define EXIFTAG_DIGITALZOOMRATIO
Definition: tiff.h:632
TIFFhowmany8
#define TIFFhowmany8(x)
Definition: tiffiop.h:242
TIFFTAG_CHROMABLURRADIUS
#define TIFFTAG_CHROMABLURRADIUS
Definition: tiff.h:484
SAMPLEFORMAT_IEEEFP
#define SAMPLEFORMAT_IEEEFP
Definition: tiff.h:314
TIFFTAG_PIXAR_IMAGEFULLLENGTH
#define TIFFTAG_PIXAR_IMAGEFULLLENGTH
Definition: tiff.h:375
TIFFTAG_XPOSITION
#define TIFFTAG_XPOSITION
Definition: tiff.h:246
TIFFTAG_RAWDATAUNIQUEID
#define TIFFTAG_RAWDATAUNIQUEID
Definition: tiff.h:496
TIFFTAG_HALFTONEHINTS
#define TIFFTAG_HALFTONEHINTS
Definition: tiff.h:288
TIFFTAG_PAGENAME
#define TIFFTAG_PAGENAME
Definition: tiff.h:245
TIFFTAG_DNGPRIVATEDATA
#define TIFFTAG_DNGPRIVATEDATA
Definition: tiff.h:488
FIELD_PHOTOMETRIC
#define FIELD_PHOTOMETRIC
Definition: tif_dir.h:114
TIFFTAG_DEFAULTSCALE
#define TIFFTAG_DEFAULTSCALE
Definition: tiff.h:449
TIFFTAG_LINEARRESPONSELIMIT
#define TIFFTAG_LINEARRESPONSELIMIT
Definition: tiff.h:481
EXIFTAG_SUBSECTIME
#define EXIFTAG_SUBSECTIME
Definition: tiff.h:610
EXIFTAG_SUBSECTIMEDIGITIZED
#define EXIFTAG_SUBSECTIMEDIGITIZED
Definition: tiff.h:612
TIFFErrorExt
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:63
TIFFTAG_PHOTOMETRIC
#define TIFFTAG_PHOTOMETRIC
Definition: tiff.h:199
TIFFFieldInfo::field_readcount
short field_readcount
Definition: tiffio.h:305
TIFFTAG_ARTIST
#define TIFFTAG_ARTIST
Definition: tiff.h:279
EXIFTAG_DATETIMEDIGITIZED
#define EXIFTAG_DATETIMEDIGITIZED
Definition: tiff.h:593
EXIFTAG_FLASHPIXVERSION
#define EXIFTAG_FLASHPIXVERSION
Definition: tiff.h:613
TIFFTAG_PAGENUMBER
#define TIFFTAG_PAGENUMBER
Definition: tiff.h:269
FIELD_COMPRESSION
#define FIELD_COMPRESSION
Definition: tif_dir.h:113
TIFFTAG_ASSHOTPREPROFILEMATRIX
#define TIFFTAG_ASSHOTPREPROFILEMATRIX
Definition: tiff.h:507
FIELD_SMINSAMPLEVALUE
#define FIELD_SMINSAMPLEVALUE
Definition: tif_dir.h:130
FIELD_ROWSPERSTRIP
#define FIELD_ROWSPERSTRIP
Definition: tif_dir.h:119
EXIFTAG_BRIGHTNESSVALUE
#define EXIFTAG_BRIGHTNESSVALUE
Definition: tiff.h:599
TIFFTAG_GRAYRESPONSEUNIT
#define TIFFTAG_GRAYRESPONSEUNIT
Definition: tiff.h:250
TIFFTAG_MODEL
#define TIFFTAG_MODEL
Definition: tiff.h:224
TIFFTAG_PIXAR_TEXTUREFORMAT
#define TIFFTAG_PIXAR_TEXTUREFORMAT
Definition: tiff.h:379
TIFFTAG_BASELINESHARPNESS
#define TIFFTAG_BASELINESHARPNESS
Definition: tiff.h:474
TIFFTAG_HOSTCOMPUTER
#define TIFFTAG_HOSTCOMPUTER
Definition: tiff.h:280
EXIFTAG_SUBJECTDISTANCE
#define EXIFTAG_SUBJECTDISTANCE
Definition: tiff.h:602
TIFFTAG_TRANSFERFUNCTION
#define TIFFTAG_TRANSFERFUNCTION
Definition: tiff.h:276
FIELD_INKNAMES
#define FIELD_INKNAMES
Definition: tif_dir.h:139
TIFFTAG_WHITEPOINT
#define TIFFTAG_WHITEPOINT
Definition: tiff.h:285
tiff::tif_fieldinfo
TIFFFieldInfo ** tif_fieldinfo
Definition: tiffiop.h:194
EXIFTAG_CFAPATTERN
#define EXIFTAG_CFAPATTERN
Definition: tiff.h:628
TIFFTAG_SHADOWSCALE
#define TIFFTAG_SHADOWSCALE
Definition: tiff.h:487
TIFFTAG_DEFAULTCROPORIGIN
#define TIFFTAG_DEFAULTCROPORIGIN
Definition: tiff.h:450
TIFFTAG_COMPRESSION
#define TIFFTAG_COMPRESSION
Definition: tiff.h:168
FIELD_ORIENTATION
#define FIELD_ORIENTATION
Definition: tif_dir.h:117
TIFFTAG_INKSET
#define TIFFTAG_INKSET
Definition: tiff.h:300
TIFFTAG_CFALAYOUT
#define TIFFTAG_CFALAYOUT
Definition: tiff.h:438
TIFF_SBYTE
Definition: tiff.h:144
EXIFTAG_SCENETYPE
#define EXIFTAG_SCENETYPE
Definition: tiff.h:627
TIFFArrayCount
#define TIFFArrayCount(a)
Definition: tiffiop.h:251
_TIFFmemset
void _TIFFmemset(tdata_t p, int v, tsize_t c)
Definition: tif_acorn.c:479
TIFFTAG_XCLIPPATHUNITS
#define TIFFTAG_XCLIPPATHUNITS
Definition: tiff.h:322
TIFFTAG_NUMBEROFINKS
#define TIFFTAG_NUMBEROFINKS
Definition: tiff.h:304
FIELD_IMAGEDEPTH
#define FIELD_IMAGEDEPTH
Definition: tif_dir.h:132
TIFFTAG_SMAXSAMPLEVALUE
#define TIFFTAG_SMAXSAMPLEVALUE
Definition: tiff.h:319
_TIFFFieldWithName
const TIFFFieldInfo * _TIFFFieldWithName(TIFF *tif, const char *field_name)
Definition: tif_dirinfo.c:818
TIFFTAG_COLORMATRIX1
#define TIFFTAG_COLORMATRIX1
Definition: tiff.h:454
EXIFTAG_CONTRAST
#define EXIFTAG_CONTRAST
Definition: tiff.h:636
TIFF_RATIONAL
Definition: tiff.h:143
FIELD_YCBCRPOSITIONING
#define FIELD_YCBCRPOSITIONING
Definition: tif_dir.h:136
TIFFDataWidth
int TIFFDataWidth(TIFFDataType type)
Definition: tif_dirinfo.c:662
_TIFFPrintFieldInfo
void _TIFFPrintFieldInfo(TIFF *tif, FILE *fd)
Definition: tif_dirinfo.c:638
TIFFTAG_LOCALIZEDCAMERAMODEL
#define TIFFTAG_LOCALIZEDCAMERAMODEL
Definition: tiff.h:434
EXIFTAG_GAINCONTROL
#define EXIFTAG_GAINCONTROL
Definition: tiff.h:642
_TIFFDataSize
int _TIFFDataSize(TIFFDataType type)
Definition: tif_dirinfo.c:697
FIELD_EXTRASAMPLES
#define FIELD_EXTRASAMPLES
Definition: tif_dir.h:128
TIFFTAG_CELLLENGTH
#define TIFFTAG_CELLLENGTH
Definition: tiff.h:217
TIFF_VARIABLE2
#define TIFF_VARIABLE2
Definition: tiffio.h:299
info
backing_store_ptr info
Definition: jmemsys.h:181
TIFFTAG_ASSHOTNEUTRAL
#define TIFFTAG_ASSHOTNEUTRAL
Definition: tiff.h:466
TIFFTAG_STONITS
#define TIFFTAG_STONITS
Definition: tiff.h:426
_TIFFFieldWithTag
const TIFFFieldInfo * _TIFFFieldWithTag(TIFF *tif, ttag_t tag)
Definition: tif_dirinfo.c:804
TIFF_SLONG
Definition: tiff.h:147
TIFFTAG_TILEDEPTH
#define TIFFTAG_TILEDEPTH
Definition: tiff.h:365
EXIFTAG_COMPONENTSCONFIGURATION
#define EXIFTAG_COMPONENTSCONFIGURATION
Definition: tiff.h:595
TIFFTAG_IMAGEDEPTH
#define TIFFTAG_IMAGEDEPTH
Definition: tiff.h:364
TIFFTAG_RESOLUTIONUNIT
#define TIFFTAG_RESOLUTIONUNIT
Definition: tiff.h:265
EXIFTAG_SCENECAPTURETYPE
#define EXIFTAG_SCENECAPTURETYPE
Definition: tiff.h:634
EXIFTAG_FNUMBER
#define EXIFTAG_FNUMBER
Definition: tiff.h:584
TIFFTAG_XRESOLUTION
#define TIFFTAG_XRESOLUTION
Definition: tiff.h:240
TIFFTAG_BLACKLEVELDELTAV
#define TIFFTAG_BLACKLEVELDELTAV
Definition: tiff.h:445
TIFFTAG_DEFAULTCROPSIZE
#define TIFFTAG_DEFAULTCROPSIZE
Definition: tiff.h:452
TIFFTAG_MAKE
#define TIFFTAG_MAKE
Definition: tiff.h:223
FIELD_POSITION
#define FIELD_POSITION
Definition: tif_dir.h:108
TIFFTAG_COLORRESPONSEUNIT
#define TIFFTAG_COLORRESPONSEUNIT
Definition: tiff.h:270
TIFF_FLOAT
Definition: tiff.h:149
TIFF_DOUBLE
Definition: tiff.h:150
tiff::tif_dir
TIFFDirectory tif_dir
Definition: tiffiop.h:133
FIELD_PAGENUMBER
#define FIELD_PAGENUMBER
Definition: tif_dir.h:124
FIELD_TILEDEPTH
#define FIELD_TILEDEPTH
Definition: tif_dir.h:133
EXIFTAG_APERTUREVALUE
#define EXIFTAG_APERTUREVALUE
Definition: tiff.h:598
TIFFTAG_CFAPLANECOLOR
#define TIFFTAG_CFAPLANECOLOR
Definition: tiff.h:436
FIELD_TILEDIMENSIONS
#define FIELD_TILEDIMENSIONS
Definition: tif_dir.h:106
TIFFTAG_WHITELEVEL
#define TIFFTAG_WHITELEVEL
Definition: tiff.h:447
TIFFTAG_ACTIVEAREA
#define TIFFTAG_ACTIVEAREA
Definition: tiff.h:502
TIFFFieldInfo::field_tag
ttag_t field_tag
Definition: tiffio.h:304
tiff::tif_foundfield
const TIFFFieldInfo * tif_foundfield
Definition: tiffiop.h:196
EXIFTAG_SPATIALFREQUENCYRESPONSE
#define EXIFTAG_SPATIALFREQUENCYRESPONSE
Definition: tiff.h:619
TIFFFieldInfo::field_oktochange
unsigned char field_oktochange
Definition: tiffio.h:309
TIFFTAG_RICHTIFFIPTC
#define TIFFTAG_RICHTIFFIPTC
Definition: tiff.h:389
TIFFTAG_TARGETPRINTER
#define TIFFTAG_TARGETPRINTER
Definition: tiff.h:306
EXIFTAG_SPECTRALSENSITIVITY
#define EXIFTAG_SPECTRALSENSITIVITY
Definition: tiff.h:586
_TIFFFindFieldInfo
const TIFFFieldInfo * _TIFFFindFieldInfo(TIFF *tif, ttag_t tag, TIFFDataType dt)
Definition: tif_dirinfo.c:747
_TIFFCreateAnonFieldInfo
TIFFFieldInfo * _TIFFCreateAnonFieldInfo(TIFF *tif, ttag_t tag, TIFFDataType field_type)
Definition: tif_dirinfo.c:849
TIFFTAG_UNIQUECAMERAMODEL
#define TIFFTAG_UNIQUECAMERAMODEL
Definition: tiff.h:433
TIFFTAG_REDUCTIONMATRIX1
#define TIFFTAG_REDUCTIONMATRIX1
Definition: tiff.h:460
_TIFFmalloc
void * _TIFFmalloc(tsize_t s)
Definition: tif_acorn.c:461
EXIFTAG_CUSTOMRENDERED
#define EXIFTAG_CUSTOMRENDERED
Definition: tiff.h:629
EXIFTAG_OECF
#define EXIFTAG_OECF
Definition: tiff.h:588
FIELD_COLORMAP
#define FIELD_COLORMAP
Definition: tif_dir.h:127
FIELD_SAMPLESPERPIXEL
#define FIELD_SAMPLESPERPIXEL
Definition: tif_dir.h:118
TIFFFieldInfo::field_name
char * field_name
Definition: tiffio.h:311
TIFFDirectory::td_sampleformat
uint16 td_sampleformat
Definition: tif_dir.h:45
TIFFTAG_YCLIPPATHUNITS
#define TIFFTAG_YCLIPPATHUNITS
Definition: tiff.h:324
_TIFFCheckMalloc
tdata_t _TIFFCheckMalloc(TIFF *tif, size_t nmemb, size_t elem_size, const char *what)
Definition: tif_aux.c:59
TIFFFieldInfo::field_type
TIFFDataType field_type
Definition: tiffio.h:307
TIFF_SHORT
Definition: tiff.h:141
FIELD_REFBLACKWHITE
#define FIELD_REFBLACKWHITE
Definition: tif_dir.h:137
_TIFFfree
void _TIFFfree(tdata_t p)
Definition: tif_acorn.c:467
_TIFFSampleToTagType
TIFFDataType _TIFFSampleToTagType(TIFF *tif)
Definition: tif_dirinfo.c:726
EXIFTAG_FOCALLENGTHIN35MMFILM
#define EXIFTAG_FOCALLENGTHIN35MMFILM
Definition: tiff.h:633
_TIFFCheckRealloc
tdata_t _TIFFCheckRealloc(TIFF *tif, tdata_t buffer, size_t nmemb, size_t elem_size, const char *what)
Definition: tif_aux.c:37
TIFF_IFD
Definition: tiff.h:151
EXIFTAG_SUBJECTDISTANCERANGE
#define EXIFTAG_SUBJECTDISTANCERANGE
Definition: tiff.h:640
EXIFTAG_MAXAPERTUREVALUE
#define EXIFTAG_MAXAPERTUREVALUE
Definition: tiff.h:601
TIFFTAG_SAMPLEFORMAT
#define TIFFTAG_SAMPLEFORMAT
Definition: tiff.h:311
TIFFTAG_OSUBFILETYPE
#define TIFFTAG_OSUBFILETYPE
Definition: tiff.h:161
FIELD_SAMPLEFORMAT
#define FIELD_SAMPLEFORMAT
Definition: tif_dir.h:129
_TIFFFindFieldInfoByName
const TIFFFieldInfo * _TIFFFindFieldInfoByName(TIFF *tif, const char *field_name, TIFFDataType dt)
Definition: tif_dirinfo.c:775
TIFFTAG_CLIPPATH
#define TIFFTAG_CLIPPATH
Definition: tiff.h:320
EXIFTAG_PIXELXDIMENSION
#define EXIFTAG_PIXELXDIMENSION
Definition: tiff.h:615
TIFFFieldInfo::field_bit
unsigned short field_bit
Definition: tiffio.h:308
TIFFTAG_BLACKLEVEL
#define TIFFTAG_BLACKLEVEL
Definition: tiff.h:442
TIFFTAG_MAXSAMPLEVALUE
#define TIFFTAG_MAXSAMPLEVALUE
Definition: tiff.h:239
TIFFFieldInfo::field_writecount
short field_writecount
Definition: tiffio.h:306
TIFFTAG_PHOTOSHOP
#define TIFFTAG_PHOTOSHOP
Definition: tiff.h:412
TIFFTAG_CALIBRATIONILLUMINANT1
#define TIFFTAG_CALIBRATIONILLUMINANT1
Definition: tiff.h:493
TIFFDataType
TIFFDataType
Definition: tiff.h:137
FIELD_SUBFILETYPE
#define FIELD_SUBFILETYPE
Definition: tif_dir.h:111
EXIFTAG_METERINGMODE
#define EXIFTAG_METERINGMODE
Definition: tiff.h:603
EXIFTAG_SENSINGMETHOD
#define EXIFTAG_SENSINGMETHOD
Definition: tiff.h:625
lfind
#define lfind
Definition: tif_config.vc.h:56
bsearch
#define bsearch
Definition: tif_config.wince.h:40