/src/libtiff/libtiff/tif_dirinfo.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 1988-1997 Sam Leffler |
3 | | * Copyright (c) 1991-1997 Silicon Graphics, Inc. |
4 | | * |
5 | | * Permission to use, copy, modify, distribute, and sell this software and |
6 | | * its documentation for any purpose is hereby granted without fee, provided |
7 | | * that (i) the above copyright notices and this permission notice appear in |
8 | | * all copies of the software and related documentation, and (ii) the names of |
9 | | * Sam Leffler and Silicon Graphics may not be used in any advertising or |
10 | | * publicity relating to the software without the specific, prior written |
11 | | * permission of Sam Leffler and Silicon Graphics. |
12 | | * |
13 | | * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, |
14 | | * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY |
15 | | * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. |
16 | | * |
17 | | * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR |
18 | | * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, |
19 | | * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, |
20 | | * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF |
21 | | * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE |
22 | | * OF THIS SOFTWARE. |
23 | | */ |
24 | | |
25 | | /* |
26 | | * TIFF Library. |
27 | | * |
28 | | * Core Directory Tag Support. |
29 | | */ |
30 | | #include "tiffiop.h" |
31 | | #include <stdlib.h> |
32 | | |
33 | | /* |
34 | | * NOTE: THIS ARRAY IS ASSUMED TO BE SORTED BY TAG. |
35 | | * |
36 | | * NOTE: The second field (field_readcount) and third field (field_writecount) |
37 | | * sometimes use the values TIFF_VARIABLE (-1), TIFF_VARIABLE2 (-3) |
38 | | * and TIFF_SPP (-2). The macros should be used but would throw off |
39 | | * the formatting of the code, so please interpret the -1, -2 and -3 |
40 | | * values accordingly. |
41 | | */ |
42 | | |
43 | | /* const object should be initialized */ |
44 | | #ifdef _MSC_VER |
45 | | #pragma warning(push) |
46 | | #pragma warning(disable : 4132) |
47 | | #endif |
48 | | static const TIFFFieldArray tiffFieldArray; |
49 | | static const TIFFFieldArray exifFieldArray; |
50 | | static const TIFFFieldArray gpsFieldArray; |
51 | | #ifdef _MSC_VER |
52 | | #pragma warning(pop) |
53 | | #endif |
54 | | /*--: Rational2Double: -- |
55 | | * The Rational2Double upgraded libtiff functionality allows the definition and |
56 | | * achievement of true double-precision accuracy for TIFF tags of RATIONAL type |
57 | | * and field_bit=FIELD_CUSTOM using the set_field_type = TIFF_SETGET_DOUBLE. |
58 | | * Unfortunately, that changes the old implemented interface for TIFFGetField(). |
59 | | * In order to keep the old TIFFGetField() interface behavior those tags have to |
60 | | * be redefined with set_field_type = TIFF_SETGET_FLOAT! |
61 | | * |
62 | | * Rational custom arrays are already defined as _Cxx_FLOAT, thus can stay. |
63 | | * |
64 | | */ |
65 | | |
66 | | /* clang-format off */ /* for better readability of tag comments */ |
67 | | static const TIFFField tiffFields[] = { |
68 | | {TIFFTAG_SUBFILETYPE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_SUBFILETYPE, 1, 0, "SubfileType", NULL}, |
69 | | {TIFFTAG_OSUBFILETYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "OldSubfileType", NULL}, |
70 | | {TIFFTAG_IMAGEWIDTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_IMAGEDIMENSIONS, 0, 0, "ImageWidth", NULL}, |
71 | | {TIFFTAG_IMAGELENGTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_IMAGEDIMENSIONS, 1, 0, "ImageLength", NULL}, |
72 | | {TIFFTAG_BITSPERSAMPLE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_BITSPERSAMPLE, 0, 0, "BitsPerSample", NULL}, |
73 | | {TIFFTAG_COMPRESSION, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_COMPRESSION, 0, 0, "Compression", NULL}, |
74 | | {TIFFTAG_PHOTOMETRIC, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_PHOTOMETRIC, 0, 0, "PhotometricInterpretation", NULL}, |
75 | | {TIFFTAG_THRESHHOLDING, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_THRESHHOLDING, 1, 0, "Threshholding", NULL}, |
76 | | {TIFFTAG_CELLWIDTH, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CellWidth", NULL}, |
77 | | {TIFFTAG_CELLLENGTH, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CellLength", NULL}, |
78 | | {TIFFTAG_FILLORDER, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_FILLORDER, 0, 0, "FillOrder", NULL}, |
79 | | {TIFFTAG_DOCUMENTNAME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DocumentName", NULL}, |
80 | | {TIFFTAG_IMAGEDESCRIPTION, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageDescription", NULL}, |
81 | | {TIFFTAG_MAKE, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Make", NULL}, |
82 | | {TIFFTAG_MODEL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Model", NULL}, |
83 | | {TIFFTAG_STRIPOFFSETS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_STRIPOFFSETS, 0, 0, "StripOffsets", NULL}, |
84 | | {TIFFTAG_ORIENTATION, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_ORIENTATION, 0, 0, "Orientation", NULL}, |
85 | | {TIFFTAG_SAMPLESPERPIXEL, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_SAMPLESPERPIXEL, 0, 0, "SamplesPerPixel", NULL}, |
86 | | {TIFFTAG_ROWSPERSTRIP, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_ROWSPERSTRIP, 0, 0, "RowsPerStrip", NULL}, |
87 | | {TIFFTAG_STRIPBYTECOUNTS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_STRIPBYTECOUNTS, 0, 0, "StripByteCounts", NULL}, |
88 | | {TIFFTAG_MINSAMPLEVALUE, -2, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_MINSAMPLEVALUE, 1, 0, "MinSampleValue", NULL}, |
89 | | {TIFFTAG_MAXSAMPLEVALUE, -2, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_MAXSAMPLEVALUE, 1, 0, "MaxSampleValue", NULL}, |
90 | | {TIFFTAG_XRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_RESOLUTION, 1, 0, "XResolution", NULL}, |
91 | | {TIFFTAG_YRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_RESOLUTION, 1, 0, "YResolution", NULL}, |
92 | | {TIFFTAG_PLANARCONFIG, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_PLANARCONFIG, 0, 0, "PlanarConfiguration", NULL}, |
93 | | {TIFFTAG_PAGENAME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PageName", NULL}, |
94 | | {TIFFTAG_XPOSITION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_POSITION, 1, 0, "XPosition", NULL}, |
95 | | {TIFFTAG_YPOSITION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_POSITION, 1, 0, "YPosition", NULL}, |
96 | | {TIFFTAG_FREEOFFSETS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 0, 0, "FreeOffsets", NULL}, |
97 | | {TIFFTAG_FREEBYTECOUNTS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 0, 0, "FreeByteCounts", NULL}, |
98 | | {TIFFTAG_GRAYRESPONSEUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "GrayResponseUnit", NULL}, |
99 | | {TIFFTAG_GRAYRESPONSECURVE, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "GrayResponseCurve", NULL}, |
100 | | {TIFFTAG_RESOLUTIONUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_RESOLUTIONUNIT, 1, 0, "ResolutionUnit", NULL}, |
101 | | {TIFFTAG_PAGENUMBER, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UNDEFINED, FIELD_PAGENUMBER, 1, 0, "PageNumber", NULL}, |
102 | | {TIFFTAG_COLORRESPONSEUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "ColorResponseUnit", NULL}, |
103 | | {TIFFTAG_TRANSFERFUNCTION, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_OTHER, TIFF_SETGET_UNDEFINED, FIELD_TRANSFERFUNCTION, 1, 0, "TransferFunction", NULL}, |
104 | | {TIFFTAG_SOFTWARE, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Software", NULL}, |
105 | | {TIFFTAG_DATETIME, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DateTime", NULL}, |
106 | | {TIFFTAG_ARTIST, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Artist", NULL}, |
107 | | {TIFFTAG_HOSTCOMPUTER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "HostComputer", NULL}, |
108 | | {TIFFTAG_WHITEPOINT, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "WhitePoint", NULL}, |
109 | | {TIFFTAG_PRIMARYCHROMATICITIES, 6, 6, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PrimaryChromaticities", NULL}, |
110 | | {TIFFTAG_COLORMAP, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_OTHER, TIFF_SETGET_UNDEFINED, FIELD_COLORMAP, 1, 0, "ColorMap", NULL}, |
111 | | {TIFFTAG_HALFTONEHINTS, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UNDEFINED, FIELD_HALFTONEHINTS, 1, 0, "HalftoneHints", NULL}, |
112 | | {TIFFTAG_TILEWIDTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_TILEDIMENSIONS, 0, 0, "TileWidth", NULL}, |
113 | | {TIFFTAG_TILELENGTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_TILEDIMENSIONS, 0, 0, "TileLength", NULL}, |
114 | | {TIFFTAG_TILEOFFSETS, -1, 1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_STRIPOFFSETS, 0, 0, "TileOffsets", NULL}, |
115 | | {TIFFTAG_TILEBYTECOUNTS, -1, 1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_STRIPBYTECOUNTS, 0, 0, "TileByteCounts", NULL}, |
116 | | {TIFFTAG_SUBIFD, -1, -1, TIFF_IFD8, 0, TIFF_SETGET_C16_IFD8, TIFF_SETGET_UNDEFINED, FIELD_SUBIFD, 1, 1, "SubIFD", (TIFFFieldArray *)&tiffFieldArray}, |
117 | | {TIFFTAG_INKSET, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "InkSet", NULL}, |
118 | | {TIFFTAG_INKNAMES, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_C16_ASCII, TIFF_SETGET_UNDEFINED, FIELD_INKNAMES, 1, 1, "InkNames", NULL}, |
119 | | {TIFFTAG_NUMBEROFINKS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_NUMBEROFINKS, 1, 0, "NumberOfInks", NULL}, |
120 | | {TIFFTAG_DOTRANGE, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "DotRange", NULL}, |
121 | | {TIFFTAG_TARGETPRINTER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TargetPrinter", NULL}, |
122 | | {TIFFTAG_EXTRASAMPLES, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_EXTRASAMPLES, 0, 1, "ExtraSamples", NULL}, |
123 | | {TIFFTAG_SAMPLEFORMAT, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_SAMPLEFORMAT, 0, 0, "SampleFormat", NULL}, |
124 | | {TIFFTAG_SMINSAMPLEVALUE, -2, -1, TIFF_ANY, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_SMINSAMPLEVALUE, 1, 0, "SMinSampleValue", NULL}, |
125 | | {TIFFTAG_SMAXSAMPLEVALUE, -2, -1, TIFF_ANY, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_SMAXSAMPLEVALUE, 1, 0, "SMaxSampleValue", NULL}, |
126 | | {TIFFTAG_CLIPPATH, -3, -3, TIFF_BYTE, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "ClipPath", NULL}, |
127 | | {TIFFTAG_XCLIPPATHUNITS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "XClipPathUnits", NULL}, |
128 | | {TIFFTAG_YCLIPPATHUNITS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "YClipPathUnits", NULL}, |
129 | | {TIFFTAG_YCBCRCOEFFICIENTS, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "YCbCrCoefficients", NULL}, |
130 | | {TIFFTAG_YCBCRSUBSAMPLING, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UNDEFINED, FIELD_YCBCRSUBSAMPLING, 0, 0, "YCbCrSubsampling", NULL}, |
131 | | {TIFFTAG_YCBCRPOSITIONING, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_YCBCRPOSITIONING, 0, 0, "YCbCrPositioning", NULL}, |
132 | | {TIFFTAG_REFERENCEBLACKWHITE, 6, 6, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_REFBLACKWHITE, 1, 0, "ReferenceBlackWhite", NULL}, |
133 | | {TIFFTAG_XMLPACKET, -3, -3, TIFF_BYTE, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "XMLPacket", NULL}, |
134 | | /* begin SGI tags */ |
135 | | {TIFFTAG_MATTEING, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_EXTRASAMPLES, 0, 0, "Matteing", NULL}, |
136 | | {TIFFTAG_DATATYPE, -2, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_SAMPLEFORMAT, 0, 0, "DataType", NULL}, |
137 | | {TIFFTAG_IMAGEDEPTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_IMAGEDEPTH, 0, 0, "ImageDepth", NULL}, |
138 | | {TIFFTAG_TILEDEPTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_TILEDEPTH, 0, 0, "TileDepth", NULL}, |
139 | | /* end SGI tags */ |
140 | | /* begin Pixar tags */ |
141 | | {TIFFTAG_PIXAR_IMAGEFULLWIDTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageFullWidth", NULL}, |
142 | | {TIFFTAG_PIXAR_IMAGEFULLLENGTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageFullLength", NULL}, |
143 | | {TIFFTAG_PIXAR_TEXTUREFORMAT, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TextureFormat", NULL}, |
144 | | {TIFFTAG_PIXAR_WRAPMODES, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TextureWrapModes", NULL}, |
145 | | {TIFFTAG_PIXAR_FOVCOT, 1, 1, TIFF_FLOAT, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FieldOfViewCotangent", NULL}, |
146 | | {TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN, 16, 16, TIFF_FLOAT, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MatrixWorldToScreen", NULL}, |
147 | | {TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA, 16, 16, TIFF_FLOAT, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MatrixWorldToCamera", NULL}, |
148 | | {TIFFTAG_COPYRIGHT, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Copyright", NULL}, |
149 | | /* end Pixar tags */ |
150 | | {TIFFTAG_RICHTIFFIPTC, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "RichTIFFIPTC", NULL}, |
151 | | {TIFFTAG_PHOTOSHOP, -3, -3, TIFF_BYTE, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "Photoshop", NULL}, |
152 | | /*--: EXIFIFD and GPSIFD specified as TIFF_LONG by Aware-Systems and not TIFF_IFD8 as in original LibTiff. However, for IFD-like tags, |
153 | | * libtiff uses the data type TIFF_IFD8 in tiffFields[]-tag definition combined with a special handling procedure in order to write either |
154 | | * a 32-bit value and the TIFF_IFD type-id into ClassicTIFF files or a 64-bit value and the TIFF_IFD8 type-id into BigTIFF files. */ |
155 | | {TIFFTAG_EXIFIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EXIFIFDOffset", (TIFFFieldArray *)&exifFieldArray}, |
156 | | {TIFFTAG_ICCPROFILE, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ICC Profile", NULL}, |
157 | | {TIFFTAG_GPSIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "GPSIFDOffset", (TIFFFieldArray *)&gpsFieldArray}, |
158 | | {TIFFTAG_FAXRECVPARAMS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UINT32, FIELD_CUSTOM, TRUE, FALSE, "FaxRecvParams", NULL}, |
159 | | {TIFFTAG_FAXSUBADDRESS, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_ASCII, FIELD_CUSTOM, TRUE, FALSE, "FaxSubAddress", NULL}, |
160 | | {TIFFTAG_FAXRECVTIME, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UINT32, FIELD_CUSTOM, TRUE, FALSE, "FaxRecvTime", NULL}, |
161 | | {TIFFTAG_FAXDCS, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_ASCII, FIELD_CUSTOM, TRUE, FALSE, "FaxDcs", NULL}, |
162 | | {TIFFTAG_STONITS, 1, 1, TIFF_DOUBLE, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "StoNits", NULL}, |
163 | | {TIFFTAG_IMAGESOURCEDATA, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "Adobe Photoshop Document Data Block", NULL}, |
164 | | {TIFFTAG_INTEROPERABILITYIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "InteroperabilityIFDOffset", NULL}, |
165 | | /* begin DNG tags */ |
166 | | {TIFFTAG_DNGVERSION, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DNGVersion", NULL}, |
167 | | {TIFFTAG_DNGBACKWARDVERSION, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DNGBackwardVersion", NULL}, |
168 | | {TIFFTAG_UNIQUECAMERAMODEL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "UniqueCameraModel", NULL}, |
169 | | {TIFFTAG_LOCALIZEDCAMERAMODEL, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "LocalizedCameraModel", NULL}, |
170 | | {TIFFTAG_CFAPLANECOLOR, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CFAPlaneColor", NULL}, |
171 | | {TIFFTAG_CFALAYOUT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CFALayout", NULL}, |
172 | | {TIFFTAG_LINEARIZATIONTABLE, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "LinearizationTable", NULL}, |
173 | | {TIFFTAG_BLACKLEVELREPEATDIM, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BlackLevelRepeatDim", NULL}, |
174 | | {TIFFTAG_BLACKLEVEL, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "BlackLevel", NULL}, |
175 | | {TIFFTAG_BLACKLEVELDELTAH, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "BlackLevelDeltaH", NULL}, |
176 | | {TIFFTAG_BLACKLEVELDELTAV, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "BlackLevelDeltaV", NULL}, |
177 | | {TIFFTAG_WHITELEVEL, -1, -1, TIFF_LONG, 0, TIFF_SETGET_C16_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "WhiteLevel", NULL}, |
178 | | {TIFFTAG_DEFAULTSCALE, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DefaultScale", NULL}, |
179 | | {TIFFTAG_BESTQUALITYSCALE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BestQualityScale", NULL}, |
180 | | {TIFFTAG_DEFAULTCROPORIGIN, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DefaultCropOrigin", NULL}, |
181 | | {TIFFTAG_DEFAULTCROPSIZE, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DefaultCropSize", NULL}, |
182 | | {TIFFTAG_COLORMATRIX1, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ColorMatrix1", NULL}, |
183 | | {TIFFTAG_COLORMATRIX2, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ColorMatrix2", NULL}, |
184 | | {TIFFTAG_CAMERACALIBRATION1, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CameraCalibration1", NULL}, |
185 | | {TIFFTAG_CAMERACALIBRATION2, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CameraCalibration2", NULL}, |
186 | | {TIFFTAG_REDUCTIONMATRIX1, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ReductionMatrix1", NULL}, |
187 | | {TIFFTAG_REDUCTIONMATRIX2, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ReductionMatrix2", NULL}, |
188 | | {TIFFTAG_ANALOGBALANCE, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "AnalogBalance", NULL}, |
189 | | {TIFFTAG_ASSHOTNEUTRAL, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "AsShotNeutral", NULL}, |
190 | | {TIFFTAG_ASSHOTWHITEXY, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "AsShotWhiteXY", NULL}, |
191 | | {TIFFTAG_BASELINEEXPOSURE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BaselineExposure", NULL}, |
192 | | {TIFFTAG_BASELINENOISE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BaselineNoise", NULL}, |
193 | | {TIFFTAG_BASELINESHARPNESS, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BaselineSharpness", NULL}, |
194 | | {TIFFTAG_BAYERGREENSPLIT, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BayerGreenSplit", NULL}, |
195 | | {TIFFTAG_LINEARRESPONSELIMIT, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LinearResponseLimit", NULL}, |
196 | | {TIFFTAG_CAMERASERIALNUMBER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CameraSerialNumber", NULL}, |
197 | | {TIFFTAG_LENSINFO, 4, 4, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LensInfo", NULL}, |
198 | | {TIFFTAG_CHROMABLURRADIUS, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ChromaBlurRadius", NULL}, |
199 | | {TIFFTAG_ANTIALIASSTRENGTH, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "AntiAliasStrength", NULL}, |
200 | | {TIFFTAG_SHADOWSCALE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ShadowScale", NULL}, |
201 | | {TIFFTAG_DNGPRIVATEDATA, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "DNGPrivateData", NULL}, |
202 | | {TIFFTAG_MAKERNOTESAFETY, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MakerNoteSafety", NULL}, |
203 | | {TIFFTAG_CALIBRATIONILLUMINANT1, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CalibrationIlluminant1", NULL}, |
204 | | {TIFFTAG_CALIBRATIONILLUMINANT2, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CalibrationIlluminant2", NULL}, |
205 | | {TIFFTAG_RAWDATAUNIQUEID, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "RawDataUniqueID", NULL}, |
206 | | {TIFFTAG_ORIGINALRAWFILENAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "OriginalRawFileName", NULL}, |
207 | | {TIFFTAG_ORIGINALRAWFILEDATA, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "OriginalRawFileData", NULL}, |
208 | | {TIFFTAG_ACTIVEAREA, 4, 4, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ActiveArea", NULL}, |
209 | | {TIFFTAG_MASKEDAREAS, -1, -1, TIFF_LONG, 0, TIFF_SETGET_C16_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "MaskedAreas", NULL}, |
210 | | {TIFFTAG_ASSHOTICCPROFILE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "AsShotICCProfile", NULL}, |
211 | | {TIFFTAG_ASSHOTPREPROFILEMATRIX, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "AsShotPreProfileMatrix", NULL}, |
212 | | {TIFFTAG_CURRENTICCPROFILE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CurrentICCProfile", NULL}, |
213 | | {TIFFTAG_CURRENTPREPROFILEMATRIX, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CurrentPreProfileMatrix", NULL}, |
214 | | {TIFFTAG_PERSAMPLE, 0, 0, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "PerSample", NULL}, |
215 | | #if 0 |
216 | | /* begin DNG 1.2.0.0 tags */ |
217 | | {TIFFTAG_COLORIMETRICREFERENCE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ColorimetricReference", NULL}, |
218 | | {TIFFTAG_CAMERACALIBRATIONSIGNATURE, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CameraCalibrationSignature", NULL}, |
219 | | {TIFFTAG_PROFILECALIBRATIONSIGNATURE, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileCalibrationSignature", NULL}, |
220 | | {TIFFTAG_EXTRACAMERAPROFILES, -1, -1, TIFF_IFD8, 0, TIFF_SETGET_C16_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ExtraCameraProfiles", NULL}, |
221 | | {TIFFTAG_ASSHOTPROFILENAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "AsShotProfileName", NULL}, |
222 | | {TIFFTAG_NOISEREDUCTIONAPPLIED, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "NoiseReductionApplied", NULL}, |
223 | | {TIFFTAG_PROFILENAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileName", NULL}, |
224 | | {TIFFTAG_PROFILEHUESATMAPDIMS, 3, 3, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ProfileHueSatMapDims", NULL}, |
225 | | {TIFFTAG_PROFILEHUESATMAPDATA1, -1, -1, TIFF_FLOAT, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileHueSatMapData1", NULL}, |
226 | | {TIFFTAG_PROFILEHUESATMAPDATA2, -1, -1, TIFF_FLOAT, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileHueSatMapData2", NULL}, |
227 | | {TIFFTAG_PROFILETONECURVE, -1, -1, TIFF_FLOAT, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileToneCurve", NULL}, |
228 | | {TIFFTAG_PROFILEEMBEDPOLICY, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ProfileEmbedPolicy", NULL}, |
229 | | {TIFFTAG_PROFILECOPYRIGHT, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileCopyright", NULL}, |
230 | | {TIFFTAG_FORWARDMATRIX1, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ForwardMatrix1", NULL}, |
231 | | {TIFFTAG_FORWARDMATRIX2, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ForwardMatrix2", NULL}, |
232 | | {TIFFTAG_PREVIEWAPPLICATIONNAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "PreviewApplicationName", NULL}, |
233 | | {TIFFTAG_PREVIEWAPPLICATIONVERSION, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "PreviewApplicationVersion", NULL}, |
234 | | {TIFFTAG_PREVIEWSETTINGSNAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "PreviewSettingsName", NULL}, |
235 | | {TIFFTAG_PREVIEWSETTINGSDIGEST, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PreviewSettingsDigest", NULL}, |
236 | | {TIFFTAG_PREVIEWCOLORSPACE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PreviewColorSpace", NULL}, |
237 | | {TIFFTAG_PREVIEWDATETIME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PreviewDateTime", NULL}, |
238 | | {TIFFTAG_RAWIMAGEDIGEST, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "RawImageDigest", NULL}, |
239 | | {TIFFTAG_ORIGINALRAWFILEDIGEST, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OriginalRawFileDigest", NULL}, |
240 | | {TIFFTAG_SUBTILEBLOCKSIZE, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubTileBlockSize", NULL}, |
241 | | {TIFFTAG_ROWINTERLEAVEFACTOR, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "RowInterleaveFactor", NULL}, |
242 | | {TIFFTAG_PROFILELOOKTABLEDIMS, 3, 3, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ProfileLookTableDims", NULL}, |
243 | | {TIFFTAG_PROFILELOOKTABLEDATA, -1, -1, TIFF_FLOAT, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileLookTableData", NULL}, |
244 | | /* begin DNG 1.3.0.0 tags */ |
245 | | {TIFFTAG_OPCODELIST1, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "OpcodeList1", NULL}, |
246 | | {TIFFTAG_OPCODELIST2, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "OpcodeList2", NULL}, |
247 | | {TIFFTAG_OPCODELIST3, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "OpcodeList3", NULL}, |
248 | | {TIFFTAG_NOISEPROFILE, -1, -1, TIFF_DOUBLE, 0, TIFF_SETGET_C16_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "NoiseProfile", NULL}, |
249 | | /* begin DNG 1.4.0.0 tags */ |
250 | | {TIFFTAG_DEFAULTUSERCROP, 4, 4, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DefaultUserCrop", NULL}, |
251 | | {TIFFTAG_DEFAULTBLACKRENDER, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DefaultBlackRender", NULL}, |
252 | | {TIFFTAG_BASELINEEXPOSUREOFFSET, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BaselineExposureOffset", NULL}, |
253 | | {TIFFTAG_PROFILELOOKTABLEENCODING, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ProfileLookTableEncoding", NULL}, |
254 | | {TIFFTAG_PROFILEHUESATMAPENCODING, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ProfileHueSatMapEncoding", NULL}, |
255 | | {TIFFTAG_ORIGINALDEFAULTFINALSIZE, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OriginalDefaultFinalSize", NULL}, |
256 | | {TIFFTAG_ORIGINALBESTQUALITYFINALSIZE, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OriginalBestQualityFinalSize", NULL}, |
257 | | {TIFFTAG_ORIGINALDEFAULTCROPSIZE, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OriginalDefaultCropSize", NULL}, /* could also be rational */ |
258 | | {TIFFTAG_NEWRAWIMAGEDIGEST, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "NewRawImageDigest", NULL}, |
259 | | {TIFFTAG_RAWTOPREVIEWGAIN, 1, 1, TIFF_DOUBLE, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "RawToPreviewGain", NULL}, |
260 | | /* begin DNG 1.5.0.0 tags */ |
261 | | {TIFFTAG_DEPTHFORMAT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DepthFormat", NULL}, |
262 | | {TIFFTAG_DEPTHNEAR, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DepthNear", NULL}, |
263 | | {TIFFTAG_DEPTHFAR, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DepthFar", NULL}, |
264 | | {TIFFTAG_DEPTHUNITS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DepthUnits", NULL}, |
265 | | {TIFFTAG_DEPTHMEASURETYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DepthMeasureType", NULL}, |
266 | | {TIFFTAG_ENHANCEPARAMS, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EnhanceParams", NULL}, |
267 | | /* begin DNG 1.6.0.0 tags */ |
268 | | {TIFFTAG_PROFILEGAINTABLEMAP, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileGainTableMap", NULL}, |
269 | | {TIFFTAG_SEMANTICNAME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SemanticName", NULL}, |
270 | | {TIFFTAG_SEMANTICINSTANCEID, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SemanticInstanceID", NULL}, |
271 | | {TIFFTAG_MASKSUBAREA, 4, 4, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MaskSubArea", NULL}, |
272 | | {TIFFTAG_RGBTABLES, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "RGBTables", NULL}, |
273 | | {TIFFTAG_CALIBRATIONILLUMINANT3, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CalibrationIlluminant3", NULL}, |
274 | | {TIFFTAG_COLORMATRIX3, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ColorMatrix3", NULL}, |
275 | | {TIFFTAG_CAMERACALIBRATION3, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CameraCalibration3", NULL}, |
276 | | {TIFFTAG_REDUCTIONMATRIX3, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ReductionMatrix3", NULL}, |
277 | | {TIFFTAG_PROFILEHUESATMAPDATA3, -1, -1, TIFF_FLOAT, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileHueSatMapData3", NULL}, |
278 | | {TIFFTAG_FORWARDMATRIX3, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ForwardMatrix3", NULL}, |
279 | | {TIFFTAG_ILLUMINANTDATA1, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "IlluminantData1", NULL}, |
280 | | {TIFFTAG_ILLUMINANTDATA2, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "IlluminantData2", NULL}, |
281 | | {TIFFTAG_ILLUMINANTDATA3, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "IlluminantData3", NULL}, |
282 | | /* end DNG tags */ |
283 | | #endif |
284 | | /* begin TIFF/EP tags */ |
285 | | {TIFFTAG_EP_CFAREPEATPATTERNDIM, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP CFARepeatPatternDim", NULL}, |
286 | | {TIFFTAG_EP_CFAPATTERN, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP CFAPattern", NULL}, |
287 | | #if 0 |
288 | | /* TIFFTAG_EP_BATTERYLEVEL can be RATIONAL or ASCII. |
289 | | * LibTiff defines it as ASCII and converts RATIONAL to an ASCII string. */ |
290 | | {TIFFTAG_EP_BATTERYLEVEL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP BatteryLevel", NULL}, |
291 | | {TIFFTAG_EP_INTERLACE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP Interlace", NULL}, |
292 | | /* TIFFTAG_EP_IPTC_NAA and TIFFTAG_RICHTIFFIPTC share the same tag number (33723) |
293 | | * LibTIFF type is UNDEFINED or BYTE, but often times incorrectly specified as LONG, because TIFF/EP (ISO/DIS 12234-2) specifies type LONG or ASCII. */ |
294 | | {TIFFTAG_EP_TIMEZONEOFFSET, -1, -1, TIFF_SSHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP TimeZoneOffset", NULL}, |
295 | | {TIFFTAG_EP_SELFTIMERMODE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP SelfTimerMode", NULL}, |
296 | | {TIFFTAG_EP_FLASHENERGY, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP FlashEnergy", NULL}, |
297 | | {TIFFTAG_EP_SPATIALFREQUENCYRESPONSE, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP SpatialFrequencyResponse", NULL}, |
298 | | {TIFFTAG_EP_NOISE, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP Noise", NULL}, |
299 | | {TIFFTAG_EP_FOCALPLANEXRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP FocalPlaneXResolution", NULL}, |
300 | | {TIFFTAG_EP_FOCALPLANEYRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP FocalPlaneYResolution", NULL}, |
301 | | {TIFFTAG_EP_FOCALPLANERESOLUTIONUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP FocalPlaneResolutionUnit", NULL}, |
302 | | {TIFFTAG_EP_IMAGENUMBER, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP ImageNumber", NULL}, /* or SHORT */ |
303 | | {TIFFTAG_EP_SECURITYCLASSIFICATION, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP SecurityClassification", NULL}, |
304 | | {TIFFTAG_EP_IMAGEHISTORY, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP ImageHistory", NULL}, |
305 | | {TIFFTAG_EP_EXPOSUREINDEX, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP ExposureIndex", NULL}, |
306 | | {TIFFTAG_EP_STANDARDID, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP StandardId", NULL}, |
307 | | {TIFFTAG_EP_SENSINGMETHOD, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP SensingMethod", NULL}, |
308 | | /* TIFF/EP tags equivalent to EXIF tags, sometimes defined differently. */ |
309 | | {TIFFTAG_EP_EXPOSURETIME, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP ExposureTime", NULL}, /*N=1 or 2 */ |
310 | | {TIFFTAG_EP_FNUMBER, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP FNumber", NULL}, |
311 | | {TIFFTAG_EP_EXPOSUREPROGRAM, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP ExposureProgram", NULL}, |
312 | | {TIFFTAG_EP_SPECTRALSENSITIVITY, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP SpectralSensitivity", NULL}, |
313 | | {TIFFTAG_EP_ISOSPEEDRATINGS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP ISOSpeedRatings", NULL}, |
314 | | {TIFFTAG_EP_OECF, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP OptoelectricConversionFactor", NULL}, |
315 | | {TIFFTAG_EP_DATETIMEORIGINAL, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP DateTimeOriginal", NULL}, |
316 | | {TIFFTAG_EP_COMPRESSEDBITSPERPIXEL, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP CompressedBitsPerPixel", NULL}, |
317 | | {TIFFTAG_EP_SHUTTERSPEEDVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP ShutterSpeedValue", NULL}, |
318 | | {TIFFTAG_EP_APERTUREVALUE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP ApertureValue", NULL}, |
319 | | {TIFFTAG_EP_BRIGHTNESSVALUE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP BrightnessValue", NULL}, |
320 | | {TIFFTAG_EP_EXPOSUREBIASVALUE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP ExposureBiasValue", NULL}, /*N=1 or 2 */ |
321 | | {TIFFTAG_EP_MAXAPERTUREVALUE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP MaxApertureValue", NULL}, |
322 | | {TIFFTAG_EP_SUBJECTDISTANCE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP SubjectDistance", NULL}, |
323 | | {TIFFTAG_EP_METERINGMODE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP MeteringMode", NULL}, |
324 | | {TIFFTAG_EP_LIGHTSOURCE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP LightSource", NULL}, |
325 | | {TIFFTAG_EP_FLASH, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP Flash", NULL}, |
326 | | {TIFFTAG_EP_FOCALLENGTH, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP FocalLength", NULL}, |
327 | | {TIFFTAG_EP_SUBJECTLOCATION, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP SubjectLocation", NULL}, |
328 | | /* end TIFF/EP tags */ |
329 | | #endif |
330 | | /* begin TIFF/FX tags */ |
331 | | {TIFFTAG_INDEXED, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Indexed", NULL}, |
332 | | {TIFFTAG_GLOBALPARAMETERSIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "GlobalParametersIFD", NULL}, |
333 | | {TIFFTAG_PROFILETYPE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ProfileType", NULL}, |
334 | | {TIFFTAG_FAXPROFILE, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FaxProfile", NULL}, |
335 | | {TIFFTAG_CODINGMETHODS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CodingMethods", NULL}, |
336 | | {TIFFTAG_VERSIONYEAR, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "VersionYear", NULL}, |
337 | | {TIFFTAG_MODENUMBER, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ModeNumber", NULL}, |
338 | | {TIFFTAG_DECODE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "Decode", NULL}, |
339 | | {TIFFTAG_IMAGEBASECOLOR, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ImageBaseColor", NULL}, |
340 | | {TIFFTAG_T82OPTIONS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "T82Options", NULL}, |
341 | | {TIFFTAG_STRIPROWCOUNTS, -1, -1, TIFF_LONG, 0, TIFF_SETGET_C16_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "StripRowCounts", NULL}, |
342 | | {TIFFTAG_IMAGELAYER, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageLayer", NULL}, |
343 | | /* end TIFF/FX tags */ |
344 | | /* begin pseudo tags */ |
345 | | }; |
346 | | |
347 | | /* |
348 | | * EXIF tags (Version 2.31, July 2016 plus version 2.32 May 2019) |
349 | | */ |
350 | | static const TIFFField exifFields[] = { |
351 | | {EXIFTAG_EXPOSURETIME, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureTime", NULL}, |
352 | | {EXIFTAG_FNUMBER, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FNumber", NULL}, |
353 | | {EXIFTAG_EXPOSUREPROGRAM, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureProgram", NULL}, |
354 | | {EXIFTAG_SPECTRALSENSITIVITY, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SpectralSensitivity", NULL}, |
355 | | /* After EXIF 2.2.1 ISOSpeedRatings is named PhotographicSensitivity. In addition, while "Count=Any", only 1 count should be used. */ |
356 | | {EXIFTAG_ISOSPEEDRATINGS, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ISOSpeedRatings", NULL}, |
357 | | {EXIFTAG_OECF, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "OptoelectricConversionFactor", NULL}, |
358 | | {EXIFTAG_SENSITIVITYTYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SensitivityType", NULL}, |
359 | | {EXIFTAG_STANDARDOUTPUTSENSITIVITY, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "StandardOutputSensitivity", NULL}, |
360 | | {EXIFTAG_RECOMMENDEDEXPOSUREINDEX, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "RecommendedExposureIndex", NULL}, |
361 | | {EXIFTAG_ISOSPEED, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ISOSpeed", NULL}, |
362 | | {EXIFTAG_ISOSPEEDLATITUDEYYY, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ISOSpeedLatitudeyyy", NULL}, |
363 | | {EXIFTAG_ISOSPEEDLATITUDEZZZ, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ISOSpeedLatitudezzz", NULL}, |
364 | | {EXIFTAG_EXIFVERSION, 4, 4, TIFF_UNDEFINED, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExifVersion", NULL}, |
365 | | {EXIFTAG_DATETIMEORIGINAL, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DateTimeOriginal", NULL}, |
366 | | {EXIFTAG_DATETIMEDIGITIZED, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DateTimeDigitized", NULL}, |
367 | | {EXIFTAG_OFFSETTIME, 7, 7, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OffsetTime", NULL}, |
368 | | {EXIFTAG_OFFSETTIMEORIGINAL, 7, 7, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OffsetTimeOriginal", NULL}, |
369 | | {EXIFTAG_OFFSETTIMEDIGITIZED, 7, 7, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OffsetTimeDigitized", NULL}, |
370 | | {EXIFTAG_COMPONENTSCONFIGURATION, 4, 4, TIFF_UNDEFINED, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ComponentsConfiguration", NULL}, |
371 | | {EXIFTAG_COMPRESSEDBITSPERPIXEL, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CompressedBitsPerPixel", NULL}, |
372 | | {EXIFTAG_SHUTTERSPEEDVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ShutterSpeedValue", NULL}, |
373 | | {EXIFTAG_APERTUREVALUE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ApertureValue", NULL}, |
374 | | {EXIFTAG_BRIGHTNESSVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BrightnessValue", NULL}, |
375 | | {EXIFTAG_EXPOSUREBIASVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureBiasValue", NULL}, |
376 | | {EXIFTAG_MAXAPERTUREVALUE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MaxApertureValue", NULL}, |
377 | | /*--: EXIFTAG_SUBJECTDISTANCE: LibTiff returns value of "-1" if numerator equals 4294967295 (0xFFFFFFFF) to indicate infinite distance! |
378 | | * However, there are two other EXIF tags where numerator indicates a special value and six other cases where the denominator indicates special values, |
379 | | * which are not treated within LibTiff!! */ |
380 | | {EXIFTAG_SUBJECTDISTANCE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubjectDistance", NULL}, |
381 | | {EXIFTAG_METERINGMODE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MeteringMode", NULL}, |
382 | | {EXIFTAG_LIGHTSOURCE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LightSource", NULL}, |
383 | | {EXIFTAG_FLASH, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Flash", NULL}, |
384 | | {EXIFTAG_FOCALLENGTH, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FocalLength", NULL}, |
385 | | {EXIFTAG_SUBJECTAREA, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "SubjectArea", NULL}, |
386 | | {EXIFTAG_MAKERNOTE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "MakerNote", NULL}, |
387 | | {EXIFTAG_USERCOMMENT, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "UserComment", NULL}, |
388 | | {EXIFTAG_SUBSECTIME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubSecTime", NULL}, |
389 | | {EXIFTAG_SUBSECTIMEORIGINAL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubSecTimeOriginal", NULL}, |
390 | | {EXIFTAG_SUBSECTIMEDIGITIZED, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubSecTimeDigitized", NULL}, |
391 | | {EXIFTAG_TEMPERATURE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Temperature", NULL}, |
392 | | {EXIFTAG_HUMIDITY, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Humidity", NULL}, |
393 | | {EXIFTAG_PRESSURE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Pressure", NULL}, |
394 | | {EXIFTAG_WATERDEPTH, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "WaterDepth", NULL}, |
395 | | {EXIFTAG_ACCELERATION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Acceleration", NULL}, |
396 | | {EXIFTAG_CAMERAELEVATIONANGLE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CameraElevationAngle", NULL}, |
397 | | {EXIFTAG_FLASHPIXVERSION, 4, 4, TIFF_UNDEFINED, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FlashpixVersion", NULL}, |
398 | | {EXIFTAG_COLORSPACE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ColorSpace", NULL}, |
399 | | {EXIFTAG_PIXELXDIMENSION, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PixelXDimension", NULL}, |
400 | | {EXIFTAG_PIXELYDIMENSION, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PixelYDimension", NULL}, |
401 | | {EXIFTAG_RELATEDSOUNDFILE, 13, 13, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "RelatedSoundFile", NULL}, |
402 | | {EXIFTAG_FLASHENERGY, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FlashEnergy", NULL}, |
403 | | {EXIFTAG_SPATIALFREQUENCYRESPONSE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "SpatialFrequencyResponse", NULL}, |
404 | | {EXIFTAG_FOCALPLANEXRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FocalPlaneXResolution", NULL}, |
405 | | {EXIFTAG_FOCALPLANEYRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FocalPlaneYResolution", NULL}, |
406 | | {EXIFTAG_FOCALPLANERESOLUTIONUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FocalPlaneResolutionUnit", NULL}, |
407 | | {EXIFTAG_SUBJECTLOCATION, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubjectLocation", NULL}, |
408 | | {EXIFTAG_EXPOSUREINDEX, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureIndex", NULL}, |
409 | | {EXIFTAG_SENSINGMETHOD, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SensingMethod", NULL}, |
410 | | {EXIFTAG_FILESOURCE, 1, 1, TIFF_UNDEFINED, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FileSource", NULL}, |
411 | | {EXIFTAG_SCENETYPE, 1, 1, TIFF_UNDEFINED, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SceneType", NULL}, |
412 | | {EXIFTAG_CFAPATTERN, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CFAPattern", NULL}, |
413 | | {EXIFTAG_CUSTOMRENDERED, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CustomRendered", NULL}, |
414 | | {EXIFTAG_EXPOSUREMODE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureMode", NULL}, |
415 | | {EXIFTAG_WHITEBALANCE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "WhiteBalance", NULL}, |
416 | | {EXIFTAG_DIGITALZOOMRATIO, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DigitalZoomRatio", NULL}, |
417 | | {EXIFTAG_FOCALLENGTHIN35MMFILM, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FocalLengthIn35mmFilm", NULL}, |
418 | | {EXIFTAG_SCENECAPTURETYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SceneCaptureType", NULL}, |
419 | | {EXIFTAG_GAINCONTROL, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "GainControl", NULL}, |
420 | | {EXIFTAG_CONTRAST, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Contrast", NULL}, |
421 | | {EXIFTAG_SATURATION, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Saturation", NULL}, |
422 | | {EXIFTAG_SHARPNESS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Sharpness", NULL}, |
423 | | {EXIFTAG_DEVICESETTINGDESCRIPTION, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "DeviceSettingDescription", NULL}, |
424 | | {EXIFTAG_SUBJECTDISTANCERANGE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubjectDistanceRange", NULL}, |
425 | | {EXIFTAG_IMAGEUNIQUEID, 33, 33, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageUniqueID", NULL}, |
426 | | {EXIFTAG_CAMERAOWNERNAME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CameraOwnerName", NULL}, |
427 | | {EXIFTAG_BODYSERIALNUMBER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BodySerialNumber", NULL}, |
428 | | {EXIFTAG_LENSSPECIFICATION, 4, 4, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LensSpecification", NULL}, |
429 | | {EXIFTAG_LENSMAKE, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LensMake", NULL}, |
430 | | {EXIFTAG_LENSMODEL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LensModel", NULL}, |
431 | | {EXIFTAG_LENSSERIALNUMBER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LensSerialNumber", NULL}, |
432 | | {EXIFTAG_GAMMA, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Gamma", NULL}, |
433 | | {EXIFTAG_COMPOSITEIMAGE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CompositeImage", NULL}, |
434 | | {EXIFTAG_SOURCEIMAGENUMBEROFCOMPOSITEIMAGE, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SourceImageNumberOfCompositeImage", NULL}, |
435 | | {EXIFTAG_SOURCEEXPOSURETIMESOFCOMPOSITEIMAGE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, |
436 | | "SourceExposureTimesOfCompositeImage", NULL}}; |
437 | | /* |
438 | | * EXIF-GPS tags (Version 2.31, July 2016; nothing changed for version 2.32 May |
439 | | * 2019) |
440 | | */ |
441 | | |
442 | | static const TIFFField gpsFields[] = { |
443 | | /* For the GPS tag definitions in gpsFields[] the standard definition for Rationals is TIFF_SETGET_DOUBLE and TIFF_SETGET_C0_FLOAT. |
444 | | *-- ATTENTION: After the upgrade with Rational2Double, the GPSTAG values can now be written and also read in double precision! |
445 | | * In order to achieve double precision for GPS tags: Standard definitions for GPSTAG is kept to TIFF_SETGET_DOUBLE |
446 | | * and TIFF_SETGET_C0_FLOAT is changed to TIFF_SETGET_C0_DOUBLE. |
447 | | */ |
448 | | {GPSTAG_VERSIONID, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UINT8, FIELD_CUSTOM, 1, 0, "VersionID", NULL}, |
449 | | {GPSTAG_LATITUDEREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LatitudeRef", NULL}, |
450 | | {GPSTAG_LATITUDE, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Latitude", NULL}, |
451 | | {GPSTAG_LONGITUDEREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LongitudeRef", NULL}, |
452 | | {GPSTAG_LONGITUDE, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Longitude", NULL}, |
453 | | {GPSTAG_ALTITUDEREF, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "AltitudeRef", NULL}, |
454 | | {GPSTAG_ALTITUDE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Altitude", NULL}, |
455 | | {GPSTAG_TIMESTAMP, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TimeStamp", NULL}, |
456 | | {GPSTAG_SATELLITES, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Satellites", NULL}, |
457 | | {GPSTAG_STATUS, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Status", NULL}, |
458 | | {GPSTAG_MEASUREMODE, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MeasureMode", NULL}, |
459 | | {GPSTAG_DOP, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DOP", NULL}, |
460 | | {GPSTAG_SPEEDREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SpeedRef", NULL}, |
461 | | {GPSTAG_SPEED, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Speed", NULL}, |
462 | | {GPSTAG_TRACKREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TrackRef", NULL}, |
463 | | {GPSTAG_TRACK, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Track", NULL}, |
464 | | {GPSTAG_IMGDIRECTIONREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImgDirectionRef", NULL}, |
465 | | {GPSTAG_IMGDIRECTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImgDirection", NULL}, |
466 | | {GPSTAG_MAPDATUM, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MapDatum", NULL}, |
467 | | {GPSTAG_DESTLATITUDEREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestLatitudeRef", NULL}, |
468 | | {GPSTAG_DESTLATITUDE, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestLatitude", NULL}, |
469 | | {GPSTAG_DESTLONGITUDEREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestLongitudeRef", NULL}, |
470 | | {GPSTAG_DESTLONGITUDE, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestLongitude", NULL}, |
471 | | {GPSTAG_DESTBEARINGREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestBearingRef", NULL}, |
472 | | {GPSTAG_DESTBEARING, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestBearing", NULL}, |
473 | | {GPSTAG_DESTDISTANCEREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestDistanceRef", NULL}, |
474 | | {GPSTAG_DESTDISTANCE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestDistance", NULL}, |
475 | | {GPSTAG_PROCESSINGMETHOD, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProcessingMethod", NULL}, |
476 | | {GPSTAG_AREAINFORMATION, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "AreaInformation", NULL}, |
477 | | {GPSTAG_DATESTAMP, 11, 11, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DateStamp", NULL}, |
478 | | {GPSTAG_DIFFERENTIAL, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Differential", NULL}, |
479 | | {GPSTAG_GPSHPOSITIONINGERROR, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "HorizontalPositioningError", NULL}}; |
480 | | /* clang-format on */ /* was off for better readability of tag comments */ |
481 | | |
482 | | static const TIFFFieldArray tiffFieldArray = { |
483 | | tfiatImage, 0, TIFFArrayCount(tiffFields), (TIFFField *)tiffFields}; |
484 | | static const TIFFFieldArray exifFieldArray = { |
485 | | tfiatExif, 0, TIFFArrayCount(exifFields), (TIFFField *)exifFields}; |
486 | | static const TIFFFieldArray gpsFieldArray = { |
487 | | tfiatGps, 0, TIFFArrayCount(gpsFields), (TIFFField *)gpsFields}; |
488 | | |
489 | | /* |
490 | | * We have our own local lfind() equivalent to avoid subtle differences |
491 | | * in types passed to lfind() on different systems. |
492 | | */ |
493 | | |
494 | | static void *td_lfind(const void *key, const void *base, size_t *nmemb, |
495 | | size_t size, int (*compar)(const void *, const void *)) |
496 | 0 | { |
497 | 0 | char *element, *end; |
498 | |
|
499 | 0 | end = (char *)base + *nmemb * size; |
500 | 0 | for (element = (char *)base; element < end; element += size) |
501 | 0 | if (!compar(key, element)) /* key found */ |
502 | 0 | return element; |
503 | | |
504 | 0 | return NULL; |
505 | 0 | } |
506 | | |
507 | 0 | const TIFFFieldArray *_TIFFGetFields(void) { return (&tiffFieldArray); } |
508 | | |
509 | 0 | const TIFFFieldArray *_TIFFGetExifFields(void) { return (&exifFieldArray); } |
510 | | |
511 | 0 | const TIFFFieldArray *_TIFFGetGpsFields(void) { return (&gpsFieldArray); } |
512 | | |
513 | | void _TIFFSetupFields(TIFF *tif, const TIFFFieldArray *fieldarray) |
514 | 0 | { |
515 | 0 | if (tif->tif_fields && tif->tif_nfields > 0) |
516 | 0 | { |
517 | 0 | uint32_t i; |
518 | |
|
519 | 0 | for (i = 0; i < tif->tif_nfields; i++) |
520 | 0 | { |
521 | 0 | TIFFField *fld = tif->tif_fields[i]; |
522 | 0 | if (fld->field_name != NULL) |
523 | 0 | { |
524 | 0 | if (fld->field_bit == FIELD_CUSTOM && TIFFFieldIsAnonymous(fld)) |
525 | 0 | { |
526 | 0 | _TIFFfreeExt(tif, fld->field_name); |
527 | | /* caution: tif_fields[i] must not be the beginning of a |
528 | | * fields-array. Otherwise the following tags are also freed |
529 | | * with the first free(). |
530 | | */ |
531 | 0 | _TIFFfreeExt(tif, fld); |
532 | 0 | } |
533 | 0 | } |
534 | 0 | } |
535 | |
|
536 | 0 | _TIFFfreeExt(tif, tif->tif_fields); |
537 | 0 | tif->tif_fields = NULL; |
538 | 0 | tif->tif_nfields = 0; |
539 | 0 | } |
540 | 0 | if (!_TIFFMergeFields(tif, fieldarray->fields, fieldarray->count)) |
541 | 0 | { |
542 | 0 | TIFFErrorExtR(tif, "_TIFFSetupFields", "Setting up field info failed"); |
543 | 0 | } |
544 | 0 | } |
545 | | |
546 | | static int tagCompare(const void *a, const void *b) |
547 | 0 | { |
548 | 0 | const TIFFField *ta = *(const TIFFField **)a; |
549 | 0 | const TIFFField *tb = *(const TIFFField **)b; |
550 | | /* NB: be careful of return values for 16-bit platforms */ |
551 | 0 | if (ta->field_tag != tb->field_tag) |
552 | 0 | return (int)ta->field_tag - (int)tb->field_tag; |
553 | 0 | else |
554 | 0 | return (ta->field_type == TIFF_ANY) |
555 | 0 | ? 0 |
556 | 0 | : ((int)tb->field_type - (int)ta->field_type); |
557 | 0 | } |
558 | | |
559 | | static int tagNameCompare(const void *a, const void *b) |
560 | 0 | { |
561 | 0 | const TIFFField *ta = *(const TIFFField **)a; |
562 | 0 | const TIFFField *tb = *(const TIFFField **)b; |
563 | 0 | int ret = strcmp(ta->field_name, tb->field_name); |
564 | |
|
565 | 0 | if (ret) |
566 | 0 | return ret; |
567 | 0 | else |
568 | 0 | return (ta->field_type == TIFF_ANY) |
569 | 0 | ? 0 |
570 | 0 | : ((int)tb->field_type - (int)ta->field_type); |
571 | 0 | } |
572 | | |
573 | | int _TIFFMergeFields(TIFF *tif, const TIFFField info[], uint32_t n) |
574 | 0 | { |
575 | 0 | static const char module[] = "_TIFFMergeFields"; |
576 | 0 | static const char reason[] = "for fields array"; |
577 | | /* TIFFField** tp; */ |
578 | 0 | uint32_t i; |
579 | |
|
580 | 0 | tif->tif_foundfield = NULL; |
581 | |
|
582 | 0 | if (tif->tif_fields && tif->tif_nfields > 0) |
583 | 0 | { |
584 | 0 | tif->tif_fields = (TIFFField **)_TIFFCheckRealloc( |
585 | 0 | tif, tif->tif_fields, (tif->tif_nfields + n), sizeof(TIFFField *), |
586 | 0 | reason); |
587 | 0 | } |
588 | 0 | else |
589 | 0 | { |
590 | 0 | tif->tif_fields = |
591 | 0 | (TIFFField **)_TIFFCheckMalloc(tif, n, sizeof(TIFFField *), reason); |
592 | 0 | } |
593 | 0 | if (!tif->tif_fields) |
594 | 0 | { |
595 | 0 | TIFFErrorExtR(tif, module, "Failed to allocate fields array"); |
596 | 0 | return 0; |
597 | 0 | } |
598 | | |
599 | | /* tp = tif->tif_fields + tif->tif_nfields; */ |
600 | 0 | for (i = 0; i < n; i++) |
601 | 0 | { |
602 | 0 | const TIFFField *fip = TIFFFindField(tif, info[i].field_tag, TIFF_ANY); |
603 | | |
604 | | /* only add definitions that aren't already present */ |
605 | 0 | if (!fip) |
606 | 0 | { |
607 | 0 | tif->tif_fields[tif->tif_nfields] = (TIFFField *)(info + i); |
608 | 0 | tif->tif_nfields++; |
609 | 0 | } |
610 | 0 | } |
611 | | |
612 | | /* Sort the field info by tag number */ |
613 | 0 | qsort(tif->tif_fields, tif->tif_nfields, sizeof(TIFFField *), tagCompare); |
614 | |
|
615 | 0 | return n; |
616 | 0 | } |
617 | | |
618 | | void _TIFFPrintFieldInfo(TIFF *tif, FILE *fd) |
619 | 0 | { |
620 | 0 | uint32_t i; |
621 | |
|
622 | 0 | fprintf(fd, "%s: \n", tif->tif_name); |
623 | 0 | for (i = 0; i < tif->tif_nfields; i++) |
624 | 0 | { |
625 | 0 | const TIFFField *fip = tif->tif_fields[i]; |
626 | 0 | fprintf(fd, "field[%2d] %5lu, %2d, %2d, %d, %2d, %5s, %5s, %s\n", |
627 | 0 | (int)i, (unsigned long)fip->field_tag, fip->field_readcount, |
628 | 0 | fip->field_writecount, fip->field_type, fip->field_bit, |
629 | 0 | fip->field_oktochange ? "TRUE" : "FALSE", |
630 | 0 | fip->field_passcount ? "TRUE" : "FALSE", fip->field_name); |
631 | 0 | } |
632 | 0 | } |
633 | | |
634 | | /* |
635 | | * Return size of TIFFDataType within TIFF-file in bytes |
636 | | */ |
637 | | int TIFFDataWidth(TIFFDataType type) |
638 | 0 | { |
639 | 0 | switch (type) |
640 | 0 | { |
641 | 0 | case 0: /* nothing */ |
642 | 0 | case TIFF_BYTE: |
643 | 0 | case TIFF_ASCII: |
644 | 0 | case TIFF_SBYTE: |
645 | 0 | case TIFF_UNDEFINED: |
646 | 0 | return 1; |
647 | 0 | case TIFF_SHORT: |
648 | 0 | case TIFF_SSHORT: |
649 | 0 | return 2; |
650 | 0 | case TIFF_LONG: |
651 | 0 | case TIFF_SLONG: |
652 | 0 | case TIFF_FLOAT: |
653 | 0 | case TIFF_IFD: |
654 | 0 | return 4; |
655 | 0 | case TIFF_RATIONAL: |
656 | 0 | case TIFF_SRATIONAL: |
657 | 0 | case TIFF_DOUBLE: |
658 | 0 | case TIFF_LONG8: |
659 | 0 | case TIFF_SLONG8: |
660 | 0 | case TIFF_IFD8: |
661 | 0 | return 8; |
662 | 0 | default: |
663 | 0 | return 0; /* will return 0 for unknown types */ |
664 | 0 | } |
665 | 0 | } |
666 | | |
667 | | /* |
668 | | * Return internal storage size of TIFFSetGetFieldType in bytes. |
669 | | * TIFFSetField() and TIFFGetField() have to provide the parameter accordingly. |
670 | | * Replaces internal functions _TIFFDataSize() and _TIFFSetGetFieldSize() |
671 | | * with now extern available function TIFFFieldSetGetSize(). |
672 | | */ |
673 | | int TIFFFieldSetGetSize(const TIFFField *fip) |
674 | 0 | { |
675 | | /* |
676 | | * TIFFSetField() and TIFFGetField() must provide the parameter accordingly |
677 | | * to the definition of "set_field_type" of the tag definition in |
678 | | * dir_info.c. This function returns the data size for that purpose. |
679 | | * |
680 | | * Furthermore, this data size is also used for the internal storage, |
681 | | * even for TIFF_RATIONAL values for FIELD_CUSTOM, which are stored |
682 | | * internally as 4-byte float, but some of them should be stored internally |
683 | | * as 8-byte double, depending on the "set_field_type" _FLOAT_ or _DOUBLE_. |
684 | | */ |
685 | 0 | if (fip == NULL) |
686 | 0 | return 0; |
687 | | |
688 | 0 | switch (fip->set_field_type) |
689 | 0 | { |
690 | 0 | case TIFF_SETGET_UNDEFINED: |
691 | 0 | case TIFF_SETGET_ASCII: |
692 | 0 | case TIFF_SETGET_C0_ASCII: |
693 | 0 | case TIFF_SETGET_C16_ASCII: |
694 | 0 | case TIFF_SETGET_C32_ASCII: |
695 | 0 | case TIFF_SETGET_OTHER: |
696 | 0 | return 1; |
697 | 0 | case TIFF_SETGET_UINT8: |
698 | 0 | case TIFF_SETGET_SINT8: |
699 | 0 | case TIFF_SETGET_C0_UINT8: |
700 | 0 | case TIFF_SETGET_C0_SINT8: |
701 | 0 | case TIFF_SETGET_C16_UINT8: |
702 | 0 | case TIFF_SETGET_C16_SINT8: |
703 | 0 | case TIFF_SETGET_C32_UINT8: |
704 | 0 | case TIFF_SETGET_C32_SINT8: |
705 | 0 | return 1; |
706 | 0 | case TIFF_SETGET_UINT16: |
707 | 0 | case TIFF_SETGET_SINT16: |
708 | 0 | case TIFF_SETGET_C0_UINT16: |
709 | 0 | case TIFF_SETGET_C0_SINT16: |
710 | 0 | case TIFF_SETGET_C16_UINT16: |
711 | 0 | case TIFF_SETGET_C16_SINT16: |
712 | 0 | case TIFF_SETGET_C32_UINT16: |
713 | 0 | case TIFF_SETGET_C32_SINT16: |
714 | 0 | return 2; |
715 | 0 | case TIFF_SETGET_INT: |
716 | 0 | case TIFF_SETGET_UINT32: |
717 | 0 | case TIFF_SETGET_SINT32: |
718 | 0 | case TIFF_SETGET_FLOAT: |
719 | 0 | case TIFF_SETGET_UINT16_PAIR: |
720 | 0 | case TIFF_SETGET_C0_UINT32: |
721 | 0 | case TIFF_SETGET_C0_SINT32: |
722 | 0 | case TIFF_SETGET_C0_FLOAT: |
723 | 0 | case TIFF_SETGET_C16_UINT32: |
724 | 0 | case TIFF_SETGET_C16_SINT32: |
725 | 0 | case TIFF_SETGET_C16_FLOAT: |
726 | 0 | case TIFF_SETGET_C32_UINT32: |
727 | 0 | case TIFF_SETGET_C32_SINT32: |
728 | 0 | case TIFF_SETGET_C32_FLOAT: |
729 | 0 | return 4; |
730 | 0 | case TIFF_SETGET_UINT64: |
731 | 0 | case TIFF_SETGET_SINT64: |
732 | 0 | case TIFF_SETGET_DOUBLE: |
733 | 0 | case TIFF_SETGET_IFD8: |
734 | 0 | case TIFF_SETGET_C0_UINT64: |
735 | 0 | case TIFF_SETGET_C0_SINT64: |
736 | 0 | case TIFF_SETGET_C0_DOUBLE: |
737 | 0 | case TIFF_SETGET_C0_IFD8: |
738 | 0 | case TIFF_SETGET_C16_UINT64: |
739 | 0 | case TIFF_SETGET_C16_SINT64: |
740 | 0 | case TIFF_SETGET_C16_DOUBLE: |
741 | 0 | case TIFF_SETGET_C16_IFD8: |
742 | 0 | case TIFF_SETGET_C32_UINT64: |
743 | 0 | case TIFF_SETGET_C32_SINT64: |
744 | 0 | case TIFF_SETGET_C32_DOUBLE: |
745 | 0 | case TIFF_SETGET_C32_IFD8: |
746 | 0 | return 8; |
747 | 0 | default: |
748 | 0 | return 0; |
749 | 0 | } |
750 | 0 | } /*-- TIFFFieldSetGetSize() --- */ |
751 | | |
752 | | /* |
753 | | * Return size of count parameter of TIFFSetField() and TIFFGetField() |
754 | | * and also if it is required: 0=none, 2=uint16_t, 4=uint32_t |
755 | | */ |
756 | | int TIFFFieldSetGetCountSize(const TIFFField *fip) |
757 | 0 | { |
758 | 0 | if (fip == NULL) |
759 | 0 | return 0; |
760 | | |
761 | 0 | switch (fip->set_field_type) |
762 | 0 | { |
763 | 0 | case TIFF_SETGET_C16_ASCII: |
764 | 0 | case TIFF_SETGET_C16_UINT8: |
765 | 0 | case TIFF_SETGET_C16_SINT8: |
766 | 0 | case TIFF_SETGET_C16_UINT16: |
767 | 0 | case TIFF_SETGET_C16_SINT16: |
768 | 0 | case TIFF_SETGET_C16_UINT32: |
769 | 0 | case TIFF_SETGET_C16_SINT32: |
770 | 0 | case TIFF_SETGET_C16_FLOAT: |
771 | 0 | case TIFF_SETGET_C16_UINT64: |
772 | 0 | case TIFF_SETGET_C16_SINT64: |
773 | 0 | case TIFF_SETGET_C16_DOUBLE: |
774 | 0 | case TIFF_SETGET_C16_IFD8: |
775 | 0 | return 2; |
776 | 0 | case TIFF_SETGET_C32_ASCII: |
777 | 0 | case TIFF_SETGET_C32_UINT8: |
778 | 0 | case TIFF_SETGET_C32_SINT8: |
779 | 0 | case TIFF_SETGET_C32_UINT16: |
780 | 0 | case TIFF_SETGET_C32_SINT16: |
781 | 0 | case TIFF_SETGET_C32_UINT32: |
782 | 0 | case TIFF_SETGET_C32_SINT32: |
783 | 0 | case TIFF_SETGET_C32_FLOAT: |
784 | 0 | case TIFF_SETGET_C32_UINT64: |
785 | 0 | case TIFF_SETGET_C32_SINT64: |
786 | 0 | case TIFF_SETGET_C32_DOUBLE: |
787 | 0 | case TIFF_SETGET_C32_IFD8: |
788 | 0 | return 4; |
789 | 0 | default: |
790 | 0 | return 0; |
791 | 0 | } |
792 | 0 | } /*-- TIFFFieldSetGetCountSize() --- */ |
793 | | |
794 | | const TIFFField *TIFFFindField(TIFF *tif, uint32_t tag, TIFFDataType dt) |
795 | 0 | { |
796 | 0 | TIFFField key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0, 0, 0, NULL, NULL}; |
797 | 0 | TIFFField *pkey = &key; |
798 | 0 | const TIFFField **ret; |
799 | 0 | if (tif->tif_foundfield && tif->tif_foundfield->field_tag == tag && |
800 | 0 | (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type)) |
801 | 0 | return tif->tif_foundfield; |
802 | | |
803 | | /* If we are invoked with no field information, then just return. */ |
804 | 0 | if (!tif->tif_fields) |
805 | 0 | return NULL; |
806 | | |
807 | | /* NB: use sorted search (e.g. binary search) */ |
808 | | |
809 | 0 | key.field_tag = tag; |
810 | 0 | key.field_type = dt; |
811 | |
|
812 | 0 | ret = (const TIFFField **)bsearch(&pkey, tif->tif_fields, tif->tif_nfields, |
813 | 0 | sizeof(TIFFField *), tagCompare); |
814 | 0 | return tif->tif_foundfield = (ret ? *ret : NULL); |
815 | 0 | } |
816 | | |
817 | | static const TIFFField *_TIFFFindFieldByName(TIFF *tif, const char *field_name, |
818 | | TIFFDataType dt) |
819 | 0 | { |
820 | 0 | TIFFField key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0, 0, 0, NULL, NULL}; |
821 | 0 | TIFFField *pkey = &key; |
822 | 0 | const TIFFField **ret; |
823 | 0 | if (tif->tif_foundfield && |
824 | 0 | streq(tif->tif_foundfield->field_name, field_name) && |
825 | 0 | (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type)) |
826 | 0 | return (tif->tif_foundfield); |
827 | | |
828 | | /* If we are invoked with no field information, then just return. */ |
829 | 0 | if (!tif->tif_fields) |
830 | 0 | return NULL; |
831 | | |
832 | | /* NB: use linear search since list is sorted by key#, not name */ |
833 | | |
834 | 0 | key.field_name = (char *)field_name; |
835 | 0 | key.field_type = dt; |
836 | |
|
837 | 0 | ret = |
838 | 0 | (const TIFFField **)td_lfind(&pkey, tif->tif_fields, &tif->tif_nfields, |
839 | 0 | sizeof(TIFFField *), tagNameCompare); |
840 | |
|
841 | 0 | return tif->tif_foundfield = (ret ? *ret : NULL); |
842 | 0 | } |
843 | | |
844 | | const TIFFField *TIFFFieldWithTag(TIFF *tif, uint32_t tag) |
845 | 0 | { |
846 | 0 | const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY); |
847 | 0 | if (!fip) |
848 | 0 | { |
849 | 0 | TIFFWarningExtR(tif, "TIFFFieldWithTag", "Warning, unknown tag 0x%x", |
850 | 0 | (unsigned int)tag); |
851 | 0 | } |
852 | 0 | return (fip); |
853 | 0 | } |
854 | | |
855 | | const TIFFField *TIFFFieldWithName(TIFF *tif, const char *field_name) |
856 | 0 | { |
857 | 0 | const TIFFField *fip = _TIFFFindFieldByName(tif, field_name, TIFF_ANY); |
858 | 0 | if (!fip) |
859 | 0 | { |
860 | 0 | TIFFWarningExtR(tif, "TIFFFieldWithName", "Warning, unknown tag %s", |
861 | 0 | field_name); |
862 | 0 | } |
863 | 0 | return (fip); |
864 | 0 | } |
865 | | |
866 | 0 | uint32_t TIFFFieldTag(const TIFFField *fip) { return fip->field_tag; } |
867 | | |
868 | 0 | const char *TIFFFieldName(const TIFFField *fip) { return fip->field_name; } |
869 | | |
870 | 0 | TIFFDataType TIFFFieldDataType(const TIFFField *fip) { return fip->field_type; } |
871 | | |
872 | 0 | int TIFFFieldPassCount(const TIFFField *fip) { return fip->field_passcount; } |
873 | | |
874 | 0 | int TIFFFieldReadCount(const TIFFField *fip) { return fip->field_readcount; } |
875 | | |
876 | 0 | int TIFFFieldWriteCount(const TIFFField *fip) { return fip->field_writecount; } |
877 | | |
878 | 0 | int TIFFFieldIsAnonymous(const TIFFField *fip) { return fip->field_anonymous; } |
879 | | |
880 | | const TIFFField *_TIFFFindOrRegisterField(TIFF *tif, uint32_t tag, |
881 | | TIFFDataType dt) |
882 | | |
883 | 0 | { |
884 | 0 | const TIFFField *fld; |
885 | |
|
886 | 0 | fld = TIFFFindField(tif, tag, dt); |
887 | 0 | if (fld == NULL) |
888 | 0 | { |
889 | 0 | fld = _TIFFCreateAnonField(tif, tag, dt); |
890 | 0 | if (fld == NULL || !_TIFFMergeFields(tif, fld, 1)) |
891 | 0 | return NULL; |
892 | 0 | } |
893 | | |
894 | 0 | return fld; |
895 | 0 | } |
896 | | |
897 | | TIFFField *_TIFFCreateAnonField(TIFF *tif, uint32_t tag, |
898 | | TIFFDataType field_type) |
899 | 0 | { |
900 | 0 | TIFFField *fld; |
901 | 0 | (void)tif; |
902 | |
|
903 | 0 | fld = (TIFFField *)_TIFFmallocExt(tif, sizeof(TIFFField)); |
904 | 0 | if (fld == NULL) |
905 | 0 | return NULL; |
906 | 0 | _TIFFmemset(fld, 0, sizeof(TIFFField)); |
907 | |
|
908 | 0 | fld->field_tag = tag; |
909 | 0 | fld->field_readcount = TIFF_VARIABLE2; |
910 | 0 | fld->field_writecount = TIFF_VARIABLE2; |
911 | 0 | fld->field_type = field_type; |
912 | 0 | fld->field_anonymous = |
913 | 0 | 1; /* indicate that this is an anonymous / unknown tag */ |
914 | 0 | switch (field_type) |
915 | 0 | { |
916 | 0 | case TIFF_BYTE: |
917 | 0 | case TIFF_UNDEFINED: |
918 | 0 | fld->set_field_type = TIFF_SETGET_C32_UINT8; |
919 | 0 | fld->get_field_type = TIFF_SETGET_C32_UINT8; |
920 | 0 | break; |
921 | 0 | case TIFF_ASCII: |
922 | 0 | fld->set_field_type = TIFF_SETGET_C32_ASCII; |
923 | 0 | fld->get_field_type = TIFF_SETGET_C32_ASCII; |
924 | 0 | break; |
925 | 0 | case TIFF_SHORT: |
926 | 0 | fld->set_field_type = TIFF_SETGET_C32_UINT16; |
927 | 0 | fld->get_field_type = TIFF_SETGET_C32_UINT16; |
928 | 0 | break; |
929 | 0 | case TIFF_LONG: |
930 | 0 | fld->set_field_type = TIFF_SETGET_C32_UINT32; |
931 | 0 | fld->get_field_type = TIFF_SETGET_C32_UINT32; |
932 | 0 | break; |
933 | 0 | case TIFF_RATIONAL: |
934 | 0 | case TIFF_SRATIONAL: |
935 | 0 | case TIFF_FLOAT: |
936 | 0 | fld->set_field_type = TIFF_SETGET_C32_FLOAT; |
937 | 0 | fld->get_field_type = TIFF_SETGET_C32_FLOAT; |
938 | 0 | break; |
939 | 0 | case TIFF_SBYTE: |
940 | 0 | fld->set_field_type = TIFF_SETGET_C32_SINT8; |
941 | 0 | fld->get_field_type = TIFF_SETGET_C32_SINT8; |
942 | 0 | break; |
943 | 0 | case TIFF_SSHORT: |
944 | 0 | fld->set_field_type = TIFF_SETGET_C32_SINT16; |
945 | 0 | fld->get_field_type = TIFF_SETGET_C32_SINT16; |
946 | 0 | break; |
947 | 0 | case TIFF_SLONG: |
948 | 0 | fld->set_field_type = TIFF_SETGET_C32_SINT32; |
949 | 0 | fld->get_field_type = TIFF_SETGET_C32_SINT32; |
950 | 0 | break; |
951 | 0 | case TIFF_DOUBLE: |
952 | 0 | fld->set_field_type = TIFF_SETGET_C32_DOUBLE; |
953 | 0 | fld->get_field_type = TIFF_SETGET_C32_DOUBLE; |
954 | 0 | break; |
955 | 0 | case TIFF_IFD: |
956 | 0 | case TIFF_IFD8: |
957 | 0 | fld->set_field_type = TIFF_SETGET_C32_IFD8; |
958 | 0 | fld->get_field_type = TIFF_SETGET_C32_IFD8; |
959 | 0 | break; |
960 | 0 | case TIFF_LONG8: |
961 | 0 | fld->set_field_type = TIFF_SETGET_C32_UINT64; |
962 | 0 | fld->get_field_type = TIFF_SETGET_C32_UINT64; |
963 | 0 | break; |
964 | 0 | case TIFF_SLONG8: |
965 | 0 | fld->set_field_type = TIFF_SETGET_C32_SINT64; |
966 | 0 | fld->get_field_type = TIFF_SETGET_C32_SINT64; |
967 | 0 | break; |
968 | 0 | default: |
969 | 0 | fld->set_field_type = TIFF_SETGET_UNDEFINED; |
970 | 0 | fld->get_field_type = TIFF_SETGET_UNDEFINED; |
971 | 0 | break; |
972 | 0 | } |
973 | 0 | fld->field_bit = FIELD_CUSTOM; |
974 | 0 | fld->field_oktochange = TRUE; |
975 | 0 | fld->field_passcount = TRUE; |
976 | 0 | fld->field_name = (char *)_TIFFmallocExt(tif, 32); |
977 | 0 | if (fld->field_name == NULL) |
978 | 0 | { |
979 | 0 | _TIFFfreeExt(tif, fld); |
980 | 0 | return NULL; |
981 | 0 | } |
982 | 0 | fld->field_subfields = NULL; |
983 | | |
984 | | /* |
985 | | * note that this name is a special sign to TIFFClose() and |
986 | | * _TIFFSetupFields() to free the field |
987 | | * Update: |
988 | | * This special sign is replaced by fld->field_anonymous flag. |
989 | | */ |
990 | 0 | (void)snprintf(fld->field_name, 32, "Tag %d", (int)tag); |
991 | |
|
992 | 0 | return fld; |
993 | 0 | } |
994 | | |
995 | | /**************************************************************************** |
996 | | * O B S O L E T E D I N T E R F A C E S |
997 | | * |
998 | | * Don't use this stuff in your applications, it may be removed in the future |
999 | | * libtiff versions. |
1000 | | ****************************************************************************/ |
1001 | | |
1002 | | static TIFFSetGetFieldType _TIFFSetGetType(TIFFDataType type, short count, |
1003 | | unsigned char passcount) |
1004 | 0 | { |
1005 | 0 | if (type == TIFF_ASCII && count == TIFF_VARIABLE && passcount == 0) |
1006 | 0 | return TIFF_SETGET_ASCII; |
1007 | | |
1008 | 0 | else if (count == 1 && passcount == 0) |
1009 | 0 | { |
1010 | 0 | switch (type) |
1011 | 0 | { |
1012 | 0 | case TIFF_BYTE: |
1013 | 0 | case TIFF_UNDEFINED: |
1014 | 0 | return TIFF_SETGET_UINT8; |
1015 | 0 | case TIFF_ASCII: |
1016 | 0 | return TIFF_SETGET_ASCII; |
1017 | 0 | case TIFF_SHORT: |
1018 | 0 | return TIFF_SETGET_UINT16; |
1019 | 0 | case TIFF_LONG: |
1020 | 0 | return TIFF_SETGET_UINT32; |
1021 | 0 | case TIFF_RATIONAL: |
1022 | 0 | case TIFF_SRATIONAL: |
1023 | 0 | case TIFF_FLOAT: |
1024 | 0 | return TIFF_SETGET_FLOAT; |
1025 | 0 | case TIFF_SBYTE: |
1026 | 0 | return TIFF_SETGET_SINT8; |
1027 | 0 | case TIFF_SSHORT: |
1028 | 0 | return TIFF_SETGET_SINT16; |
1029 | 0 | case TIFF_SLONG: |
1030 | 0 | return TIFF_SETGET_SINT32; |
1031 | 0 | case TIFF_DOUBLE: |
1032 | 0 | return TIFF_SETGET_DOUBLE; |
1033 | 0 | case TIFF_IFD: |
1034 | 0 | case TIFF_IFD8: |
1035 | 0 | return TIFF_SETGET_IFD8; |
1036 | 0 | case TIFF_LONG8: |
1037 | 0 | return TIFF_SETGET_UINT64; |
1038 | 0 | case TIFF_SLONG8: |
1039 | 0 | return TIFF_SETGET_SINT64; |
1040 | 0 | default: |
1041 | 0 | return TIFF_SETGET_UNDEFINED; |
1042 | 0 | } |
1043 | 0 | } |
1044 | | |
1045 | 0 | else if (count >= 1 && passcount == 0) |
1046 | 0 | { |
1047 | 0 | switch (type) |
1048 | 0 | { |
1049 | 0 | case TIFF_BYTE: |
1050 | 0 | case TIFF_UNDEFINED: |
1051 | 0 | return TIFF_SETGET_C0_UINT8; |
1052 | 0 | case TIFF_ASCII: |
1053 | 0 | return TIFF_SETGET_C0_ASCII; |
1054 | 0 | case TIFF_SHORT: |
1055 | 0 | return TIFF_SETGET_C0_UINT16; |
1056 | 0 | case TIFF_LONG: |
1057 | 0 | return TIFF_SETGET_C0_UINT32; |
1058 | 0 | case TIFF_RATIONAL: |
1059 | 0 | case TIFF_SRATIONAL: |
1060 | 0 | case TIFF_FLOAT: |
1061 | 0 | return TIFF_SETGET_C0_FLOAT; |
1062 | 0 | case TIFF_SBYTE: |
1063 | 0 | return TIFF_SETGET_C0_SINT8; |
1064 | 0 | case TIFF_SSHORT: |
1065 | 0 | return TIFF_SETGET_C0_SINT16; |
1066 | 0 | case TIFF_SLONG: |
1067 | 0 | return TIFF_SETGET_C0_SINT32; |
1068 | 0 | case TIFF_DOUBLE: |
1069 | 0 | return TIFF_SETGET_C0_DOUBLE; |
1070 | 0 | case TIFF_IFD: |
1071 | 0 | case TIFF_IFD8: |
1072 | 0 | return TIFF_SETGET_C0_IFD8; |
1073 | 0 | case TIFF_LONG8: |
1074 | 0 | return TIFF_SETGET_C0_UINT64; |
1075 | 0 | case TIFF_SLONG8: |
1076 | 0 | return TIFF_SETGET_C0_SINT64; |
1077 | 0 | default: |
1078 | 0 | return TIFF_SETGET_UNDEFINED; |
1079 | 0 | } |
1080 | 0 | } |
1081 | | |
1082 | 0 | else if (count == TIFF_VARIABLE && passcount == 1) |
1083 | 0 | { |
1084 | 0 | switch (type) |
1085 | 0 | { |
1086 | 0 | case TIFF_BYTE: |
1087 | 0 | case TIFF_UNDEFINED: |
1088 | 0 | return TIFF_SETGET_C16_UINT8; |
1089 | 0 | case TIFF_ASCII: |
1090 | 0 | return TIFF_SETGET_C16_ASCII; |
1091 | 0 | case TIFF_SHORT: |
1092 | 0 | return TIFF_SETGET_C16_UINT16; |
1093 | 0 | case TIFF_LONG: |
1094 | 0 | return TIFF_SETGET_C16_UINT32; |
1095 | 0 | case TIFF_RATIONAL: |
1096 | 0 | case TIFF_SRATIONAL: |
1097 | 0 | case TIFF_FLOAT: |
1098 | 0 | return TIFF_SETGET_C16_FLOAT; |
1099 | 0 | case TIFF_SBYTE: |
1100 | 0 | return TIFF_SETGET_C16_SINT8; |
1101 | 0 | case TIFF_SSHORT: |
1102 | 0 | return TIFF_SETGET_C16_SINT16; |
1103 | 0 | case TIFF_SLONG: |
1104 | 0 | return TIFF_SETGET_C16_SINT32; |
1105 | 0 | case TIFF_DOUBLE: |
1106 | 0 | return TIFF_SETGET_C16_DOUBLE; |
1107 | 0 | case TIFF_IFD: |
1108 | 0 | case TIFF_IFD8: |
1109 | 0 | return TIFF_SETGET_C16_IFD8; |
1110 | 0 | case TIFF_LONG8: |
1111 | 0 | return TIFF_SETGET_C16_UINT64; |
1112 | 0 | case TIFF_SLONG8: |
1113 | 0 | return TIFF_SETGET_C16_SINT64; |
1114 | 0 | default: |
1115 | 0 | return TIFF_SETGET_UNDEFINED; |
1116 | 0 | } |
1117 | 0 | } |
1118 | | |
1119 | 0 | else if (count == TIFF_VARIABLE2 && passcount == 1) |
1120 | 0 | { |
1121 | 0 | switch (type) |
1122 | 0 | { |
1123 | 0 | case TIFF_BYTE: |
1124 | 0 | case TIFF_UNDEFINED: |
1125 | 0 | return TIFF_SETGET_C32_UINT8; |
1126 | 0 | case TIFF_ASCII: |
1127 | 0 | return TIFF_SETGET_C32_ASCII; |
1128 | 0 | case TIFF_SHORT: |
1129 | 0 | return TIFF_SETGET_C32_UINT16; |
1130 | 0 | case TIFF_LONG: |
1131 | 0 | return TIFF_SETGET_C32_UINT32; |
1132 | 0 | case TIFF_RATIONAL: |
1133 | 0 | case TIFF_SRATIONAL: |
1134 | 0 | case TIFF_FLOAT: |
1135 | 0 | return TIFF_SETGET_C32_FLOAT; |
1136 | 0 | case TIFF_SBYTE: |
1137 | 0 | return TIFF_SETGET_C32_SINT8; |
1138 | 0 | case TIFF_SSHORT: |
1139 | 0 | return TIFF_SETGET_C32_SINT16; |
1140 | 0 | case TIFF_SLONG: |
1141 | 0 | return TIFF_SETGET_C32_SINT32; |
1142 | 0 | case TIFF_DOUBLE: |
1143 | 0 | return TIFF_SETGET_C32_DOUBLE; |
1144 | 0 | case TIFF_IFD: |
1145 | 0 | case TIFF_IFD8: |
1146 | 0 | return TIFF_SETGET_C32_IFD8; |
1147 | 0 | case TIFF_LONG8: |
1148 | 0 | return TIFF_SETGET_C32_UINT64; |
1149 | 0 | case TIFF_SLONG8: |
1150 | 0 | return TIFF_SETGET_C32_SINT64; |
1151 | 0 | default: |
1152 | 0 | return TIFF_SETGET_UNDEFINED; |
1153 | 0 | } |
1154 | 0 | } |
1155 | | |
1156 | 0 | return TIFF_SETGET_UNDEFINED; |
1157 | 0 | } |
1158 | | |
1159 | | int TIFFMergeFieldInfo(TIFF *tif, const TIFFFieldInfo info[], uint32_t n) |
1160 | 0 | { |
1161 | 0 | static const char module[] = "TIFFMergeFieldInfo"; |
1162 | 0 | static const char reason[] = "for fields array"; |
1163 | 0 | TIFFField *tp; |
1164 | 0 | size_t nfields; |
1165 | 0 | uint32_t i; |
1166 | |
|
1167 | 0 | if (tif->tif_nfieldscompat > 0) |
1168 | 0 | { |
1169 | 0 | tif->tif_fieldscompat = (TIFFFieldArray *)_TIFFCheckRealloc( |
1170 | 0 | tif, tif->tif_fieldscompat, tif->tif_nfieldscompat + 1, |
1171 | 0 | sizeof(TIFFFieldArray), reason); |
1172 | 0 | } |
1173 | 0 | else |
1174 | 0 | { |
1175 | 0 | tif->tif_fieldscompat = (TIFFFieldArray *)_TIFFCheckMalloc( |
1176 | 0 | tif, 1, sizeof(TIFFFieldArray), reason); |
1177 | 0 | } |
1178 | 0 | if (!tif->tif_fieldscompat) |
1179 | 0 | { |
1180 | 0 | TIFFErrorExtR(tif, module, "Failed to allocate fields array"); |
1181 | 0 | return -1; |
1182 | 0 | } |
1183 | 0 | nfields = tif->tif_nfieldscompat++; |
1184 | |
|
1185 | 0 | tif->tif_fieldscompat[nfields].type = tfiatOther; |
1186 | 0 | tif->tif_fieldscompat[nfields].allocated_size = n; |
1187 | 0 | tif->tif_fieldscompat[nfields].count = n; |
1188 | 0 | tif->tif_fieldscompat[nfields].fields = |
1189 | 0 | (TIFFField *)_TIFFCheckMalloc(tif, n, sizeof(TIFFField), reason); |
1190 | 0 | if (!tif->tif_fieldscompat[nfields].fields) |
1191 | 0 | { |
1192 | 0 | TIFFErrorExtR(tif, module, "Failed to allocate fields array"); |
1193 | 0 | return -1; |
1194 | 0 | } |
1195 | | |
1196 | 0 | tp = tif->tif_fieldscompat[nfields].fields; |
1197 | 0 | for (i = 0; i < n; i++) |
1198 | 0 | { |
1199 | 0 | tp->field_tag = info[i].field_tag; |
1200 | 0 | if (info[i].field_readcount < TIFF_VARIABLE2 || |
1201 | 0 | info[i].field_readcount == 0 || |
1202 | 0 | info[i].field_writecount < TIFF_VARIABLE2 || |
1203 | 0 | info[i].field_writecount == 0) |
1204 | 0 | { |
1205 | | /* The fields (field_readcount) and (field_writecount) may use the |
1206 | | * values TIFF_VARIABLE (-1), TIFF_SPP (-2), TIFF_VARIABLE2 (-3). */ |
1207 | 0 | TIFFErrorExtR(tif, module, |
1208 | 0 | "The value of field_readcount and field_writecount " |
1209 | 0 | "must be greater than or equal to -3 and not zero."); |
1210 | 0 | return -1; |
1211 | 0 | } |
1212 | 0 | tp->field_readcount = info[i].field_readcount; |
1213 | 0 | tp->field_writecount = info[i].field_writecount; |
1214 | 0 | tp->field_type = info[i].field_type; |
1215 | 0 | tp->field_anonymous = 0; |
1216 | 0 | tp->set_field_type = |
1217 | 0 | _TIFFSetGetType(info[i].field_type, info[i].field_writecount, |
1218 | 0 | info[i].field_passcount); |
1219 | 0 | tp->get_field_type = |
1220 | 0 | _TIFFSetGetType(info[i].field_type, info[i].field_readcount, |
1221 | 0 | info[i].field_passcount); |
1222 | 0 | tp->field_bit = info[i].field_bit; |
1223 | 0 | tp->field_oktochange = info[i].field_oktochange; |
1224 | 0 | tp->field_passcount = info[i].field_passcount; |
1225 | 0 | if (info[i].field_name == NULL) |
1226 | 0 | { |
1227 | 0 | TIFFErrorExtR(tif, module, |
1228 | 0 | "Field_name of %d.th allocation tag %d is NULL", i, |
1229 | 0 | info[i].field_tag); |
1230 | 0 | return -1; |
1231 | 0 | } |
1232 | 0 | tp->field_name = info[i].field_name; |
1233 | 0 | tp->field_subfields = NULL; |
1234 | 0 | tp++; |
1235 | 0 | } |
1236 | | |
1237 | 0 | if (!_TIFFMergeFields(tif, tif->tif_fieldscompat[nfields].fields, n)) |
1238 | 0 | { |
1239 | 0 | TIFFErrorExtR(tif, module, "Setting up field info failed"); |
1240 | 0 | return -1; |
1241 | 0 | } |
1242 | | |
1243 | 0 | return 0; |
1244 | 0 | } |
1245 | | |
1246 | | int _TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag) |
1247 | 0 | { |
1248 | | /* Filter out non-codec specific tags */ |
1249 | 0 | switch (tag) |
1250 | 0 | { |
1251 | | /* Shared tags */ |
1252 | 0 | case TIFFTAG_PREDICTOR: |
1253 | | /* JPEG tags */ |
1254 | 0 | case TIFFTAG_JPEGTABLES: |
1255 | | /* OJPEG tags */ |
1256 | 0 | case TIFFTAG_JPEGIFOFFSET: |
1257 | 0 | case TIFFTAG_JPEGIFBYTECOUNT: |
1258 | 0 | case TIFFTAG_JPEGQTABLES: |
1259 | 0 | case TIFFTAG_JPEGDCTABLES: |
1260 | 0 | case TIFFTAG_JPEGACTABLES: |
1261 | 0 | case TIFFTAG_JPEGPROC: |
1262 | 0 | case TIFFTAG_JPEGRESTARTINTERVAL: |
1263 | | /* CCITT* */ |
1264 | 0 | case TIFFTAG_BADFAXLINES: |
1265 | 0 | case TIFFTAG_CLEANFAXDATA: |
1266 | 0 | case TIFFTAG_CONSECUTIVEBADFAXLINES: |
1267 | 0 | case TIFFTAG_GROUP3OPTIONS: |
1268 | 0 | case TIFFTAG_GROUP4OPTIONS: |
1269 | | /* LERC */ |
1270 | 0 | case TIFFTAG_LERC_PARAMETERS: |
1271 | 0 | break; |
1272 | 0 | default: |
1273 | 0 | return 1; |
1274 | 0 | } |
1275 | 0 | if (!TIFFIsCODECConfigured(tif->tif_dir.td_compression)) |
1276 | 0 | { |
1277 | 0 | return 0; |
1278 | 0 | } |
1279 | | /* Check if codec specific tags are allowed for the current |
1280 | | * compression scheme (codec) */ |
1281 | 0 | switch (tif->tif_dir.td_compression) |
1282 | 0 | { |
1283 | 0 | case COMPRESSION_LZW: |
1284 | 0 | if (tag == TIFFTAG_PREDICTOR) |
1285 | 0 | return 1; |
1286 | 0 | break; |
1287 | 0 | case COMPRESSION_PACKBITS: |
1288 | | /* No codec-specific tags */ |
1289 | 0 | break; |
1290 | 0 | case COMPRESSION_THUNDERSCAN: |
1291 | | /* No codec-specific tags */ |
1292 | 0 | break; |
1293 | 0 | case COMPRESSION_NEXT: |
1294 | | /* No codec-specific tags */ |
1295 | 0 | break; |
1296 | 0 | case COMPRESSION_JPEG: |
1297 | 0 | if (tag == TIFFTAG_JPEGTABLES) |
1298 | 0 | return 1; |
1299 | 0 | break; |
1300 | 0 | case COMPRESSION_OJPEG: |
1301 | 0 | switch (tag) |
1302 | 0 | { |
1303 | 0 | case TIFFTAG_JPEGIFOFFSET: |
1304 | 0 | case TIFFTAG_JPEGIFBYTECOUNT: |
1305 | 0 | case TIFFTAG_JPEGQTABLES: |
1306 | 0 | case TIFFTAG_JPEGDCTABLES: |
1307 | 0 | case TIFFTAG_JPEGACTABLES: |
1308 | 0 | case TIFFTAG_JPEGPROC: |
1309 | 0 | case TIFFTAG_JPEGRESTARTINTERVAL: |
1310 | 0 | return 1; |
1311 | 0 | } |
1312 | 0 | break; |
1313 | 0 | case COMPRESSION_CCITTRLE: |
1314 | 0 | case COMPRESSION_CCITTRLEW: |
1315 | 0 | case COMPRESSION_CCITTFAX3: |
1316 | 0 | case COMPRESSION_CCITTFAX4: |
1317 | 0 | switch (tag) |
1318 | 0 | { |
1319 | 0 | case TIFFTAG_BADFAXLINES: |
1320 | 0 | case TIFFTAG_CLEANFAXDATA: |
1321 | 0 | case TIFFTAG_CONSECUTIVEBADFAXLINES: |
1322 | 0 | return 1; |
1323 | 0 | case TIFFTAG_GROUP3OPTIONS: |
1324 | 0 | if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3) |
1325 | 0 | return 1; |
1326 | 0 | break; |
1327 | 0 | case TIFFTAG_GROUP4OPTIONS: |
1328 | 0 | if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4) |
1329 | 0 | return 1; |
1330 | 0 | break; |
1331 | 0 | } |
1332 | 0 | break; |
1333 | 0 | case COMPRESSION_JBIG: |
1334 | | /* No codec-specific tags */ |
1335 | 0 | break; |
1336 | 0 | case COMPRESSION_DEFLATE: |
1337 | 0 | case COMPRESSION_ADOBE_DEFLATE: |
1338 | 0 | if (tag == TIFFTAG_PREDICTOR) |
1339 | 0 | return 1; |
1340 | 0 | break; |
1341 | 0 | case COMPRESSION_PIXARLOG: |
1342 | 0 | if (tag == TIFFTAG_PREDICTOR) |
1343 | 0 | return 1; |
1344 | 0 | break; |
1345 | 0 | case COMPRESSION_SGILOG: |
1346 | 0 | case COMPRESSION_SGILOG24: |
1347 | | /* No codec-specific tags */ |
1348 | 0 | break; |
1349 | 0 | case COMPRESSION_LZMA: |
1350 | 0 | if (tag == TIFFTAG_PREDICTOR) |
1351 | 0 | return 1; |
1352 | 0 | break; |
1353 | 0 | case COMPRESSION_ZSTD: |
1354 | 0 | if (tag == TIFFTAG_PREDICTOR) |
1355 | 0 | return 1; |
1356 | 0 | break; |
1357 | 0 | case COMPRESSION_LERC: |
1358 | 0 | if (tag == TIFFTAG_LERC_PARAMETERS) |
1359 | 0 | return 1; |
1360 | 0 | break; |
1361 | 0 | } |
1362 | 0 | return 0; |
1363 | 0 | } |