1
/* $Id: tif_dir.h,v 1.30.2.1 2007/04/07 14:58:30 dron Exp $ */
4
* Copyright (c) 1988-1997 Sam Leffler
5
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
7
* Permission to use, copy, modify, distribute, and sell this software and
8
* its documentation for any purpose is hereby granted without fee, provided
9
* that (i) the above copyright notices and this permission notice appear in
10
* all copies of the software and related documentation, and (ii) the names of
11
* Sam Leffler and Silicon Graphics may not be used in any advertising or
12
* publicity relating to the software without the specific, prior written
13
* permission of Sam Leffler and Silicon Graphics.
15
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
16
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
17
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
19
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
20
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
21
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
22
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
30
* ``Library-private'' Directory-related Definitions.
34
* Internal format of a TIFF directory entry.
37
#define FIELD_SETLONGS 4
38
/* bit vector of fields that are set */
39
unsigned long td_fieldsset[FIELD_SETLONGS];
41
uint32 td_imagewidth, td_imagelength, td_imagedepth;
42
uint32 td_tilewidth, td_tilelength, td_tiledepth;
43
uint32 td_subfiletype;
44
uint16 td_bitspersample;
45
uint16 td_sampleformat;
46
uint16 td_compression;
47
uint16 td_photometric;
48
uint16 td_threshholding;
50
uint16 td_orientation;
51
uint16 td_samplesperpixel;
52
uint32 td_rowsperstrip;
53
uint16 td_minsamplevalue, td_maxsamplevalue;
54
double td_sminsamplevalue, td_smaxsamplevalue;
55
float td_xresolution, td_yresolution;
56
uint16 td_resolutionunit;
57
uint16 td_planarconfig;
58
float td_xposition, td_yposition;
59
uint16 td_pagenumber[2];
60
uint16* td_colormap[3];
61
uint16 td_halftonehints[2];
62
uint16 td_extrasamples;
63
uint16* td_sampleinfo;
64
/* even though the name is misleading, td_stripsperimage is the number
65
* of striles (=strips or tiles) per plane, and td_nstrips the total
66
* number of striles */
67
tstrile_t td_stripsperimage;
68
tstrile_t td_nstrips; /* size of offset & bytecount arrays */
69
toff_t* td_stripoffset;
70
toff_t* td_stripbytecount; /* FIXME: it should be tsize_t array */
71
int td_stripbytecountsorted; /* is the bytecount array sorted ascending? */
74
/* YCbCr parameters */
75
uint16 td_ycbcrsubsampling[2];
76
uint16 td_ycbcrpositioning;
77
/* Colorimetry parameters */
78
uint16* td_transferfunction[3];
83
int td_customValueCount;
84
TIFFTagValue *td_customValues;
88
* Field flags used to indicate fields that have
89
* been set in a directory, and to reference fields
90
* when manipulating a directory.
94
* FIELD_IGNORE is used to signify tags that are to
95
* be processed but otherwise ignored. This permits
96
* antiquated tags to be quietly read and discarded.
97
* Note that a bit *is* allocated for ignored tags;
98
* this is understood by the directory reading logic
99
* which uses this fact to avoid special-case handling
101
#define FIELD_IGNORE 0
103
/* multi-item fields */
104
#define FIELD_IMAGEDIMENSIONS 1
105
#define FIELD_TILEDIMENSIONS 2
106
#define FIELD_RESOLUTION 3
107
#define FIELD_POSITION 4
109
/* single-item fields */
110
#define FIELD_SUBFILETYPE 5
111
#define FIELD_BITSPERSAMPLE 6
112
#define FIELD_COMPRESSION 7
113
#define FIELD_PHOTOMETRIC 8
114
#define FIELD_THRESHHOLDING 9
115
#define FIELD_FILLORDER 10
116
#define FIELD_ORIENTATION 15
117
#define FIELD_SAMPLESPERPIXEL 16
118
#define FIELD_ROWSPERSTRIP 17
119
#define FIELD_MINSAMPLEVALUE 18
120
#define FIELD_MAXSAMPLEVALUE 19
121
#define FIELD_PLANARCONFIG 20
122
#define FIELD_RESOLUTIONUNIT 22
123
#define FIELD_PAGENUMBER 23
124
#define FIELD_STRIPBYTECOUNTS 24
125
#define FIELD_STRIPOFFSETS 25
126
#define FIELD_COLORMAP 26
127
#define FIELD_EXTRASAMPLES 31
128
#define FIELD_SAMPLEFORMAT 32
129
#define FIELD_SMINSAMPLEVALUE 33
130
#define FIELD_SMAXSAMPLEVALUE 34
131
#define FIELD_IMAGEDEPTH 35
132
#define FIELD_TILEDEPTH 36
133
#define FIELD_HALFTONEHINTS 37
134
#define FIELD_YCBCRSUBSAMPLING 39
135
#define FIELD_YCBCRPOSITIONING 40
136
#define FIELD_TRANSFERFUNCTION 44
137
#define FIELD_INKNAMES 46
138
#define FIELD_SUBIFD 49
139
/* FIELD_CUSTOM (see tiffio.h) 65 */
140
/* end of support for well-known tags; codec-private tags follow */
141
#define FIELD_CODEC 66 /* base of codec-private tags */
145
* Pseudo-tags don't normally need field bits since they
146
* are not written to an output file (by definition).
147
* The library also has express logic to always query a
148
* codec for a pseudo-tag so allocating a field bit for
149
* one is a waste. If codec wants to promote the notion
150
* of a pseudo-tag being ``set'' or ``unset'' then it can
151
* do using internal state flags without polluting the
152
* field bit space defined for real tags.
154
#define FIELD_PSEUDO 0
156
#define FIELD_LAST (32*FIELD_SETLONGS-1)
158
#define TIFFExtractData(tif, type, v) \
159
((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \
160
((v) >> (tif)->tif_typeshift[type]) & (tif)->tif_typemask[type] : \
161
(v) & (tif)->tif_typemask[type]))
162
#define TIFFInsertData(tif, type, v) \
163
((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \
164
((v) & (tif)->tif_typemask[type]) << (tif)->tif_typeshift[type] : \
165
(v) & (tif)->tif_typemask[type]))
168
#define BITn(n) (((unsigned long)1L)<<((n)&0x1f))
169
#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n)/32])
170
#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
171
#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
172
#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
174
#define FieldSet(fields, f) (fields[(f)/32] & BITn(f))
175
#define ResetFieldBit(fields, f) (fields[(f)/32] &= ~BITn(f))
177
#if defined(__cplusplus)
180
extern const TIFFFieldInfo *_TIFFGetFieldInfo(size_t *);
181
extern const TIFFFieldInfo *_TIFFGetExifFieldInfo(size_t *);
182
extern void _TIFFSetupFieldInfo(TIFF*, const TIFFFieldInfo[], size_t);
183
extern int _TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);
184
extern void _TIFFPrintFieldInfo(TIFF*, FILE*);
185
extern TIFFDataType _TIFFSampleToTagType(TIFF*);
186
extern const TIFFFieldInfo* _TIFFFindOrRegisterFieldInfo( TIFF *tif,
189
extern TIFFFieldInfo* _TIFFCreateAnonFieldInfo( TIFF *tif, ttag_t tag,
192
#define _TIFFFindFieldInfo TIFFFindFieldInfo
193
#define _TIFFFindFieldInfoByName TIFFFindFieldInfoByName
194
#define _TIFFFieldWithTag TIFFFieldWithTag
195
#define _TIFFFieldWithName TIFFFieldWithName
197
#if defined(__cplusplus)
200
#endif /* _TIFFDIR_ */
202
/* vim: set ts=8 sts=8 sw=8 noet: */