tiff.h 7.9 KB

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