|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Compute row/strile sizes and dispatch codec sizing recommendations. More...
Typedefs | |
| typedef uint32_t(* | TIFFStripMethod) (TIFF *tif, uint32_t request) |
| Recommend rows per strip for the current geometry and codec. | |
| typedef void(* | TIFFTileMethod) (TIFF *tif, uint32_t *tw, uint32_t *th) |
| Adjust tile width and height for the current codec. | |
Functions | |
| uint32_t | _TIFFDefaultStripSize (TIFF *tif, uint32_t s) |
| Choose a default strip height near STRIP_SIZE_DEFAULT bytes. | |
| void | _TIFFDefaultTileSize (TIFF *tif, uint32_t *tw, uint32_t *th) |
| Supply default tile dimensions and round them to multiples of sixteen. | |
| 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 flag. | |
| uint64_t | _TIFFStrileSize64 (TIFF *tif, uint32_t nrows, int isStrip) |
| Compute row-aligned decoded storage for a strip or tile-height request. | |
Compute row/strile sizes and dispatch codec sizing recommendations.
| typedef uint32_t(* TIFFStripMethod) (TIFF *tif, uint32_t request) |
Recommend rows per strip for the current geometry and codec.
Invoked synchronously by TIFFDefaultStripSize() through a borrowed installed method. Return a recommendation without transferring ownership; dispatch does not apply it to the directory or validate it. The implementation may inspect/change codec state, call getters, allocate, or report diagnostics. Preserve the established geometry unless documented by the codec and keep callback code/context live while installed/in flight. No status channel separate from the row count is provided.
| [in,out] | tif | Non-NULL live handle with consistent current geometry; queries may use getters/callbacks. Serialise access externally. |
| [in] | request | Requested row count, typically zero for a heuristic; default method uses signed 32-bit interpretation. |
| typedef void(* TIFFTileMethod) (TIFF *tif, uint32_t *tw, uint32_t *th) |
Adjust tile width and height for the current codec.
Invoked synchronously by TIFFDefaultTileSize() with borrowed writable slots. The installed method must leave a documented recommendation, normally valid multiples of sixteen, without transferring ownership. Dispatch does not apply tags or validate results. Codec state, allocation, getter, and diagnostic effects depend on the method; there is no return status or automatic recovery. Keep code/context live while installed/in flight and serialise handle access.
| [in,out] | tif | Non-NULL live handle with consistent current geometry; queries may use getters/callbacks. Serialise access externally. |
| [in,out] | tw | Non-NULL caller-owned width request/result in pixels. |
| [in,out] | th | Non-NULL caller-owned height request/result in rows. |
|
extern |
Compute a tile index as TIFFComputeTile() does, and record an index overflow in a caller-provided flag.
TIFFComputeTile() calls this with a NULL flag. Zero is a valid tile index, so the return value alone cannot tell an overflow apart. When the tile index overflows, emits an error and sets *pOverflowed to true when pOverflowed is not NULL; the flag is never reset to false. A sample out of range for separate storage emits an error and returns zero without setting the flag: callers that test the flag are expected to have checked the coordinates with TIFFCheckTile() first. Does not validate or clamp x/y/z to the image. Does not allocate, perform I/O, or acquire ownership.
| [in] | tif | Non-NULL live handle with consistent current geometry; no ownership transfer. |
| [in] | x | Pixel column; not checked against ImageWidth. |
| [in] | y | Pixel row; not checked against ImageLength. |
| [in] | z | Depth slice; forced to zero when ImageDepth is one. |
| [in] | s | Separate sample plane; ignored for contiguous storage. |
| [out] | pOverflowed | Overflow flag, or NULL; set to true when the tile index overflows and left unchanged otherwise. |
Definition at line 52 of file tif_tile.c.
References _TIFFAdd64Ext(), _TIFFCastUInt64ToUInt32Ext(), _TIFFMultiply32Ext(), PLANARCONFIG_SEPARATE, TIFFDirectory::td_tilewidth, tiff::tif_dir, TIFFErrorExtR(), and TIFFhowmany_32.
Referenced by _TIFFReadTileAndAllocBuffer(), TIFFComputeTile(), TIFFReadTile(), and TIFFWriteTile().
|
extern |
Choose a default strip height near STRIP_SIZE_DEFAULT bytes.
Interprets s through int32_t: zero or high-bit unsigned requests trigger the heuristic; positive signed-range requests pass through. Divides STRIP_SIZE_DEFAULT by TIFFScanlineSize64(), using one byte if that query returned zero, then clamps rows to [1,UINT32_MAX]. A diagnostic from scanline sizing does not prevent a recommendation. Does not set tags or allocate output; the scanline query may use getters/callbacks. No ownership transfer.
| [in,out] | tif | Non-NULL live handle with consistent current geometry; queries may use getters/callbacks. Serialise access externally. |
| [in] | s | Requested rows; interpreted as a signed 32-bit value for heuristic selection. |
Definition at line 263 of file tif_strip.c.
References STRIP_SIZE_DEFAULT, and TIFFScanlineSize64().
Referenced by _TIFFSetDefaultCompressionState().
|
extern |
Supply default tile dimensions and round them to multiples of sixteen.
Reads each uint32_t request through its signed 32-bit representation. Nonpositive values, including high-bit unsigned requests, become 256; positive requests are rounded upward to a multiple of sixteen. Does not inspect tif, set tags, allocate, perform I/O, issue diagnostics, or transfer ownership. Both result slots remain caller-owned.
| [in] | tif | Unused compatibility context; may be NULL for this default implementation. |
| [in,out] | tw | Non-NULL writable width request/result in pixels. |
| [in,out] | th | Non-NULL writable height request/result in rows. |
Definition at line 326 of file tif_tile.c.
References TIFFroundup_32.
Referenced by _TIFFSetDefaultCompressionState().
|
extern |
Compute row-aligned decoded storage for a strip or tile-height request.
Strip mode maps UINT32_MAX rows to ImageLength. Tile mode rejects zero tile width/length/depth silently but does not multiply by depth. Packed contiguous non-upsampled YCbCr requires exactly three samples and horizontal/vertical factors each in {1,2,4}; invokes the defaulted subsampling getter, rounds width/height to sampling blocks and the entire horizontal block-row bit total to bytes, then multiplies by vertical block count. Other layouts multiply nrows by the scanline or tile-row estimate. Invalid YCbCr sample count or subsampling factors report an error and return zero. Checked products diagnose overflow, but conservative ceiling guards can return zero silently. Allocates no output and does not decode pixels; getters can mutate lookup/cache state or invoke callbacks. No ownership transfer; caller must establish consistent geometry.
| [in,out] | tif | Non-NULL live handle with consistent current geometry; queries may use getters/callbacks. Serialise access externally. |
| [in] | nrows | Row count; UINT32_MAX is an all-image sentinel only in strip mode. |
| [in] | isStrip | Nonzero selects strip width/scanline and sentinel handling; zero selects tile geometry. |
Definition at line 106 of file tif_strip.c.
References _TIFFMultiply64(), isUpSampled, PHOTOMETRIC_YCBCR, PLANARCONFIG_CONTIG, TIFFDirectory::td_imagelength, tiff::tif_dir, TIFFErrorExtR(), TIFFGetFieldDefaulted(), TIFFhowmany8_64, TIFFhowmany_32, TIFFScanlineSize64(), TIFFTAG_YCBCRSUBSAMPLING, and TIFFTileRowSize64().
Referenced by TIFFVStripSize64(), and TIFFVTileSize64().