148#define FIELDSET_ITEMS 4
206 uint16_t td_pagenumber[2];
218 uint16_t *td_colormap[3];
230 uint16_t td_halftonehints[2];
250#define NOSTRIP ((uint32_t)(-1))
264#define NOTILE ((uint32_t)(-1))
287#ifdef STRIPBYTECOUNTSORTED_UNUSED
292 int td_stripbytecountsorted;
312 uint16_t td_ycbcrsubsampling[2];
320 uint16_t *td_transferfunction[3];
412#define FIELD_IGNORE 0
419#define FIELD_IMAGEDIMENSIONS 1
424#define FIELD_TILEDIMENSIONS 2
429#define FIELD_RESOLUTION 3
434#define FIELD_POSITION 4
441#define FIELD_SUBFILETYPE 5
446#define FIELD_BITSPERSAMPLE 6
451#define FIELD_COMPRESSION 7
456#define FIELD_PHOTOMETRIC 8
461#define FIELD_THRESHHOLDING 9
466#define FIELD_FILLORDER 10
471#define FIELD_ORIENTATION 15
476#define FIELD_SAMPLESPERPIXEL 16
481#define FIELD_ROWSPERSTRIP 17
487#define FIELD_MINSAMPLEVALUE 18
493#define FIELD_MAXSAMPLEVALUE 19
499#define FIELD_PLANARCONFIG 20
504#define FIELD_RESOLUTIONUNIT 22
509#define FIELD_PAGENUMBER 23
514#define FIELD_STRIPBYTECOUNTS 24
519#define FIELD_STRIPOFFSETS 25
524#define FIELD_COLORMAP 26
529#define FIELD_EXTRASAMPLES 31
534#define FIELD_SAMPLEFORMAT 32
539#define FIELD_SMINSAMPLEVALUE 33
544#define FIELD_SMAXSAMPLEVALUE 34
549#define FIELD_IMAGEDEPTH 35
554#define FIELD_TILEDEPTH 36
559#define FIELD_HALFTONEHINTS 37
564#define FIELD_YCBCRSUBSAMPLING 39
569#define FIELD_YCBCRPOSITIONING 40
575#define FIELD_REFBLACKWHITE 41
580#define FIELD_TRANSFERFUNCTION 44
585#define FIELD_INKNAMES 46
590#define FIELD_SUBIFD 49
595#define FIELD_NUMBEROFINKS 50
602#define FIELD_CODEC 66
620#define FIELD_PSEUDO 0
626#define FIELD_LAST (32 * FIELDSET_ITEMS - 1)
638#define BITn(n) (1U << ((n) & 0x1f))
650#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
662#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
675#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
688#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
705#define FieldSet(fields, f) (fields[(f) / 32] & BITn(f))
719#define ResetFieldBit(fields, f) (fields[(f) / 32] &= ~BITn(f))
841#if defined(__cplusplus)
1212#if defined(__cplusplus)
int _TIFFRemoveEntryFromDirectoryListByOffset(TIFF *tif, uint64_t diroff)
Attempt to remove a shared directory-map entry by offset.
int _TIFFCheckDirNumberAndOffset(TIFF *tif, tdir_t dirn, uint64_t diroff)
Register or validate a chain index/offset pair for loop detection.
int _TIFFGetOffsetFromDirNumber(TIFF *tif, tdir_t dirn, uint64_t *diroff)
Resolve an index from the existing number-to-offset map.
int _TIFFGetDirNumberFromOffset(TIFF *tif, uint64_t diroff, tdir_t *dirn)
Resolve a directory offset using the chain maps.
void _TIFFResetTifDirAndInitStrileCounters(TIFFDirectory *td)
Zero directory storage and initialise traversal sentinels.
int _TIFFMergeFields(TIFF *tif, const TIFFField info[], uint32_t n)
Merge borrowed field definitions into the lookup table.
TIFFField * _TIFFCreateAnonField(TIFF *tif, uint32_t tag, TIFFDataType field_type)
Allocate a counted anonymous field descriptor.
const TIFFField * _TIFFFindOrRegisterField(TIFF *tif, uint32_t tag, TIFFDataType dt)
Find a typed field or register an anonymous replacement.
const TIFFFieldArray * _TIFFGetFields(void)
Return the built-in image field schema.
void _TIFFPrintFieldInfo(TIFF *tif, FILE *fd)
Print the registered field metadata to a stream.
TIFFFieldArrayType
Identify the namespace described by a field array.
void _TIFFSetupFields(TIFF *tif, const TIFFFieldArray *fieldarray)
Replace the registered field-pointer table with a schema.
const TIFFFieldArray * _TIFFGetGpsFields(void)
Return the built-in GPS field schema.
#define FIELDSET_ITEMS
Size of the presence bitmap in uint32_t words.
int _TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag)
Filter recognised codec-specific tags against current compression.
TIFFSetGetFieldType
Encode the internal value and variadic count representation.
const TIFFFieldArray * _TIFFGetExifFields(void)
Return the built-in EXIF field schema.
@ tfiatGps
EXIF GPS metadata-directory schema.
@ tfiatOther
Other application/compatibility schema.
@ tfiatImage
Main image-directory schema.
@ tfiatExif
EXIF metadata-directory schema.
@ TIFF_SETGET_C16_UINT8
Unsigned 8-bit array with 16-bit explicit count.
@ TIFF_SETGET_C0_SINT64
Signed 64-bit array with implicit count.
@ TIFF_SETGET_DOUBLE
Double scalar storage.
@ TIFF_SETGET_SINT64
Signed 64-bit scalar storage.
@ TIFF_SETGET_C32_SINT32
Signed 32-bit array with 32-bit explicit count.
@ TIFF_SETGET_C16_FLOAT
Float array with 16-bit explicit count.
@ TIFF_SETGET_UNDEFINED
Unsupported or unspecified argument representation.
@ TIFF_SETGET_SINT8
Signed 8-bit scalar storage.
@ TIFF_SETGET_C32_ASCII
Character array with 32-bit explicit count.
@ TIFF_SETGET_INT
Promoted int scalar representation.
@ TIFF_SETGET_C32_UINT8
Unsigned 8-bit array with 32-bit explicit count.
@ TIFF_SETGET_IFD8
64-bit directory-offset scalar storage.
@ TIFF_SETGET_C32_UINT16
Unsigned 16-bit array with 32-bit explicit count.
@ TIFF_SETGET_C16_DOUBLE
Double array with 16-bit explicit count.
@ TIFF_SETGET_UINT64
Unsigned 64-bit scalar storage.
@ TIFF_SETGET_C0_UINT32
Unsigned 32-bit array with implicit count.
@ TIFF_SETGET_C16_UINT32
Unsigned 32-bit array with 16-bit explicit count.
@ TIFF_SETGET_UINT16_PAIR
Two separate promoted uint16_t values / uint16_t output slots.
@ TIFF_SETGET_C32_SINT16
Signed 16-bit array with 32-bit explicit count.
@ TIFF_SETGET_C16_UINT16
Unsigned 16-bit array with 16-bit explicit count.
@ TIFF_SETGET_C16_SINT64
Signed 64-bit array with 16-bit explicit count.
@ TIFF_SETGET_C0_FLOAT
Float array with implicit count.
@ TIFF_SETGET_C0_SINT32
Signed 32-bit array with implicit count.
@ TIFF_SETGET_C16_UINT64
Unsigned 64-bit array with 16-bit explicit count.
@ TIFF_SETGET_C32_UINT32
Unsigned 32-bit array with 32-bit explicit count.
@ TIFF_SETGET_C0_ASCII
Character array with implicit count.
@ TIFF_SETGET_C32_SINT8
Signed 8-bit array with 32-bit explicit count.
@ TIFF_SETGET_UINT16
Unsigned 16-bit scalar storage.
@ TIFF_SETGET_C16_SINT16
Signed 16-bit array with 16-bit explicit count.
@ TIFF_SETGET_C0_UINT8
Unsigned 8-bit array with implicit count.
@ TIFF_SETGET_ASCII
Null-terminated string representation.
@ TIFF_SETGET_C0_SINT8
Signed 8-bit array with implicit count.
@ TIFF_SETGET_C16_SINT8
Signed 8-bit array with 16-bit explicit count.
@ TIFF_SETGET_OTHER
Tag-specific calling convention outside the regular encodings.
@ TIFF_SETGET_C0_UINT64
Unsigned 64-bit array with implicit count.
@ TIFF_SETGET_FLOAT
Float scalar storage.
@ TIFF_SETGET_C16_SINT32
Signed 32-bit array with 16-bit explicit count.
@ TIFF_SETGET_SINT16
Signed 16-bit scalar storage.
@ TIFF_SETGET_C0_SINT16
Signed 16-bit array with implicit count.
@ TIFF_SETGET_C32_IFD8
64-bit directory-offset array with 32-bit explicit count.
@ TIFF_SETGET_UINT32
Unsigned 32-bit scalar storage.
@ TIFF_SETGET_C32_SINT64
Signed 64-bit array with 32-bit explicit count.
@ TIFF_SETGET_C16_ASCII
Character array with 16-bit explicit count.
@ TIFF_SETGET_C32_DOUBLE
Double array with 32-bit explicit count.
@ TIFF_SETGET_UINT8
Unsigned 8-bit scalar storage.
@ TIFF_SETGET_C0_UINT16
Unsigned 16-bit array with implicit count.
@ TIFF_SETGET_C32_UINT64
Unsigned 64-bit array with 32-bit explicit count.
@ TIFF_SETGET_C0_IFD8
64-bit directory-offset array with implicit count.
@ TIFF_SETGET_C16_IFD8
64-bit directory-offset array with 16-bit explicit count.
@ TIFF_SETGET_SINT32
Signed 32-bit scalar storage.
@ TIFF_SETGET_C32_FLOAT
Float array with 32-bit explicit count.
@ TIFF_SETGET_C0_DOUBLE
Double array with implicit count.
TIFF_SSIZE_T tmsize_t
Represent a signed memory or I/O size in bytes.
TIFFDataType
Identify the on-disk representation of a TIFF directory field.
uint32_t tdir_t
Represent a zero-based directory index, rather than a file offset.
uint32_t ttag_t
Represent a legacy directory tag identifier.
Represent a parsed directory entry before value conversion.
uint64_t tdir_count
Number of file-type elements, normalised to host order.
uint16_t toff_short
Raw 16-bit view of inline bytes or offset storage.
uint16_t tdir_type
On-disk TIFFDataType code.
uint64_t toff_long8
Raw 64-bit view of inline bytes or offset storage.
uint16_t tdir_tag
Directory tag identifier.
uint8_t tdir_ignore
Nonzero to suppress this entry during parsing, e.g. duplicate tags.
uint32_t toff_long
Raw 32-bit view of inline bytes or offset storage.
Store the current directory values and image traversal state.
uint32_t td_colormap_alloc
Number of entries allocated in each ColorMap plane, zero when none is installed.
int td_customValueCount
Number of live records in td_customValues, including partial setter entries.
float td_xposition
Horizontal image position in resolution units.
uint32_t td_tiledepth
Tile depth in slices.
uint16_t td_fillorder
FILLORDER_* bit order within file bytes.
uint32_t td_dirdatasize_Noffsets
Number of ranges collected in td_dirdatasize_offsets.
float td_xresolution
Horizontal pixels per resolution unit.
uint64_t td_dirdatasize_read
Reusable IFD span including entry space and contiguous external data; UINT64_MAX permits extension at...
int td_inknameslen
Byte length of the concatenated ink-name strings, including terminators.
uint16_t * td_sampleinfo
Owned ExtraSamples interpretation array of td_extrasamples entries, or NULL.
tmsize_t td_tilesize
Cached decoded tile size in bytes; minus one when invalidated.
float * td_refblackwhite
Owned six-float reference black/white array, or NULL.
uint32_t td_rowsperstrip
Rows per strip; UINT32_MAX represents one whole-image strip.
uint32_t td_imagewidth
Image width in pixels.
uint16_t td_compression
COMPRESSION_* codec identifier.
uint16_t td_photometric
PHOTOMETRIC_* interpretation.
uint32_t td_tilewidth
Tile width in pixels.
tmsize_t td_scanlinesize
Cached decoded scanline size in bytes; zero when not computed.
float td_yresolution
Vertical pixels per resolution unit.
uint16_t td_extrasamples
Number of extra samples described by td_sampleinfo.
uint16_t td_threshholding
THRESHHOLD_* bilevel rendering convention.
uint16_t td_minsamplevalue
Legacy unsigned minimum sample value.
double * td_sminsamplevalue
Owned SamplesPerPixel-length array of minimum values, or NULL.
uint16_t td_bitspersample
Bits in each sample.
char * td_inknames
Owned concatenated null-terminated ink names, or NULL.
uint32_t td_row
Current scanline index; UINT32_MAX before traversal starts.
TIFFDirEntry td_stripoffset_entry
Deferred offset entry; tag/type/count are swapped but offset storage is raw.
uint16_t td_maxsamplevalue
Legacy unsigned maximum sample value.
uint32_t td_imagedepth
Image depth in slices.
uint16_t td_orientation
ORIENTATION_* storage orientation.
uint32_t td_stripsperimage
Strips or tiles per sample plane, despite the historic name.
uint16_t td_resolutionunit
RESUNIT_* unit for resolution and position values.
uint32_t td_colormap_count
Number of entries in each ColorMap plane that the directory uses, zero when none is installed.
uint16_t td_planarconfig
PLANARCONFIG_* sample-plane arrangement.
TIFFTagValue * td_customValues
Owned array of custom-value records, each owning its value.
double * td_smaxsamplevalue
Owned SamplesPerPixel-length array of maximum values, or NULL.
uint64_t * td_stripbytecount_p
Owned byte-count array/cache, possibly NULL or partial; use TIFFGetStrileByteCount().
unsigned char td_iswrittentofile
Nonzero when the current directory has an on-file representation.
uint64_t * td_stripoffset_p
Owned offset array/cache, possibly NULL or partial; use TIFFGetStrileOffset().
uint16_t td_sampleformat
SAMPLEFORMAT_* interpretation of samples.
uint64_t td_dirdatasize_write
Accumulated IFD write size in bytes, including entry space after counting.
uint32_t td_col
Current pixel column; UINT32_MAX before traversal starts.
unsigned char td_deferstrilearraywriting
Nonzero to reserve strile entries for later explicit array writing.
uint16_t td_samplesperpixel
Samples per pixel, including extra samples.
uint32_t td_subfiletype
NewSubfileType flag mask.
uint32_t td_nstrips
Total strile count across all planes; logical array length.
uint16_t td_numberofinks
Number of inks, kept consistent with accepted InkNames where possible.
TIFFDirEntry td_stripbytecount_entry
Deferred byte-count entry; offset storage still requires swapping.
uint32_t td_imagelength
Image length in rows.
uint32_t td_stripoffsetbyteallocsize
Allocated element capacity of lazy strile offset/count caches, not byte size.
TIFFEntryOffsetAndLength * td_dirdatasize_offsets
Owned auxiliary array of external IFD-value ranges, or NULL.
uint32_t td_curtile
Current tile index, or NOTILE.
uint32_t td_tilelength
Tile length in rows.
uint16_t td_nsubifd
Number of child-directory offsets in td_subifd.
uint64_t * td_subifd
Owned array of td_nsubifd child-directory offsets, or NULL.
float td_yposition
Vertical image position in resolution units.
uint32_t td_transferfunction_count
Number of entries in each installed TransferFunction curve, zero when none is installed; the only rec...
uint16_t td_ycbcrpositioning
YCBCRPOSITION_* placement convention.
uint32_t td_curstrip
Current strip index, or NOSTRIP.
Describe an external directory-value byte range.
uint64_t offset
External value offset in file bytes.
uint64_t length
External value length in bytes.
Store one custom field value and its descriptor.
void * value
Owned custom-value allocation, or NULL after clearing/failure.
int count
Number of internally stored elements; after a partial setter failure it may be zero or a nonzero coun...
const TIFFField * info
Borrowed live descriptor; must outlive this custom value.
Describe a borrowed schema or owned compatibility batch.
TIFFFieldArrayType type
Namespace/category of the schema.
uint32_t count
Number of valid descriptors in fields.
uint32_t allocated_size
Descriptor capacity when owned; zero identifies a static schema.
TIFFField * fields
Descriptor array; static/borrowed or owned according to allocated_size and creator.
Describe a field's file type and internal argument contract.
unsigned char field_oktochange
Nonzero to permit changes after writing starts; ImageLength is separately exempt.
TIFFDataType field_type
On-disk TIFFDataType, distinct from the argument representation.
unsigned char field_passcount
Nonzero for an explicit count argument; tag-specific exceptions still apply.
const char * field_name
Borrowed or anonymous-owned null-terminated name; must remain live while used.
unsigned short field_bit
FIELD_* presence index; FIELD_CUSTOM shares storage through the custom list.
uint32_t field_anonymous
Nonzero for an automatically created unknown-tag descriptor.
uint32_t field_tag
Tag identifier in this schema namespace.
short field_readcount
Fixed getter count or TIFF_VARIABLE/TIFF_VARIABLE2/TIFF_SPP rule.
TIFFSetGetFieldType set_get_field_type
Internal storage/count representation for tag access and conversion.
TIFFFieldArray * field_subfields
Borrowed child-directory schema, or NULL; not recursively freed here.
short field_writecount
Fixed setter count or variable/sample-count sentinel.
Hold private state for one open TIFF library instance.
Define TIFF file-format types, tag identifiers, and constant values.
Declare the public C library interface and its supporting types.