56#define INITIAL_THRESHOLD (1024 * 1024)
64#define THRESHOLD_MULTIPLIER 10
72#define MAX_THRESHOLD \
73 (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * \
83#define TIFF_INT64_MAX ((((int64_t)0x7FFFFFFF) << 32) | 0xFFFFFFFF)
117 int is_strip, uint32_t strip_or_tile,
120#if SIZEOF_SIZE_T == 8
125#if SIZEOF_SIZE_T != 8
128 if (size > 1000 * 1000 * 1000)
131 if ((uint64_t)size >= filesize)
134 "Chunk size requested is larger than file size.");
146 while (already_read < size)
149 tmsize_t to_read = size - already_read;
150#if SIZEOF_SIZE_T == 8
160 uint8_t *new_rawdata;
164 (uint64_t)already_read + (uint64_t)to_read +
165 (uint64_t)rawdata_offset,
167 if (new_rawdatasize == 0)
174 if (new_rawdata == 0)
177 "No space for data buffer at scanline %" PRIu32,
194 tif, tif->
tif_rawdata + rawdata_offset + already_read, to_read);
198 already_read += bytes_read;
199 if (bytes_read != to_read)
202 tif->
tif_rawdata + rawdata_offset + already_read, 0,
207 "Read error at scanline %" PRIu32
215 "Read error at row %" PRIu32
", col %" PRIu32
216 ", tile %" PRIu32
"; "
220 strip_or_tile, already_read, size);
257 static const char module[] = "TIFFFillStripPartial";
260 uint64_t read_offset;
276 read_ahead_mod = read_ahead * 2;
278 read_ahead_mod = read_ahead;
287 "Data buffer too small to hold part of strip %d",
324 "Seek error at scanline %" PRIu32
", strip %d",
331 if (!
SeekOK(tif, read_offset))
334 "Seek error at scanline %" PRIu32
", strip %d",
343 to_read = read_ahead_mod - unused_data;
452 "%" PRIu32
": Row out of range, max %" PRIu32
"", row,
459 "Cannot compute strip: RowsPerStrip is zero");
464 uint64_t sample_offset;
469 "%" PRIu16
": Sample out of range, max %" PRIu16
"",
483 if (strip == 0 && strip64 != 0)
493#if defined(CHUNKY_STRIP_READ_SUPPORT)
536#if defined(CHUNKY_STRIP_READ_SUPPORT)
545#if defined(CHUNKY_STRIP_READ_SUPPORT)
549 else if (!whole_strip)
563 if (row < tif->tif_dir.td_row)
608 if ((e =
TIFFSeek(tif, row, sample)) != 0)
635 return (e > 0 ? 1 : -1);
665 static const char module[] = "TIFFReadEncodedStrip";
667 uint32_t rowsperstrip;
668 uint32_t stripsperplane;
669 uint32_t stripinplane;
674 if (strip >= td->td_nstrips)
677 "%" PRIu32
": Strip out of range, max %" PRIu32, strip,
682 rowsperstrip = td->td_rowsperstrip;
683 if (rowsperstrip > td->td_imagelength)
684 rowsperstrip = td->td_imagelength;
685 if (rowsperstrip == 0)
692 stripinplane = (strip % stripsperplane);
694 *pplane = (uint16_t)(strip / stripsperplane);
695 rows = td->td_imagelength - stripinplane * rowsperstrip;
696 if (rows > rowsperstrip)
711 static const char module[] = "TIFFReadEncodedStrip";
716 if ((size < 0) && (size != (
tmsize_t)(-1)))
727 size >= stripsize && !
isMapped(tif) &&
744 if ((size != (
tmsize_t)(-1)) && (size < stripsize))
751 memset(buf, 0, (
size_t)stripsize);
754 if ((*tif->
tif_decodestrip)(tif, (uint8_t *)buf, stripsize, plane) <= 0)
783 if (this_stripsize == ((
tmsize_t)(-1)))
786 if ((size_to_read != (
tmsize_t)(-1)) && (size_to_read < this_stripsize))
787 this_stripsize = size_to_read;
796 if (bufsizetoalloc > 100 * 1024 * 1024)
799 if (maxCompressionRatio > 0 &&
801 (uint64_t)this_stripsize / maxCompressionRatio)
804 "Likely invalid strip byte count for strip %u. "
805 "Uncompressed strip size is %" PRIu64
", "
806 "compressed one is %" PRIu64,
807 strip, (uint64_t)this_stripsize,
820 if ((*tif->
tif_decodestrip)(tif, (uint8_t *)*buf, this_stripsize, plane) <=
824 "_TIFFReadEncodedStripAndAllocBuffer"))
827 return (this_stripsize);
864 "Seek error at scanline %" PRIu32
", strip %" PRIu32,
872 "Read error at scanline %" PRIu32
903 "Read error at scanline %" PRIu32
", strip %" PRIu32
950 "Seek error at scanline %" PRIu32
", strip %" PRIu32,
957 "Seek error at row %" PRIu32
", col %" PRIu32
", tile %" PRIu32,
976 static const char module[] = "TIFFReadRawStrip";
978 uint64_t bytecount64;
981 if ((size < 0) && (size != (
tmsize_t)(-1)))
988 if (strip >= td->td_nstrips)
991 "%" PRIu32
": Strip out of range, max %" PRIu32, strip,
998 "Compression scheme does not support access to raw "
999 "uncompressed data");
1003 if (size != (
tmsize_t)(-1) && (uint64_t)size <= bytecount64)
1007 if (bytecountm == 0)
1057 static const char module[] = "TIFFFillStrip";
1066 "Invalid strip byte count %" PRIu64
1076 if (bytecount > 1024 * 1024 &&
1077 (bytecount - 4096) / 10 > (uint64_t)stripsize)
1089 uint64_t newbytecount = (uint64_t)stripsize * 10 + 4096;
1091 "Too large strip byte count %" PRIu64
1092 ", strip %" PRIu32
". Limiting to %" PRIu64,
1093 bytecount, strip, newbytecount);
1094 bytecount = newbytecount;
1096 else if (stripsize > 100 * 1024 * 1024)
1103 const uint64_t maxCompressionRatio =
1105 if (maxCompressionRatio > 0 &&
1106 bytecount < (uint64_t)stripsize / maxCompressionRatio)
1110 "Likely invalid strip byte count for strip %u. "
1111 "Uncompressed strip size is %" PRIu64
", "
1112 "compressed one is %" PRIu64,
1113 strip, (uint64_t)stripsize, bytecount);
1130 if (bytecount > (uint64_t)tif->
tif_size ||
1132 (uint64_t)tif->
tif_size - bytecount)
1142 "Read error on strip %" PRIu32
"; "
1143 "got %" PRIu64
" bytes, expected %" PRIu64,
1174 uint8_t *mapped_rawdata =
1199 if ((uint64_t)bytecountm != bytecount)
1211 "Data buffer too small to hold strip %" PRIu32, strip);
1231 module) != bytecountm)
1239 module) != bytecountm)
1268 bool overflow =
false;
1286 static const char module[] = "TIFFReadEncodedTile";
1290 if ((size < 0) && (size != (
tmsize_t)(-1)))
1297 if (tile >= td->td_nstrips)
1300 "%" PRIu32
": Tile out of range, max %" PRIu32, tile,
1307 size >= tilesize && !
isMapped(tif) &&
1326 else if (size > tilesize)
1332 memset(buf, 0, (
size_t)size);
1336 (uint16_t)(tile / td->td_stripsperimage)) <= 0)
1351 tmsize_t bufsizetoalloc, uint32_t x,
1352 uint32_t y, uint32_t z, uint16_t s)
1354 bool overflow =
false;
1374 void **buf,
tmsize_t bufsizetoalloc,
1377 static const char module[] = "_TIFFReadEncodedTileAndAllocBuffer";
1388 if (tile >= td->td_nstrips)
1391 "%" PRIu32
": Tile out of range, max %" PRIu32, tile,
1404 if (bytecount != (uint64_t)tilesize)
1407 "Invalid tile byte count for tile %u. "
1408 "Expected %" PRIu64
", got %" PRIu64,
1409 tile, (uint64_t)tilesize, bytecount);
1419 if (bufsizetoalloc > 100 * 1024 * 1024)
1421 const uint64_t maxCompressionRatio =
1423 if (maxCompressionRatio > 0 &&
1425 (uint64_t)tilesize / maxCompressionRatio)
1428 "Likely invalid tile byte count for tile %u. "
1429 "Uncompressed tile size is %" PRIu64
", "
1430 "compressed one is %" PRIu64,
1431 tile, (uint64_t)tilesize,
1446 if (size_to_read == (
tmsize_t)(-1))
1447 size_to_read = tilesize;
1448 else if (size_to_read > tilesize)
1449 size_to_read = tilesize;
1451 (uint16_t)(tile / td->td_stripsperimage)) <= 0)
1457 return (size_to_read);
1494 "Seek error at row %" PRIu32
", col %" PRIu32
1503 "Read error at row %" PRIu32
", col %" PRIu32
1534 "Read error at row %" PRIu32
", col %" PRIu32
1551 static const char module[] = "TIFFReadRawTile";
1553 uint64_t bytecount64;
1556 if ((size < 0) && (size != (
tmsize_t)(-1)))
1563 if (tile >= td->td_nstrips)
1566 "%" PRIu32
": Tile out of range, max %" PRIu32, tile,
1573 "Compression scheme does not support access to raw "
1574 "uncompressed data");
1578 if (size != (
tmsize_t)(-1) && (uint64_t)size <= bytecount64)
1582 if (bytecountm == 0)
1616 static const char module[] = "TIFFFillTile";
1625 "%" PRIu64
": Invalid tile byte count, tile %" PRIu32,
1634 if (bytecount > 1024 * 1024 &&
1635 (bytecount - 4096) / 10 > (uint64_t)tilesize)
1647 uint64_t newbytecount = (uint64_t)tilesize * 10 + 4096;
1649 "Too large tile byte count %" PRIu64
1650 ", tile %" PRIu32
". Limiting to %" PRIu64,
1651 bytecount, tile, newbytecount);
1652 bytecount = newbytecount;
1654 else if (tilesize > 100 * 1024 * 1024)
1661 const uint64_t maxCompressionRatio =
1663 if (maxCompressionRatio > 0 &&
1664 bytecount < (uint64_t)tilesize / maxCompressionRatio)
1667 "Likely invalid tile byte count for tile %u. "
1668 "Uncompressed tile size is %" PRIu64
", "
1669 "compressed one is %" PRIu64,
1670 tile, (uint64_t)tilesize, bytecount);
1687 if (bytecount > (uint64_t)tif->
tif_size ||
1689 (uint64_t)tif->
tif_size - bytecount)
1718 uint8_t *mapped_rawdata =
1735 if ((uint64_t)bytecountm != bytecount)
1746 "Data buffer too small to hold tile %" PRIu32,
1767 module) != bytecountm)
1804 static const char module[] = "TIFFReadBufferSetup";
1809 "Compression scheme does not support access to raw "
1810 "uncompressed data");
1839 uint8_t *new_rawdata;
1840 if (new_rawdatasize == 0)
1847 new_rawdata = (uint8_t *)
_TIFFcallocExt(tif, 1, new_rawdatasize);
1850 if (new_rawdata == NULL)
1853 "No space for data buffer at scanline %" PRIu32,
1888 static const char module[] = "TIFFStartStrip";
1897 if (td->td_stripsperimage == 0)
1921 if ((*tif->
tif_predecode)(tif, (uint16_t)(strip / td->td_stripsperimage)) ==
1961 static const char module[] = "TIFFStartTile";
1972 if (td->td_tilewidth == 0)
1983 if (td->td_tilelength == 0)
1991 howmany32 =
TIFFhowmany_32(td->td_imagelength, td->td_tilelength);
2015 (*tif->
tif_predecode)(tif, (uint16_t)(tile / td->td_stripsperimage)));
2046 tiles ?
"Can not read tiles from a striped image"
2047 :
"Can not read scanlines from a tiled image");
2084 static const char module[] = "TIFFReadFromUserBuffer";
2087 uint32_t old_tif_flags = tif->
tif_flags;
2105 "Compression scheme does not support access to raw "
2106 "uncompressed data");
2135 memset(outbuf, 0, (
size_t)outsize);
2138 tif, (uint8_t *)outbuf, outsize,
2139 (uint16_t)(strile / td->td_stripsperimage)) <= 0)
2146 uint32_t rowsperstrip = td->td_rowsperstrip;
2147 uint32_t stripsperplane;
2148 if (rowsperstrip > td->td_imagelength)
2149 rowsperstrip = td->td_imagelength;
2150 if (rowsperstrip == 0)
2164 memset(outbuf, 0, (
size_t)outsize);
2167 tif, (uint8_t *)outbuf, outsize,
2168 (uint16_t)(strile / stripsperplane)) <= 0)
2221 " is odd. Result might be incorrect",
2231 " is not a multiple of 3. Result might be incorrect",
2241 " is not a multiple of 4. Result might be incorrect",
2251 " is not a multiple of 8. Result might be incorrect",
2261 tmsize_t cc,
const char *modulename)
2264 static const char multiplenumber[] = {2, 3, 4, 8};
2265 static const char *
const postdecodename[] = {
2266 "_TIFFSwab16BitData",
"_TIFFSwab24BitData",
"_TIFFSwab32BitData",
2267 "_TIFFSwab64BitData"};
2281 ") to swap with %s is not a multiple of %d; rejected",
2282 cc, postdecodename[idx], multiplenumber[idx]);
uint32_t _TIFFCastUInt64ToUInt32(TIFF *tif, uint64_t val, const char *module)
Convert an unsigned 64-bit value after checking the destination range.
uint64_t _TIFFAdd64(TIFF *tif, uint64_t first, uint64_t second, const char *where)
Check and add two unsigned operands.
tmsize_t _TIFFCastUInt64ToSSize(TIFF *tif, uint64_t val, const char *module)
Convert an unsigned 64-bit value after checking the destination range.
uint64_t _TIFFMultiply64(TIFF *tif, uint64_t first, uint64_t second, const char *where)
Multiply two unsigned values with an overflow check.
#define TIFF_SSIZE_FORMAT
Provide the printf conversion fragment for tmsize_t, without a percent sign.
#define NOSTRIP
Represent the absence of a current strip with UINT32_MAX.
#define NOTILE
Represent the absence of a current tile with UINT32_MAX.
uint32_t _TIFFComputeTileExt(TIFF *tif, uint32_t x, uint32_t y, uint32_t z, uint16_t s, bool *pOverflowed)
Compute a tile index as TIFFComputeTile() does, and record an index overflow in a caller-provided fla...
#define TIFF_INT64_MAX
Bound accepted raw strile byte counts to INT64_MAX.
tmsize_t _TIFFReadEncodedTileAndAllocBuffer(TIFF *tif, uint32_t tile, void **buf, tmsize_t bufsizetoalloc, tmsize_t size_to_read)
Decode after deferred allocation of caller-owned output storage.
#define INITIAL_THRESHOLD
Start progressive raw-buffer reads at one MiB.
int _TIFFCheckPostDecodeLength(TIFF *tif, TIFFPostMethod tif_postdecode, tmsize_t cc, const char *modulename)
Check the byte count for a byte-swapping postdecode method.
static tmsize_t TIFFReadRawStrip1(TIFF *tif, uint32_t strip, void *buf, tmsize_t size, const char *module)
Read an exact raw-strip byte extent into caller storage.
#define MAX_THRESHOLD
Set the allocation-growth cutoff to 1000 MiB.
void _TIFFNoPostDecode(TIFF *tif, uint8_t *buf, tmsize_t cc)
Leave decoded bytes unchanged.
tmsize_t _TIFFReadEncodedStripAndAllocBuffer(TIFF *tif, uint32_t strip, void **buf, tmsize_t bufsizetoalloc, tmsize_t size_to_read)
Decode after deferred allocation of caller-owned output storage.
static TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW uint64_t NoSanitizeSubUInt64(uint64_t a, uint64_t b)
Subtract unsigned offsets with intentional modular arithmetic.
tmsize_t _TIFFReadTileAndAllocBuffer(TIFF *tif, void **buf, tmsize_t bufsizetoalloc, uint32_t x, uint32_t y, uint32_t z, uint16_t s)
Decode after deferred allocation of caller-owned output storage.
static int TIFFSeek(TIFF *tif, uint32_t row, uint16_t sample)
Position strip decoding at a requested scanline.
void(* TIFFPostMethod)(TIFF *tif, uint8_t *buf, tmsize_t size)
Transform image bytes in place after decoding or before encoding.
static tmsize_t TIFFReadRawStripOrTile2(TIFF *tif, uint32_t strip_or_tile, int is_strip, tmsize_t size, const char *module)
Seek to a strile and read bytes into the expandable raw cache.
static tmsize_t TIFFReadEncodedStripGetStripSize(TIFF *tif, uint32_t strip, uint16_t *pplane)
Validate a strip and compute its effective decoded extent.
void _TIFFSwab24BitData(TIFF *tif, uint8_t *buf, tmsize_t cc)
Swap each 3-byte sample in place.
void _TIFFSwab16BitData(TIFF *tif, uint8_t *buf, tmsize_t cc)
Swap each 2-byte sample in place.
static int TIFFReadAndRealloc(TIFF *tif, tmsize_t size, tmsize_t rawdata_offset, int is_strip, uint32_t strip_or_tile, const char *module)
Grow and fill the raw buffer from the current client position.
#define THRESHOLD_MULTIPLIER
Grow raw-buffer read allocation stages by a factor of ten.
static int TIFFStartStrip(TIFF *tif, uint32_t strip)
Prepare the codec and raw cursor for strip decoding.
int TIFFFillTile(TIFF *tif, uint32_t tile)
Load raw tile bytes and initialise codec decoding.
void _TIFFSwab32BitData(TIFF *tif, uint8_t *buf, tmsize_t cc)
Swap each 4-byte sample in place.
static tmsize_t TIFFReadRawTile1(TIFF *tif, uint32_t tile, void *buf, tmsize_t size, const char *module)
Read an exact raw-tile byte extent into caller storage.
int TIFFFillStrip(TIFF *tif, uint32_t strip)
Load raw strip bytes and initialise codec decoding.
static int TIFFCheckRead(TIFF *, int)
Check readable mode and expected image organisation.
void _TIFFSwab64BitData(TIFF *tif, uint8_t *buf, tmsize_t cc)
Swap each 8-byte sample in place.
static int TIFFStartTile(TIFF *tif, uint32_t tile)
Prepare the codec and raw cursor for tile decoding.
static int TIFFFillStripPartial(TIFF *tif, int strip, tmsize_t read_ahead, int restart)
Refill a partial raw strip while retaining unconsumed bytes.
int TIFFJPEGIsFullStripRequired(TIFF *tif)
Probe whether cached JPEG input needs whole-strile decoding.
void _TIFFfreeExt(TIFF *tif, void *p)
Release a handle-aware allocation and its payload charge.
void * _TIFFreallocExt(TIFF *tif, void *p, tmsize_t s)
Resize a handle-aware block or release it for a nonpositive size.
void * _TIFFmallocExt(TIFF *tif, tmsize_t s)
Allocate uninitialised bytes under a handle's allocation policy.
void * _TIFFcallocExt(TIFF *tif, tmsize_t nmemb, tmsize_t siz)
Allocate a zero-filled array under a handle's allocation policy.
#define TIFFroundup_64(x, y)
Round a 64-bit value up to a multiple without overflow checks.
#define TIFFReadFile(tif, buf, size)
Invoke the handle's client read callback.
#define isTiled(tif)
Test whether a handle uses tiled storage.
#define TIFF_MYBUFFER
Mark a raw buffer owned and released by the handle.
#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
Suppress unsigned-overflow instrumentation on supported Clang functions.
#define TIFFhowmany_32_maxuint_compat(x, y)
Compute a 32-bit ceiling quotient without adding x and y first.
#define TIFF_CODERSETUP
Mark completed codec setup.
#define TIFFSafeModMul32(tif, module, index, count, dimension, result)
Compute (index modulo count) times dimension with a checked product.
#define TIFF_BUF4WRITE
Interpret the raw buffer and its byte count as pending output.
#define SeekOK(tif, off)
Test whether an absolute seek reaches the requested file position.
#define isMapped(tif)
Test whether TIFF_MAPPED is set on a handle.
#define isFillOrder(tif, o)
Test whether selected bit-fill-order bits are present in a handle.
#define TIFFGetFileSize(tif)
Invoke the handle's client size callback.
#define TIFF_NOREADRAW
Suppress the normal raw-data read path.
#define TIFFhowmany_32(x, y)
Compute a guarded 32-bit ceiling quotient.
#define TIFF_NOBITREV
Suppress automatic bit reversal.
#define TIFF_BUFFERMMAP
Mark raw data that borrows mapped-file storage.
void TIFFSwabArrayOfTriples(uint8_t *tp, tmsize_t n)
Reverse the byte order of each array element.
void TIFFSwabArrayOfDouble(double *dp, tmsize_t n)
Reverse the byte order of each array element.
void TIFFSwabArrayOfShort(uint16_t *wp, tmsize_t n)
Reverse the byte order of each array element.
void TIFFSwabArrayOfLong(uint32_t *lp, tmsize_t n)
Reverse the byte order of each array element.
void TIFFReverseBits(uint8_t *cp, tmsize_t n)
Reverse the bit order within each byte of a buffer.
void TIFFWarningExtR(TIFF *tif, const char *module, const char *fmt,...)
Dispatch a warning diagnostic to the configured handlers.
void TIFFErrorExtR(TIFF *tif, const char *module, const char *fmt,...)
Dispatch a error diagnostic to the configured handlers.
int TIFFReadBufferSetup(TIFF *tif, void *bp, tmsize_t size)
Replace the handle's raw reading buffer.
uint64_t TIFFGetMaxCompressionRatio(TIFF *tif)
Query the codec's allocation-recovery compression-ratio heuristic.
tmsize_t TIFFTileSize(TIFF *tif)
Compute the decoded-size estimate for the configured tile height.
tmsize_t TIFFStripSize(TIFF *tif)
Compute the decoded-size estimate for a nominal strip.
tmsize_t TIFFVStripSize(TIFF *tif, uint32_t nrows)
Compute the decoded-size estimate for a requested strip height.
int TIFFCheckTile(TIFF *tif, uint32_t x, uint32_t y, uint32_t z, uint16_t s)
Check pixel and separate-sample coordinates against image bounds.
int TIFFReadScanline(TIFF *tif, void *buf, uint32_t row, uint16_t sample)
Decode one image scanline into caller storage.
int TIFFReadFromUserBuffer(TIFF *tif, uint32_t strile, void *inbuf, tmsize_t insize, void *outbuf, tmsize_t outsize)
Decode one strile from caller-provided stored bytes.
tmsize_t TIFFReadRawStrip(TIFF *tif, uint32_t strip, void *buf, tmsize_t size)
Read stored bytes from one strip.
tmsize_t TIFFReadRawTile(TIFF *tif, uint32_t tile, void *buf, tmsize_t size)
Read stored bytes from one tile.
tmsize_t TIFFReadEncodedStrip(TIFF *tif, uint32_t strip, void *buf, tmsize_t size)
Read decoded samples from one strip.
tmsize_t TIFFReadTile(TIFF *tif, void *buf, uint32_t x, uint32_t y, uint32_t z, uint16_t s)
Decode the tile containing image coordinates.
tmsize_t TIFFReadEncodedTile(TIFF *tif, uint32_t tile, void *buf, tmsize_t size)
Read decoded samples from one tile.
const char * TIFFFileName(TIFF *tif)
Return the handle's diagnostic filename.
int TIFFFlushData(TIFF *tif)
Flush pending encoded image data without committing directory changes.
int TIFFIsTiled(TIFF *tif)
Test whether the current image uses tiles.
void _TIFFmemset(void *p, int v, tmsize_t c)
Fill a byte range with one repeated byte.
void _TIFFmemcpy(void *d, const void *s, tmsize_t c)
Copy a non-overlapping byte range.
TIFF_SSIZE_T tmsize_t
Represent a signed memory or I/O size in bytes.
#define TIFF_TMSIZE_T_MAX
Define the largest positive size representable by tmsize_t.
Store the current directory values and image traversal state.
tmsize_t td_tilesize
Cached decoded tile size in bytes; minus one when invalidated.
uint32_t td_rowsperstrip
Rows per strip; UINT32_MAX represents one whole-image strip.
uint16_t td_compression
COMPRESSION_* codec identifier.
tmsize_t td_scanlinesize
Cached decoded scanline size in bytes; zero when not computed.
uint32_t td_row
Current scanline index; UINT32_MAX before traversal starts.
uint32_t td_stripsperimage
Strips or tiles per sample plane, despite the historic name.
uint16_t td_planarconfig
PLANARCONFIG_* sample-plane arrangement.
uint32_t td_col
Current pixel column; UINT32_MAX before traversal starts.
uint16_t td_samplesperpixel
Samples per pixel, including extra samples.
uint32_t td_imagelength
Image length in rows.
uint32_t td_curtile
Current tile index, or NOTILE.
uint32_t td_curstrip
Current strip index, or NOSTRIP.
Hold private state for one open TIFF library instance.
TIFFSeekMethod tif_seek
Codec callback advancing within a strip.
tmsize_t tif_rawdataloaded
Number of bytes loaded into the raw-buffer window.
tmsize_t tif_rawcc
Raw-buffer byte count interpreted according to read/write state.
TIFFPreMethod tif_predecode
Codec callback preparing a row, strip, or tile decode.
TIFFCodeMethod tif_decodestrip
Codec callback decoding strip data.
TIFFPostMethod tif_postdecode
Callback transforming decoded data, for example by byte swapping.
char * tif_name
Current filename pointer; may refer to inline or client-supplied storage.
TIFFCodeMethod tif_decoderow
Codec callback decoding a scanline.
TIFFDirectory tif_dir
Inline representation of the current image directory.
tmsize_t tif_size
Mapped-file region length in bytes.
uint8_t * tif_rawcp
Borrowed current-position pointer into the raw buffer.
TIFFBoolMethod tif_setupdecode
Codec setup callback run before predecode.
uint8_t * tif_rawdata
Raw buffer; ownership/mapping follow TIFF_MYBUFFER and TIFF_BUFFERMMAP.
tmsize_t tif_rawdatasize
Raw-buffer capacity in bytes; kept in step with tif_rawdata, including zero whenever tif_rawdata is N...
tmsize_t tif_rawdataoff
Byte offset of the raw-buffer window within the strip.
uint32_t tif_flags
Bitmask combining the TIFF_* handle-state flags declared below.
TIFFCodeMethod tif_decodetile
Codec callback decoding tile data.
int tif_mode
Current access mode using the O_* constants.
uint8_t * tif_base
Mapped-file base provided by tif_mapproc; released through tif_unmapproc by TIFFCleanup() only while ...
Declare private library state, callbacks, and implementation helpers.