• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2006 Konstantin Shishkov
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /**
22  * @file
23  * TIFF constants & data structures
24  *
25  * For more information about the TIFF format, check the official docs at:
26  * http://partners.adobe.com/public/developer/tiff/index.html
27  * @author Konstantin Shishkov
28  */
29 
30 #ifndef AVCODEC_TIFF_H
31 #define AVCODEC_TIFF_H
32 
33 #include <stdint.h>
34 #include "tiff_common.h"
35 
36 /** TIFF types in ascenting priority (last in the list is highest) */
37 enum TiffType {
38     /** TIFF image based on the TIFF 6.0 or TIFF/EP (ISO 12234-2) specifications */
39     TIFF_TYPE_TIFF,
40     /** Digital Negative (DNG) image */
41     TIFF_TYPE_DNG,
42     /** Digital Negative (DNG) image part of an CinemaDNG image sequence */
43     TIFF_TYPE_CINEMADNG,
44 };
45 
46 /** abridged list of TIFF and TIFF/EP tags */
47 enum TiffTags {
48     TIFF_SUBFILE            = 0xfe,
49     TIFF_WIDTH              = 0x100,
50     TIFF_HEIGHT,
51     TIFF_BPP,
52     TIFF_COMPR,
53     TIFF_PHOTOMETRIC        = 0x106,
54     TIFF_FILL_ORDER         = 0x10A,
55     TIFF_DOCUMENT_NAME      = 0x10D,
56     TIFF_IMAGE_DESCRIPTION  = 0x10E,
57     TIFF_MAKE               = 0x10F,
58     TIFF_MODEL              = 0x110,
59     TIFF_STRIP_OFFS         = 0x111,
60     TIFF_SAMPLES_PER_PIXEL  = 0x115,
61     TIFF_ROWSPERSTRIP       = 0x116,
62     TIFF_STRIP_SIZE,
63     TIFF_XRES               = 0x11A,
64     TIFF_YRES               = 0x11B,
65     TIFF_PLANAR             = 0x11C,
66     TIFF_PAGE_NAME          = 0x11D,
67     TIFF_XPOS               = 0x11E,
68     TIFF_YPOS               = 0x11F,
69     TIFF_T4OPTIONS          = 0x124,
70     TIFF_T6OPTIONS,
71     TIFF_RES_UNIT           = 0x128,
72     TIFF_PAGE_NUMBER        = 0x129,
73     TIFF_SOFTWARE_NAME      = 0x131,
74     TIFF_DATE               = 0x132,
75     TIFF_ARTIST             = 0x13B,
76     TIFF_HOST_COMPUTER      = 0x13C,
77     TIFF_PREDICTOR          = 0x13D,
78     TIFF_PAL                = 0x140,
79     TIFF_TILE_WIDTH         = 0x142,
80     TIFF_TILE_LENGTH        = 0x143,
81     TIFF_TILE_OFFSETS       = 0x144,
82     TIFF_TILE_BYTE_COUNTS   = 0x145,
83     TIFF_SUB_IFDS           = 0x14A,
84     TIFF_EXTRASAMPLES       = 0x152,
85     TIFF_YCBCR_COEFFICIENTS = 0x211,
86     TIFF_YCBCR_SUBSAMPLING  = 0x212,
87     TIFF_YCBCR_POSITIONING  = 0x213,
88     TIFF_REFERENCE_BW       = 0x214,
89     TIFF_CFA_PATTERN_DIM    = 0x828D,
90     TIFF_CFA_PATTERN        = 0x828E,
91     TIFF_COPYRIGHT          = 0x8298,
92     TIFF_MODEL_TIEPOINT     = 0x8482,
93     TIFF_MODEL_PIXEL_SCALE  = 0x830E,
94     TIFF_MODEL_TRANSFORMATION= 0x8480,
95     TIFF_ICC_PROFILE        = 0x8773,
96     TIFF_GEO_KEY_DIRECTORY  = 0x87AF,
97     TIFF_GEO_DOUBLE_PARAMS  = 0x87B0,
98     TIFF_GEO_ASCII_PARAMS   = 0x87B1,
99 };
100 
101 /** abridged list of DNG tags */
102 enum DngTags {
103     DNG_VERSION             = 0xC612,
104     DNG_BACKWARD_VERSION    = 0xC613,
105     DNG_LINEARIZATION_TABLE = 0xC618,
106     DNG_BLACK_LEVEL         = 0xC61A,
107     DNG_WHITE_LEVEL         = 0xC61D,
108 };
109 
110 /** list of CinemaDNG tags */
111 enum CinemaDngTags {
112     CINEMADNG_TIME_CODES    = 0xC763,
113     CINEMADNG_FRAME_RATE    = 0xC764,
114     CINEMADNG_T_STOP        = 0xC772,
115     CINEMADNG_REEL_NAME     = 0xC789,
116     CINEMADNG_CAMERA_LABEL  = 0xC7A1,
117 };
118 
119 /** list of TIFF, TIFF/EP and DNG compression types */
120 enum TiffCompr {
121     TIFF_RAW = 1,
122     TIFF_CCITT_RLE,
123     TIFF_G3,
124     TIFF_G4,
125     TIFF_LZW,
126     TIFF_JPEG,
127     TIFF_NEWJPEG,
128     TIFF_ADOBE_DEFLATE,
129     TIFF_PACKBITS = 0x8005,
130     TIFF_DEFLATE  = 0x80B2,
131     TIFF_LZMA     = 0x886D,
132 };
133 
134 enum TiffGeoTagKey {
135     TIFF_GT_MODEL_TYPE_GEOKEY                = 1024,
136     TIFF_GT_RASTER_TYPE_GEOKEY               = 1025,
137     TIFF_GT_CITATION_GEOKEY                  = 1026,
138     TIFF_GEOGRAPHIC_TYPE_GEOKEY              = 2048,
139     TIFF_GEOG_CITATION_GEOKEY                = 2049,
140     TIFF_GEOG_GEODETIC_DATUM_GEOKEY          = 2050,
141     TIFF_GEOG_PRIME_MERIDIAN_GEOKEY          = 2051,
142     TIFF_GEOG_LINEAR_UNITS_GEOKEY            = 2052,
143     TIFF_GEOG_LINEAR_UNIT_SIZE_GEOKEY        = 2053,
144     TIFF_GEOG_ANGULAR_UNITS_GEOKEY           = 2054,
145     TIFF_GEOG_ANGULAR_UNIT_SIZE_GEOKEY       = 2055,
146     TIFF_GEOG_ELLIPSOID_GEOKEY               = 2056,
147     TIFF_GEOG_SEMI_MAJOR_AXIS_GEOKEY         = 2057,
148     TIFF_GEOG_SEMI_MINOR_AXIS_GEOKEY         = 2058,
149     TIFF_GEOG_INV_FLATTENING_GEOKEY          = 2059,
150     TIFF_GEOG_AZIMUTH_UNITS_GEOKEY           = 2060,
151     TIFF_GEOG_PRIME_MERIDIAN_LONG_GEOKEY     = 2061,
152     TIFF_PROJECTED_CS_TYPE_GEOKEY            = 3072,
153     TIFF_PCS_CITATION_GEOKEY                 = 3073,
154     TIFF_PROJECTION_GEOKEY                   = 3074,
155     TIFF_PROJ_COORD_TRANS_GEOKEY             = 3075,
156     TIFF_PROJ_LINEAR_UNITS_GEOKEY            = 3076,
157     TIFF_PROJ_LINEAR_UNIT_SIZE_GEOKEY        = 3077,
158     TIFF_PROJ_STD_PARALLEL1_GEOKEY           = 3078,
159     TIFF_PROJ_STD_PARALLEL2_GEOKEY           = 3079,
160     TIFF_PROJ_NAT_ORIGIN_LONG_GEOKEY         = 3080,
161     TIFF_PROJ_NAT_ORIGIN_LAT_GEOKEY          = 3081,
162     TIFF_PROJ_FALSE_EASTING_GEOKEY           = 3082,
163     TIFF_PROJ_FALSE_NORTHING_GEOKEY          = 3083,
164     TIFF_PROJ_FALSE_ORIGIN_LONG_GEOKEY       = 3084,
165     TIFF_PROJ_FALSE_ORIGIN_LAT_GEOKEY        = 3085,
166     TIFF_PROJ_FALSE_ORIGIN_EASTING_GEOKEY    = 3086,
167     TIFF_PROJ_FALSE_ORIGIN_NORTHING_GEOKEY   = 3087,
168     TIFF_PROJ_CENTER_LONG_GEOKEY             = 3088,
169     TIFF_PROJ_CENTER_LAT_GEOKEY              = 3089,
170     TIFF_PROJ_CENTER_EASTING_GEOKEY          = 3090,
171     TIFF_PROJ_CENTER_NORTHING_GEOKEY         = 3091,
172     TIFF_PROJ_SCALE_AT_NAT_ORIGIN_GEOKEY     = 3092,
173     TIFF_PROJ_SCALE_AT_CENTER_GEOKEY         = 3093,
174     TIFF_PROJ_AZIMUTH_ANGLE_GEOKEY           = 3094,
175     TIFF_PROJ_STRAIGHT_VERT_POLE_LONG_GEOKEY = 3095,
176     TIFF_VERTICAL_CS_TYPE_GEOKEY             = 4096,
177     TIFF_VERTICAL_CITATION_GEOKEY            = 4097,
178     TIFF_VERTICAL_DATUM_GEOKEY               = 4098,
179     TIFF_VERTICAL_UNITS_GEOKEY               = 4099
180 };
181 
182 /** list of TIFF, TIFF/AP and DNG PhotometricInterpretation (TIFF_PHOTOMETRIC) values */
183 enum TiffPhotometric {
184     TIFF_PHOTOMETRIC_NONE       = -1,
185     TIFF_PHOTOMETRIC_WHITE_IS_ZERO,      /* mono or grayscale, 0 is white */
186     TIFF_PHOTOMETRIC_BLACK_IS_ZERO,      /* mono or grayscale, 0 is black */
187     TIFF_PHOTOMETRIC_RGB,                /* RGB or RGBA*/
188     TIFF_PHOTOMETRIC_PALETTE,            /* Uses a palette */
189     TIFF_PHOTOMETRIC_ALPHA_MASK,         /* Transparency mask */
190     TIFF_PHOTOMETRIC_SEPARATED,          /* CMYK or some other ink set */
191     TIFF_PHOTOMETRIC_YCBCR,              /* YCbCr */
192     TIFF_PHOTOMETRIC_CIE_LAB    = 8,     /* 1976 CIE L*a*b* */
193     TIFF_PHOTOMETRIC_ICC_LAB,            /* ICC L*a*b* */
194     TIFF_PHOTOMETRIC_ITU_LAB,            /* ITU L*a*b* */
195     TIFF_PHOTOMETRIC_CFA        = 32803, /* Color Filter Array (TIFF/AP and DNG) */
196     TIFF_PHOTOMETRIC_LOG_L      = 32844, /* CIE Log2(L) */
197     TIFF_PHOTOMETRIC_LOG_LUV,            /* CIE Log L*u*v* */
198     TIFF_PHOTOMETRIC_LINEAR_RAW = 34892, /* Linear Raw (DNG) */
199 };
200 
201 enum TiffGeoTagType {
202     GEOTIFF_SHORT  = 0,
203     GEOTIFF_DOUBLE = 34736,
204     GEOTIFF_STRING = 34737
205 };
206 
207 typedef struct TiffGeoTag {
208     enum TiffGeoTagKey key;
209     enum TiffTags type;
210     int count;
211     int offset;
212     char *val;
213 } TiffGeoTag;
214 
215 typedef struct TiffGeoTagKeyName {
216     const enum TiffGeoTagKey key;
217     const char *const name;
218 } TiffGeoTagKeyName;
219 
220 typedef struct TiffGeoTagNameType {
221     const char *const name;
222     const enum TiffGeoTagType type;
223 } TiffGeoTagNameType;
224 
225 #endif /* AVCODEC_TIFF_H */
226