00001 /*! 00002 ************************************************************************ 00003 * \file io_tiff.h 00004 * 00005 * \brief 00006 * I/O functions related to tiff images 00007 * Part of code was based on libtiff (see http://www.libtiff.org/) 00008 * 00009 * \author 00010 * - Alexis Michael Tourapis <alexismt@ieee.org> 00011 * 00012 ************************************************************************ 00013 */ 00014 00015 #ifndef _IO_TIFF_H_ 00016 #define _IO_TIFF_H_ 00017 // See TIFF 6.0 Specification 00018 // http://partners.adobe.com/public/developer/tiff/index.html 00019 00020 // TIFF header. 00021 typedef struct tiff_header 00022 { 00023 unsigned char border[2]; //!< Byte order used (2 bytes). Valid values "II" (little endian) and "MM" (big endian). 00024 uint16 version; //!< TIFF identification number, i.e. 42 (2 bytes) 00025 unsigned int IFDoff; //!< The offset (in bytes) of the first Image File Directory/IFD (4 bytes). 00026 } TIFFHeader; 00027 00028 00029 // TIFF IFD structure 00030 typedef struct tiff_idf_entry 00031 { 00032 uint16 tIFD_tag; //!< Identification tag 00033 uint16 tIFD_type; //!< field type. 00034 unsigned int tIFD_count; //!< The number of values, Count of the indicated Type. 00035 unsigned int tIFD_offset; //!< The Value Offset, the file offset (in bytes) of the Value for the field. 00036 } TIFFIFDEntry; 00037 00038 // TIFF Types 00039 typedef enum { 00040 TIFF_BYTE = 1, // 8-bit unsigned integer. 00041 TIFF_ASCII = 2, // 8-bit byte that contains a 7-bit ASCII code. 00042 TIFF_SHORT = 3, // 16-bit (2-byte) unsigned integer. 00043 TIFF_LONG = 4, // 32-bit (4-byte) unsigned integer. 00044 TIFF_RATIONAL = 5, // Two LONGs: the first represents the numerator of 00045 // a fraction; the second, the denominator 00046 TIFF_SBYTE = 6, // An 8-bit signed (twos-complement) integer. 00047 TIFF_UNDEFINED = 7, // An 8-bit undefined byte. 00048 TIFF_SSHORT = 8, // A 16-bit (2-byte) signed (twos-complement) integer. 00049 TIFF_SLONG = 9, // A 32-bit (4-byte) signed (twos-complement) integer. 00050 TIFF_SRATIONAL = 10, // Two SLONGs: the first represents the numerator of 00051 // a fraction, the second the denominator. 00052 TIFF_FLOAT = 11, // Single precision (4-byte) IEEE format 00053 TIFF_DOUBLE = 12 // Double precision (8-byte) IEEE format 00054 } TIFFType; 00055 // TIFF Types 00056 00057 typedef enum { 00058 TIFFTAG_SUBFILETYPE = 254, /* subfile data descriptor */ 00059 TIFFTAG_OSUBFILETYPE = 255, 00060 TIFFTAG_IMAGEWIDTH = 256, /* image width in pixels */ 00061 TIFFTAG_IMAGELENGTH = 257, /* image height in pixels */ 00062 TIFFTAG_BITSPERSAMPLE = 258, /* bits per channel (sample) */ 00063 TIFFTAG_COMPRESSION = 259, /* data compression technique */ 00064 TIFFTAG_PHOTOMETRIC = 262, /* photometric interpretation */ 00065 TIFFTAG_THRESHHOLDING = 263, /* +thresholding used on data */ 00066 TIFFTAG_CELLWIDTH = 264, /* +dithering matrix width */ 00067 TIFFTAG_CELLLENGTH = 265, /* +dithering matrix height */ 00068 TIFFTAG_FILLORDER = 266, /* data order within a byte */ 00069 TIFFTAG_DOCUMENTNAME = 269, /* name of doc. image is from */ 00070 TIFFTAG_IMAGEDESCRIPTION = 270, /* info about image */ 00071 TIFFTAG_MAKE = 271, /* scanner manufacturer name */ 00072 TIFFTAG_MODEL = 272, /* scanner model name/number */ 00073 TIFFTAG_STRIPOFFSETS = 273, /* offsets to data strips */ 00074 TIFFTAG_ORIENTATION = 274, /* +image orientation */ 00075 TIFFTAG_SAMPLESPERPIXEL = 277, /* samples per pixel */ 00076 TIFFTAG_ROWSPERSTRIP = 278, /* rows per strip of data */ 00077 TIFFTAG_STRIPBYTECOUNTS = 279, /* bytes counts for strips */ 00078 TIFFTAG_MINSAMPLEVALUE = 280, /* +minimum sample value */ 00079 TIFFTAG_MAXSAMPLEVALUE = 281, /* +maximum sample value */ 00080 TIFFTAG_XRESOLUTION = 282, /* pixels/resolution in x */ 00081 TIFFTAG_YRESOLUTION = 283, /* pixels/resolution in y */ 00082 TIFFTAG_PLANARCONFIG = 284, /* storage organization */ 00083 TIFFTAG_PAGENAME = 285, /* page name image is from */ 00084 TIFFTAG_XPOSITION = 286, /* x page offset of image lhs */ 00085 TIFFTAG_YPOSITION = 287, /* y page offset of image lhs */ 00086 TIFFTAG_FREEOFFSETS = 288, /* +byte offset to free block */ 00087 TIFFTAG_FREEBYTECOUNTS = 289, /* +sizes of free blocks */ 00088 TIFFTAG_GRAYRESPONSEUNIT = 290, /* $gray scale curve accuracy */ 00089 TIFFTAG_GRAYRESPONSECURVE = 291, /* $gray scale response curve */ 00090 TIFFTAG_GROUP3OPTIONS = 292, /* 32 flag bits */ 00091 TIFFTAG_T4OPTIONS = 292, /* TIFF 6.0 proper name alias */ 00092 TIFFTAG_GROUP4OPTIONS = 293, /* 32 flag bits */ 00093 TIFFTAG_T6OPTIONS = 293 , /* TIFF 6.0 proper name */ 00094 TIFFTAG_RESOLUTIONUNIT = 296, /* units of resolutions */ 00095 TIFFTAG_PAGENUMBER = 297, /* page numbers of multi-page */ 00096 TIFFTAG_COLORRESPONSEUNIT = 300, /* $color curve accuracy */ 00097 TIFFTAG_TRANSFERFUNCTION = 301, /* !colorimetry info */ 00098 TIFFTAG_SOFTWARE = 305, /* name & release */ 00099 TIFFTAG_DATETIME = 306, /* creation date and time */ 00100 TIFFTAG_ARTIST = 315, /* creator of image */ 00101 TIFFTAG_HOSTCOMPUTER = 316, /* machine where created */ 00102 TIFFTAG_PREDICTOR = 317, /* prediction scheme w/ LZW */ 00103 TIFFTAG_WHITEPOINT = 318, /* image white point */ 00104 TIFFTAG_PRIMARYCHROMATICITIES = 319, /* !primary chromaticities */ 00105 TIFFTAG_COLORMAP = 320, /* RGB map for pallette image */ 00106 TIFFTAG_HALFTONEHINTS = 321, /* !highlight+shadow info */ 00107 TIFFTAG_TILEWIDTH = 322, /* !tile width in pixels */ 00108 TIFFTAG_TILELENGTH = 323, /* !tile height in pixels */ 00109 TIFFTAG_TILEOFFSETS = 324, /* !offsets to data tiles */ 00110 TIFFTAG_TILEBYTECOUNTS = 325, /* !byte counts for tiles */ 00111 TIFFTAG_BADFAXLINES = 326, /* lines w/ wrong pixel count */ 00112 TIFFTAG_CLEANFAXDATA = 327, /* regenerated line info */ 00113 TIFFTAG_CONSECUTIVEBADFAXLINES = 328, /* max consecutive bad lines */ 00114 TIFFTAG_SUBIFD = 330, /* subimage descriptors */ 00115 TIFFTAG_INKSET = 332, /* !inks in separated image */ 00116 TIFFTAG_INKNAMES = 333, /* !ascii names of inks */ 00117 TIFFTAG_NUMBEROFINKS = 334, /* !number of inks */ 00118 TIFFTAG_DOTRANGE = 336, /* !0% and 100% dot codes */ 00119 TIFFTAG_TARGETPRINTER = 337, /* !separation target */ 00120 TIFFTAG_EXTRASAMPLES = 338, /* !info about extra samples */ 00121 TIFFTAG_SAMPLEFORMAT = 339, /* !data sample format */ 00122 TIFFTAG_SMINSAMPLEVALUE = 340, /* !variable MinSampleValue */ 00123 TIFFTAG_SMAXSAMPLEVALUE = 341 /* !variable MaxSampleValue */ 00124 } TIFFTag; 00125 00126 typedef enum { 00127 COMPRESSION_NONE = 1, /* dump mode (only mode that will be initially supported) */ 00128 COMPRESSION_CCITTRLE = 2, /* CCITT modified Huffman RLE */ 00129 COMPRESSION_CCITTFAX3 = 3, /* CCITT Group 3 fax encoding */ 00130 COMPRESSION_CCITT_T4 = 3, /* CCITT T.4 (TIFF 6 name) */ 00131 COMPRESSION_CCITTFAX4 = 4, /* CCITT Group 4 fax encoding */ 00132 COMPRESSION_CCITT_T6 = 4, /* CCITT T.6 (TIFF 6 name) */ 00133 COMPRESSION_LZW = 5, /* Lempel-Ziv & Welch */ 00134 COMPRESSION_OJPEG = 6, /* !6.0 JPEG */ 00135 COMPRESSION_JPEG = 7 /* %JPEG DCT compression */ 00136 } TIFFCompression; 00137 00138 00139 extern void ReadTIFFImage (InputParameters *p_Inp, VideoDataFile *input_file, int FrameNoInFile, FrameFormat *source, unsigned char *buf); 00140 00141 #endif 00142