LibTIFF 4.7.2
TIFF library public API and implementation reference
Loading...
Searching...
No Matches
Macros | Functions
tif_read.c File Reference

Transfer image bytes through raw buffers and codec methods. More...

#include "tiffiop.h"
#include <limits.h>
#include <stdio.h>
Include dependency graph for tif_read.c:

Go to the source code of this file.

Macros

#define INITIAL_THRESHOLD   (1024 * 1024)
 Start progressive raw-buffer reads at one MiB.
 
#define THRESHOLD_MULTIPLIER   10
 Grow raw-buffer read allocation stages by a factor of ten.
 
#define MAX_THRESHOLD
 Set the allocation-growth cutoff to 1000 MiB.
 
#define TIFF_INT64_MAX   ((((int64_t)0x7FFFFFFF) << 32) | 0xFFFFFFFF)
 Bound accepted raw strile byte counts to INT64_MAX.
 

Functions

int TIFFFillStrip (TIFF *tif, uint32_t strip)
 Load raw strip bytes and initialise codec decoding.
 
int TIFFFillTile (TIFF *tif, uint32_t tile)
 Load raw tile bytes and initialise codec decoding.
 
static int TIFFStartStrip (TIFF *tif, uint32_t strip)
 Prepare the codec and raw cursor for strip decoding.
 
static int TIFFStartTile (TIFF *tif, uint32_t tile)
 Prepare the codec and raw cursor for tile decoding.
 
static int TIFFCheckRead (TIFF *tif, int tiles)
 Check readable mode and expected image organisation.
 
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.
 
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.
 
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.
 
static int TIFFFillStripPartial (TIFF *tif, int strip, tmsize_t read_ahead, int restart)
 Refill a partial raw strip while retaining unconsumed bytes.
 
static int TIFFSeek (TIFF *tif, uint32_t row, uint16_t sample)
 Position strip decoding at a requested scanline.
 
int TIFFReadScanline (TIFF *tif, void *buf, uint32_t row, uint16_t sample)
 Decode one image scanline into caller storage.
 
static tmsize_t TIFFReadEncodedStripGetStripSize (TIFF *tif, uint32_t strip, uint16_t *pplane)
 Validate a strip and compute its effective decoded extent.
 
tmsize_t TIFFReadEncodedStrip (TIFF *tif, uint32_t strip, void *buf, tmsize_t size)
 Read decoded samples from one strip.
 
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 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.
 
tmsize_t TIFFReadRawStrip (TIFF *tif, uint32_t strip, void *buf, tmsize_t size)
 Read stored bytes from one strip.
 
static TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW uint64_t NoSanitizeSubUInt64 (uint64_t a, uint64_t b)
 Subtract unsigned offsets with intentional modular arithmetic.
 
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.
 
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.
 
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.
 
tmsize_t TIFFReadRawTile (TIFF *tif, uint32_t tile, void *buf, tmsize_t size)
 Read stored bytes from one tile.
 
int TIFFReadBufferSetup (TIFF *tif, void *bp, tmsize_t size)
 Replace the handle's raw reading buffer.
 
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.
 
void _TIFFNoPostDecode (TIFF *tif, uint8_t *buf, tmsize_t cc)
 Leave decoded bytes unchanged.
 
void _TIFFSwab16BitData (TIFF *tif, uint8_t *buf, tmsize_t cc)
 Swap each 2-byte sample in place.
 
void _TIFFSwab24BitData (TIFF *tif, uint8_t *buf, tmsize_t cc)
 Swap each 3-byte sample in place.
 
void _TIFFSwab32BitData (TIFF *tif, uint8_t *buf, tmsize_t cc)
 Swap each 4-byte sample in place.
 
void _TIFFSwab64BitData (TIFF *tif, uint8_t *buf, tmsize_t cc)
 Swap each 8-byte sample in place.
 
int _TIFFCheckPostDecodeLength (TIFF *tif, TIFFPostMethod tif_postdecode, tmsize_t cc, const char *modulename)
 Check the byte count for a byte-swapping postdecode method.
 

Detailed Description

Transfer image bytes through raw buffers and codec methods.

Definition in file tif_read.c.