LibTIFF 4.7.2
TIFF library public API and implementation reference
Loading...
Searching...
No Matches
Macros | Functions | Variables
RGBA getters maps and packers

Read supported image layouts into associated eight-bit RGBA rasters. More...

Collaboration diagram for RGBA getters maps and packers:

Macros

#define FLIP_VERTICALLY   0x01
 Select reversed raster row order.
 
#define FLIP_HORIZONTALLY   0x02
 Select reversal within copied raster rows.
 
#define EMSG_BUF_SIZE   1024
 Reserve 1024 bytes for RGBA rejection messages.
 
#define REPEAT8(op)
 Expand an operation eight times.
 
#define REPEAT4(op)
 Expand an operation four times.
 
#define REPEAT2(op)
 Expand an operation twice.
 
#define CASE8(x, op)
 Dispatch an eight-pixel unrolled remainder.
 
#define CASE4(x, op)
 Dispatch a four-pixel unrolled remainder.
 
#define NOP
 Supply an empty loop operation.
 
#define UNROLL8(w, op1, op2)
 Traverse complete eight-pixel groups and their remainder.
 
#define UNROLL4(w, op1, op2)
 Traverse complete four-pixel groups and their remainder.
 
#define UNROLL2(w, op1, op2)
 Traverse complete two-pixel groups and their remainder.
 
#define SKEW(r, g, b, skew)
 Advance three plane pointers by a source skew.
 
#define SKEW4(r, g, b, a, skew)
 Advance four plane pointers by a source skew.
 
#define A1   (((uint32_t)0xffL) << 24)
 Set an opaque alpha byte in a packed word.
 
#define PACK(r, g, b)    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
 Pack RGB bytes with opaque alpha.
 
#define PACK4(r, g, b, a)
 Pack RGB and alpha bytes.
 
#define DECLAREContigPutFunc(name)
 Declare the concrete contiguous packer signature.
 
#define DECLARESepPutFunc(name)
 Declare the concrete separate-plane packer signature.
 
#define YCbCrtoRGB(dst, Y)
 Convert a local YCbCr group and pack an opaque output word.
 
#define GREY(x)
 Append a grayscale-map entry to the expansion table.
 
#define CVT(x)   ((uint16_t)((x) >> 8))
 Reduce a palette entry to its high byte.
 
#define CMAP(x)
 Append a palette-map entry to the expansion table.
 

Functions

static uint16_t checkedOrientation (uint16_t orientation)
 Validate a TIFF orientation number.
 
static int isCCITTCompression (TIFF *tif)
 Recognise CCITT fax compression schemes.
 
static int setorientation (TIFFRGBAImage *img)
 Choose horizontal and vertical raster flips.
 
static int calcCopyToRasterParameter (TIFFRGBAImage *img, uint32_t *raster, uint32_t rwidth, uint32_t rheight, uint32_t *pwcpy, uint32_t *phcpy, int *pflip, uint32_t **pp_raster_start, int32_t *ptoskew, uint32_t *py, bool isTiled, uint32_t tilewidth, const char *funcName)
 Compute clipped raster placement and signed row steps.
 
static int checkColOffsetByteAligned (TIFFRGBAImage *img, const char *module, uint64_t bitoffset)
 Reject a packed-sample offset between byte boundaries.
 
static int gtTileContig (TIFFRGBAImage *img, uint32_t *raster, uint32_t rwidth, uint32_t rheight)
 Read contiguous tiles into a clipped RGBA raster.
 
static int gtTileSeparate (TIFFRGBAImage *img, uint32_t *raster, uint32_t rwidth, uint32_t rheight)
 Read separate-plane tiles into a clipped RGBA raster.
 
static int gtStripContig (TIFFRGBAImage *img, uint32_t *raster, uint32_t rwidth, uint32_t rheight)
 Read contiguous strips into a clipped RGBA raster.
 
static int gtStripSeparate (TIFFRGBAImage *img, uint32_t *raster, uint32_t rwidth, uint32_t rheight)
 Read separate-plane strips into a clipped RGBA raster.
 
static void put8bitcmaptile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack 8bitcmaptile samples into RGBA words.
 
static void put4bitcmaptile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack 4bitcmaptile samples into RGBA words.
 
static void put2bitcmaptile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack 2bitcmaptile samples into RGBA words.
 
static void put1bitcmaptile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack 1bitcmaptile samples into RGBA words.
 
static void putgreytile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack greytile samples into RGBA words.
 
static void putagreytile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack agreytile samples into RGBA words.
 
static void put16bitbwtile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack 16bitbwtile samples into RGBA words.
 
static void put1bitbwtile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack 1bitbwtile samples into RGBA words.
 
static void put2bitbwtile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack 2bitbwtile samples into RGBA words.
 
static void put4bitbwtile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack 4bitbwtile samples into RGBA words.
 
static void putRGBcontig8bittile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack RGBcontig8bittile samples into RGBA words.
 
static void putRGBAAcontig8bittile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack RGBAAcontig8bittile samples into RGBA words.
 
static void putRGBUAcontig8bittile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack RGBUAcontig8bittile samples into RGBA words.
 
static void putRGBcontig16bittile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack RGBcontig16bittile samples into RGBA words.
 
static void putRGBAAcontig16bittile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack RGBAAcontig16bittile samples into RGBA words.
 
static void putRGBUAcontig16bittile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack RGBUAcontig16bittile samples into RGBA words.
 
static void putRGBcontig8bitCMYKtile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack RGBcontig8bitCMYKtile samples into RGBA words.
 
static void putRGBcontig8bitCMYKMaptile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack RGBcontig8bitCMYKMaptile samples into RGBA words.
 
static void putRGBseparate8bittile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a)
 Pack RGBseparate8bittile samples into RGBA words.
 
static void putRGBAAseparate8bittile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a)
 Pack RGBAAseparate8bittile samples into RGBA words.
 
static void putCMYKseparate8bittile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a)
 Pack CMYKseparate8bittile samples into RGBA words.
 
static void putRGBUAseparate8bittile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a)
 Pack RGBUAseparate8bittile samples into RGBA words.
 
static void putRGBseparate16bittile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a)
 Pack RGBseparate16bittile samples into RGBA words.
 
static void putRGBAAseparate16bittile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a)
 Pack RGBAAseparate16bittile samples into RGBA words.
 
static void putRGBUAseparate16bittile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a)
 Pack RGBUAseparate16bittile samples into RGBA words.
 
static void putcontig8bitCIELab8 (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack contig8bitCIELab8 samples into RGBA words.
 
static void putcontig8bitCIELab16 (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack contig8bitCIELab16 samples into RGBA words.
 
static void putcontig8bitYCbCr44tile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack contig8bitYCbCr44tile samples into RGBA words.
 
static void putcontig8bitYCbCr42tile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack contig8bitYCbCr42tile samples into RGBA words.
 
static void putcontig8bitYCbCr41tile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack contig8bitYCbCr41tile samples into RGBA words.
 
static void putcontig8bitYCbCr22tile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack contig8bitYCbCr22tile samples into RGBA words.
 
static void putcontig8bitYCbCr21tile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack contig8bitYCbCr21tile samples into RGBA words.
 
static void putcontig8bitYCbCr12tile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack contig8bitYCbCr12tile samples into RGBA words.
 
static void putcontig8bitYCbCr11tile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
 Pack contig8bitYCbCr11tile samples into RGBA words.
 
static void putseparate8bitYCbCr11tile (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a)
 Pack separate8bitYCbCr11tile samples into RGBA words.
 
static int isInRefBlackWhiteRange (float f)
 Check a reference endpoint against conversion integer bounds.
 
static int initYCbCrConversion (TIFFRGBAImage *img)
 Allocate and initialise RGBA YCbCr contribution tables.
 
static tileContigRoutine initCIELabConversion (TIFFRGBAImage *img)
 Prepare Lab state and select an 8- or 16-bit packer.
 
static int makebwmap (TIFFRGBAImage *img)
 Build byte-indexed packed grayscale expansion tables.
 
static int setupMap (TIFFRGBAImage *img)
 Build sample scaling and grayscale unpacking maps.
 
static int checkcmap (TIFFRGBAImage *img)
 Infer whether copied palette entries use eight or sixteen bits.
 
static void cvtcmap (TIFFRGBAImage *img)
 Reduce all copied palette entries to their high byte.
 
static int makecmap (TIFFRGBAImage *img)
 Build byte-indexed packed palette expansion tables.
 
static int buildMap (TIFFRGBAImage *img)
 Build the lookup maps needed by a selected photometric case.
 
static int PickContigCase (TIFFRGBAImage *img)
 Select contiguous get/put callbacks for the conversion.
 
static int PickSeparateCase (TIFFRGBAImage *img)
 Select separate-plane get/put callbacks for the conversion.
 
static int BuildMapUaToAa (TIFFRGBAImage *img)
 Build the unassociated-to-associated eight-bit channel map.
 
static int BuildMapBitdepth16To8 (TIFFRGBAImage *img)
 Build rounded sixteen-to-eight-bit sample reduction.
 

Variables

static const char photoTag [] = "PhotometricInterpretation"
 Name the photometric tag in diagnostic messages.
 
static const TIFFDisplay display_sRGB
 Describe the fixed display transform used for Lab output.
 
static char const *const orientationStrings []
 Map checked orientation numbers to diagnostic labels.
 

Detailed Description

Read supported image layouts into associated eight-bit RGBA rasters.

Macro Definition Documentation

◆ A1

#define A1   (((uint32_t)0xffL) << 24)

Set an opaque alpha byte in a packed word.

Value 0xff000000: the alpha (most significant) byte of a packed raster word set to fully opaque.

Definition at line 2220 of file tif_getimage.c.

◆ CASE4

#define CASE4 (   x,
  op 
)
Value:
switch (x) \
{ \
case 3: \
op; /*-fallthrough*/ \
case 2: \
op; /*-fallthrough*/ \
case 1: \
op; \
break; \
default: \
break; \
}

Dispatch a four-pixel unrolled remainder.

Expands to a switch that falls through to execute op x times for x in 1..3; other values execute nothing. x is evaluated once.

Parameters
[in]xRemaining pixel count.
[in]opStatement to expand; it may modify local cursors.

Definition at line 2073 of file tif_getimage.c.

◆ CASE8

#define CASE8 (   x,
  op 
)
Value:
switch (x) \
{ \
case 7: \
op; /*-fallthrough*/ \
case 6: \
op; /*-fallthrough*/ \
case 5: \
op; /*-fallthrough*/ \
case 4: \
op; /*-fallthrough*/ \
case 3: \
op; /*-fallthrough*/ \
case 2: \
op; /*-fallthrough*/ \
case 1: \
op; \
break; \
default: \
break; \
}

Dispatch an eight-pixel unrolled remainder.

Expands to a switch that falls through to execute op x times for x in 1..7; other values execute nothing. x is evaluated once.

Parameters
[in]xRemaining pixel count.
[in]opStatement to expand; it may modify local cursors.

Definition at line 2042 of file tif_getimage.c.

◆ CMAP

#define CMAP (   x)
Value:
c = (TIFFRGBValue)x; \
*p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
#define PACK(r, g, b)
Pack RGB bytes with opaque alpha.
unsigned char TIFFRGBValue
Represent an 8-bit RGB channel value.
Definition tiffio.h:276

Append a palette-map entry to the expansion table.

Stores x in the local c and appends the packed low bytes of the colormap entries r[c], g[c] and b[c] at the local cursor p. x is evaluated once. Defined inside makecmap() only.

Parameters
[in]xPalette index.

◆ CVT

#define CVT (   x)    ((uint16_t)((x) >> 8))

Reduce a palette entry to its high byte.

Evaluates x once and returns its high byte as uint16_t; used by cvtcmap() to reduce 16-bit colormap entries.

Parameters
[in]xSixteen-bit colormap entry.
Returns
x >> 8.

◆ DECLAREContigPutFunc

#define DECLAREContigPutFunc (   name)
Value:
static void name(TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, \
uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, \
unsigned char *pp)
Hold the state and selected callbacks for an RGBA image reader.
Definition tiffio.h:517

Declare the concrete contiguous packer signature.

Expands to the start of a static function definition of type tileContigRoutine; the function body follows the macro.

Parameters
[in]nameIdentifier of the packer being defined.

Definition at line 2261 of file tif_getimage.c.

◆ DECLARESepPutFunc

#define DECLARESepPutFunc (   name)
Value:
static void name(TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, \
uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, \
unsigned char *r, unsigned char *g, unsigned char *b, \
unsigned char *a)

Declare the concrete separate-plane packer signature.

Expands to the start of a static function definition of type tileSeparateRoutine; the function body follows the macro.

Parameters
[in]nameIdentifier of the packer being defined.

Definition at line 3202 of file tif_getimage.c.

◆ EMSG_BUF_SIZE

#define EMSG_BUF_SIZE   1024

Reserve 1024 bytes for RGBA rejection messages.

Capacity in bytes, including the terminating null byte, of the emsg buffer passed to TIFFRGBAImageOK() and TIFFRGBAImageBegin(); callers must supply at least this much.

Definition at line 86 of file tif_getimage.c.

◆ FLIP_HORIZONTALLY

#define FLIP_HORIZONTALLY   0x02

Select reversal within copied raster rows.

Bit in the setorientation() result: the pixels within each row must be stored in reverse order.

Definition at line 76 of file tif_getimage.c.

◆ FLIP_VERTICALLY

#define FLIP_VERTICALLY   0x01

Select reversed raster row order.

Bit in the setorientation() result: the raster rows must be stored in reverse order relative to the image rows.

Definition at line 68 of file tif_getimage.c.

◆ GREY

#define GREY (   x)
Value:
c = Map[x]; \
*p++ = PACK(c, c, c);

Append a grayscale-map entry to the expansion table.

Looks up x in the enclosing Map, stores it in the local c and appends PACK(c, c, c) at the local cursor p. x is evaluated once. Defined inside makebwmap() only.

Parameters
[in]xSample value used as the Map index.

◆ NOP

#define NOP

Supply an empty loop operation.

Expands to nothing; passed as the per-group op1 argument of UNROLL8() when no work is needed before each group of pixels.

Definition at line 2093 of file tif_getimage.c.

◆ PACK

#define PACK (   r,
  g,
  b 
)     ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)

Pack RGB bytes with opaque alpha.

Each operand is evaluated once and converted to uint32_t; values must be in 0..255.

Parameters
[in]rRed byte, stored in bits 0-7.
[in]gGreen byte, stored in bits 8-15.
[in]bBlue byte, stored in bits 16-23.
Returns
Packed word with alpha 0xff.

Definition at line 2233 of file tif_getimage.c.

◆ PACK4

#define PACK4 (   r,
  g,
  b,
  a 
)
Value:
((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | \
((uint32_t)(a) << 24))

Pack RGB and alpha bytes.

Each operand is evaluated once and converted to uint32_t; values must be in 0..255.

Parameters
[in]rRed byte, stored in bits 0-7.
[in]gGreen byte, stored in bits 8-15.
[in]bBlue byte, stored in bits 16-23.
[in]aAlpha byte, stored in bits 24-31.
Returns
Packed word.

Definition at line 2248 of file tif_getimage.c.

◆ REPEAT2

#define REPEAT2 (   op)
Value:
op; \
op

Expand an operation twice.

Expands to two copies of op separated by semicolons, with no enclosing braces; use only as a statement in a braced context.

Parameters
[in]opStatement to expand; it may modify local cursors.

Definition at line 2029 of file tif_getimage.c.

◆ REPEAT4

#define REPEAT4 (   op)
Value:
REPEAT2(op); \
REPEAT2(op)
#define REPEAT2(op)
Expand an operation twice.

Expand an operation four times.

Expands to four copies of op separated by semicolons, with no enclosing braces; use only as a statement in a braced context.

Parameters
[in]opStatement to expand; it may modify local cursors.

Definition at line 2017 of file tif_getimage.c.

◆ REPEAT8

#define REPEAT8 (   op)
Value:
REPEAT4(op); \
REPEAT4(op)
#define REPEAT4(op)
Expand an operation four times.

Expand an operation eight times.

Expands to eight copies of op separated by semicolons, with no enclosing braces; use only as a statement in a braced context.

Parameters
[in]opStatement to expand; it may modify local cursors.

Definition at line 2005 of file tif_getimage.c.

◆ SKEW

#define SKEW (   r,
  g,
  b,
  skew 
)
Value:
{ \
r += skew; \
g += skew; \
b += skew; \
}

Advance three plane pointers by a source skew.

Adds skew to each of the three plane pointers; skew is evaluated three times.

Parameters
[in,out]rRed-plane cursor, advanced in place.
[in,out]gGreen-plane cursor, advanced in place.
[in,out]bBlue-plane cursor, advanced in place.
[in]skewSigned element offset added to each cursor.

Definition at line 2186 of file tif_getimage.c.

◆ SKEW4

#define SKEW4 (   r,
  g,
  b,
  a,
  skew 
)
Value:
{ \
r += skew; \
g += skew; \
b += skew; \
a += skew; \
}

Advance four plane pointers by a source skew.

Adds skew to each of the four plane pointers; skew is evaluated four times.

Parameters
[in,out]rRed-plane cursor, advanced in place.
[in,out]gGreen-plane cursor, advanced in place.
[in,out]bBlue-plane cursor, advanced in place.
[in,out]aAlpha- or black-plane cursor, advanced in place.
[in]skewSigned element offset added to each cursor.

Definition at line 2205 of file tif_getimage.c.

◆ UNROLL2

#define UNROLL2 (   w,
  op1,
  op2 
)
Value:
{ \
uint32_t _x; \
for (_x = w; _x >= 2; _x -= 2) \
{ \
op1; \
REPEAT2(op2); \
} \
if (_x) \
{ \
op1; \
op2; \
} \
}

Traverse complete two-pixel groups and their remainder.

Copies w into a local counter and, for each group of up to 2 pixels, runs op1 once followed by op2 once per pixel. w is evaluated once and is not modified. Expands to a braced block declaring a local _x.

Parameters
[in]wPixel count for the row.
[in]op1Statement run once before each group, or NOP.
[in]op2Per-pixel statement; it may modify local cursors.

Definition at line 2159 of file tif_getimage.c.

◆ UNROLL4

#define UNROLL4 (   w,
  op1,
  op2 
)
Value:
{ \
uint32_t _x; \
for (_x = w; _x >= 4; _x -= 4) \
{ \
op1; \
REPEAT4(op2); \
} \
if (_x > 0) \
{ \
op1; \
CASE4(_x, op2); \
} \
}

Traverse complete four-pixel groups and their remainder.

Copies w into a local counter and, for each group of up to 4 pixels, runs op1 once followed by op2 once per pixel. w is evaluated once and is not modified. Expands to a braced block declaring a local _x.

Parameters
[in]wPixel count for the row.
[in]op1Statement run once before each group, or NOP.
[in]op2Per-pixel statement; it may modify local cursors.

Definition at line 2133 of file tif_getimage.c.

◆ UNROLL8

#define UNROLL8 (   w,
  op1,
  op2 
)
Value:
{ \
uint32_t _x; \
for (_x = w; _x >= 8; _x -= 8) \
{ \
op1; \
REPEAT8(op2); \
} \
if (_x > 0) \
{ \
op1; \
CASE8(_x, op2); \
} \
}

Traverse complete eight-pixel groups and their remainder.

Copies w into a local counter and, for each group of up to 8 pixels, runs op1 once followed by op2 once per pixel. w is evaluated once and is not modified. Expands to a braced block declaring a local _x.

Parameters
[in]wPixel count for the row.
[in]op1Statement run once before each group, or NOP.
[in]op2Per-pixel statement; it may modify local cursors.

Definition at line 2107 of file tif_getimage.c.

◆ YCbCrtoRGB

#define YCbCrtoRGB (   dst,
  Y 
)
Value:
{ \
uint32_t r, g, b; \
TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
dst = PACK(r, g, b); \
}

Convert a local YCbCr group and pack an opaque output word.

Converts luma Y with the chroma values in the enclosing locals Cb and Cr through img->ycbcr and assigns the packed result to dst. Expands to a braced block declaring locals r, g and b; each operand is evaluated once.

Parameters
[out]dstLvalue receiving the packed output word.
[in]YLuma sample value.

Definition at line 3711 of file tif_getimage.c.

Function Documentation

◆ buildMap()

static int buildMap ( TIFFRGBAImage *  img)
static

Build the lookup maps needed by a selected photometric case.

Builds a sample scaling Map through setupMap() for grayscale images and for RGB, YCbCr and Separated images that are not 8-bit (grayscale also gets BWmap, and its Map is then released). For palette images, reduces 16-bit colormap entries to 8 bits or warns when assuming an old eight-bit palette, and builds PALmap only when bitspersample is at most 8. Allocations and copied palette changes remain reader-owned until End, including partial failure state. No pixel I/O.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.
Returns
One after applicable map setup, zero on helper failure.

Definition at line 4893 of file tif_getimage.c.

References _TIFFRGBAImage::bitspersample, checkcmap(), cvtcmap(), makecmap(), _TIFFRGBAImage::photometric, PHOTOMETRIC_MINISBLACK, PHOTOMETRIC_MINISWHITE, PHOTOMETRIC_PALETTE, PHOTOMETRIC_RGB, PHOTOMETRIC_SEPARATED, PHOTOMETRIC_YCBCR, setupMap(), _TIFFRGBAImage::tif, TIFFFileName(), and TIFFWarningExtR().

Referenced by PickContigCase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BuildMapBitdepth16To8()

static int BuildMapBitdepth16To8 ( TIFFRGBAImage *  img)
static

Build rounded sixteen-to-eight-bit sample reduction.

Requires Bitdepth16To8 NULL; allocates 65536 reader-owned bytes storing (value+128)/257. Released by End. Reports allocation failure; no pixel I/O.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.
Returns
One on construction, zero on allocation failure.

Definition at line 5275 of file tif_getimage.c.

References _TIFFmallocExt(), _TIFFRGBAImage::Bitdepth16To8, _TIFFRGBAImage::tif, and TIFFErrorExtR().

Referenced by PickContigCase(), and PickSeparateCase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BuildMapUaToAa()

static int BuildMapUaToAa ( TIFFRGBAImage *  img)
static

Build the unassociated-to-associated eight-bit channel map.

Requires UaToAa NULL, allocates 65536 reader-owned bytes indexed by (alpha<<8)|value, and stores (value*alpha+127)/255. Released by End. Reports allocation failure; no pixel I/O.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.
Returns
One on construction, zero on allocation failure.

Definition at line 5242 of file tif_getimage.c.

References _TIFFmallocExt(), _TIFFRGBAImage::tif, TIFFErrorExtR(), and _TIFFRGBAImage::UaToAa.

Referenced by PickContigCase(), and PickSeparateCase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcCopyToRasterParameter()

static int calcCopyToRasterParameter ( TIFFRGBAImage *  img,
uint32_t *  raster,
uint32_t  rwidth,
uint32_t  rheight,
uint32_t *  pwcpy,
uint32_t *  phcpy,
int *  pflip,
uint32_t **  pp_raster_start,
int32_t *  ptoskew,
uint32_t *  py,
bool  isTiled,
uint32_t  tilewidth,
const char *  funcName 
)
static

Compute clipped raster placement and signed row steps.

Validates offsets, clips copy extents, calls setorientation(), computes a borrowed raster start pointer and checks signed row-skew bounds. Requires positive raster dimensions, valid tile width for tiled access, and sufficient representable allocation. Outputs can be partially assigned before a diagnosed rejection; no allocation or pixel I/O.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live. setorientation() may reset req_orientation.
[in]rasterBase of the caller's rwidth*rheight raster; not accessed, only used to compute *pp_raster_start.
[in]rwidthPositive raster stride in pixels.
[in]rheightPositive raster height; allocation product must be representable.
[out]pwcpyNon-NULL clipped pixel-width output.
[out]phcpyNon-NULL clipped row-count output.
[out]pflipNon-NULL flip-mask output.
[out]pp_raster_startNon-NULL borrowed start-pointer output within raster.
[out]ptoskewNon-NULL signed destination row-step adjustment output in pixels.
[out]pyNon-NULL starting row-index output.
[in]isTiledTrue for tiled traversal.
[in]tilewidthValid tile width in pixels when tiled, zero otherwise.
[in]funcNameBorrowed diagnostic function label.
Returns
One on computed placement, zero on an invalid row or column offset or a row-skew overflow. An invalid requested orientation is normalised with a warning by setorientation(), not rejected.

Definition at line 889 of file tif_getimage.c.

References _TIFFRGBAImage::col_offset, FLIP_VERTICALLY, _TIFFRGBAImage::height, isTiled, ORIENTATION_BOTLEFT, ORIENTATION_BOTRIGHT, ORIENTATION_LEFTBOT, ORIENTATION_LEFTTOP, ORIENTATION_RIGHTBOT, ORIENTATION_RIGHTTOP, ORIENTATION_TOPLEFT, ORIENTATION_TOPRIGHT, _TIFFRGBAImage::req_orientation, _TIFFRGBAImage::row_offset, setorientation(), _TIFFRGBAImage::tif, TIFFErrorExtR(), TIFFFileName(), TIFFmin, and _TIFFRGBAImage::width.

Referenced by gtStripContig(), gtStripSeparate(), gtTileContig(), and gtTileSeparate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkcmap()

static int checkcmap ( TIFFRGBAImage *  img)
static

Infer whether copied palette entries use eight or sixteen bits.

Scans all three copied arrays for entries >=256, using the recorded ColorMap length (td_colormap_count) with which they were copied. No mutation, allocation, I/O, diagnostics or ownership transfer.

Parameters
[in]imgNon-NULL caller-owned RGBA state; only its copied colormap arrays and bit depth are read.
Returns
Sixteen if any entry is >=256, otherwise eight.

Definition at line 4749 of file tif_getimage.c.

References _TIFFRGBAImage::bluecmap, _TIFFRGBAImage::greencmap, _TIFFRGBAImage::redcmap, TIFFDirectory::td_colormap_count, _TIFFRGBAImage::tif, and tiff::tif_dir.

Referenced by buildMap().

Here is the caller graph for this function:

◆ checkColOffsetByteAligned()

static int checkColOffsetByteAligned ( TIFFRGBAImage *  img,
const char *  module,
uint64_t  bitoffset 
)
static

Reject a packed-sample offset between byte boundaries.

Tests bitoffset modulo eight and diagnoses rejection. No allocation, pixel I/O, ownership transfer, or independent geometry validation.

Parameters
[in]imgNon-NULL caller-owned RGBA state; only read to build the diagnostic, which can invoke the handle's error callbacks.
[in]moduleBorrowed diagnostic context string.
[in]bitoffsetNonnegative sample bit offset.
Returns
One for byte alignment, zero otherwise.

Definition at line 1013 of file tif_getimage.c.

References _TIFFRGBAImage::bitspersample, _TIFFRGBAImage::col_offset, _TIFFRGBAImage::samplesperpixel, _TIFFRGBAImage::tif, TIFFErrorExtR(), and TIFFFileName().

Referenced by gtStripContig(), gtStripSeparate(), gtTileContig(), and gtTileSeparate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkedOrientation()

static uint16_t checkedOrientation ( uint16_t  orientation)
static

Validate a TIFF orientation number.

Pure range test; no allocation, I/O, mutation, diagnostics, or ownership effect.

Parameters
[in]orientationOrientation code to check.
Returns
Input orientation in 1..8, or zero otherwise.

Definition at line 144 of file tif_getimage.c.

Referenced by setorientation().

Here is the caller graph for this function:

◆ cvtcmap()

static void cvtcmap ( TIFFRGBAImage *  img)
static

Reduce all copied palette entries to their high byte.

Mutates reader-owned copied arrays in place, covering the recorded ColorMap length (td_colormap_count) with which they were copied. No allocation, I/O, diagnostics, ownership change or error status.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.

Definition at line 4775 of file tif_getimage.c.

References _TIFFRGBAImage::bluecmap, CVT, _TIFFRGBAImage::greencmap, _TIFFRGBAImage::redcmap, TIFFDirectory::td_colormap_count, _TIFFRGBAImage::tif, and tiff::tif_dir.

Referenced by buildMap().

Here is the caller graph for this function:

◆ gtStripContig()

static int gtStripContig ( TIFFRGBAImage *  img,
uint32_t *  raster,
uint32_t  rwidth,
uint32_t  rheight 
)
static

Read contiguous strips into a clipped RGBA raster.

Computes placement/skews, rejecting a source row skew above INT32_MAX, validates byte-aligned column offsets, allocates temporary decoded storage, reads striles, dispatches the installed put callback, then optionally flips horizontally. Zero horizontal or vertical YCbCr subsampling is diagnosed and rejected. For subsampled YCbCr data that the codec does not upsample, the read offset within a strip is computed in whole subsampling blocks, so cropped or offset reads stay within the decoded strip; a column offset that is not a multiple of the horizontal subsampling is diagnosed and rejected. Each strip read requests TIFFVStripSize() of the rows needed, which accounts for subsampled YCbCr packing. Temporary storage is released on normal completion and read-error exits, but rejection of an invalid per-strip read size returns without releasing a buffer allocated in an earlier iteration (it leaks). Requires selected callbacks and valid positive raster geometry. stoponerr zero can continue after failed reads when storage exists, using partial or retained bytes. Reader/codec state, raster and file position can change before failure; no rollback or output ownership transfer.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.
[out]rasterBorrowed writable positive rwidth*rheight pixel allocation, disjoint from state/input.
[in]rwidthPositive raster stride in pixels.
[in]rheightPositive raster height; allocation product must be representable.
Returns
One after traversal including tolerated read errors, zero on detected fatal geometry/allocation/read failure.

Definition at line 1574 of file tif_getimage.c.

References _TIFFfreeExt(), _TIFFReadEncodedStripAndAllocBuffer(), _TIFFRGBAImage::bitspersample, calcCopyToRasterParameter(), checkColOffsetByteAligned(), _TIFFRGBAImage::col_offset, _TIFFRGBAImage::contig, FLIP_HORIZONTALLY, FLIP_VERTICALLY, isUpSampled, _TIFFRGBAImage::photometric, PHOTOMETRIC_YCBCR, _TIFFRGBAImage::put, _TIFFRGBAImage::row_offset, _TIFFRGBAImage::samplesperpixel, _TIFFRGBAImage::stoponerr, _TIFFRGBAImage::tif, TIFFComputeStrip(), TIFFErrorExtR(), TIFFFileName(), TIFFGetFieldDefaulted(), TIFFhowmany_32, TIFFScanlineSize(), TIFFStripSize(), TIFFTAG_ROWSPERSTRIP, TIFFTAG_YCBCRSUBSAMPLING, TIFFVStripSize(), and _TIFFRGBAImage::width.

Referenced by PickContigCase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gtStripSeparate()

static int gtStripSeparate ( TIFFRGBAImage *  img,
uint32_t *  raster,
uint32_t  rwidth,
uint32_t  rheight 
)
static

Read separate-plane strips into a clipped RGBA raster.

Computes placement/skews, rejecting a source row skew above INT32_MAX, validates byte-aligned column offsets, allocates temporary decoded storage, reads striles, dispatches the installed put callback, then optionally flips horizontally. Temporary storage is released on normal completion and read-error exits, but the per-strip integer-overflow rejection returns without releasing a buffer allocated in an earlier iteration (it leaks). Requires selected callbacks and valid positive raster geometry. stoponerr zero can continue after failed reads when storage exists, using partial or retained bytes. Reader/codec state, raster and file position can change before failure; no rollback or output ownership transfer.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.
[out]rasterBorrowed writable positive rwidth*rheight pixel allocation, disjoint from state/input.
[in]rwidthPositive raster stride in pixels.
[in]rheightPositive raster height; allocation product must be representable.
Returns
One after traversal including tolerated read errors, zero on detected fatal geometry/allocation/read failure.

Definition at line 1792 of file tif_getimage.c.

References _TIFFfreeExt(), _TIFFMultiplySSize(), _TIFFReadEncodedStripAndAllocBuffer(), _TIFFRGBAImage::alpha, _TIFFRGBAImage::bitspersample, calcCopyToRasterParameter(), checkColOffsetByteAligned(), _TIFFRGBAImage::col_offset, FLIP_HORIZONTALLY, FLIP_VERTICALLY, _TIFFRGBAImage::photometric, PHOTOMETRIC_MINISBLACK, PHOTOMETRIC_MINISWHITE, PHOTOMETRIC_PALETTE, _TIFFRGBAImage::put, _TIFFRGBAImage::row_offset, _TIFFRGBAImage::separate, _TIFFRGBAImage::stoponerr, _TIFFRGBAImage::tif, TIFF_TMSIZE_T_MAX, TIFFComputeStrip(), TIFFErrorExtR(), TIFFFileName(), TIFFGetFieldDefaulted(), TIFFReadEncodedStrip(), TIFFScanlineSize(), TIFFStripSize(), TIFFTAG_ROWSPERSTRIP, and _TIFFRGBAImage::width.

Referenced by PickSeparateCase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gtTileContig()

static int gtTileContig ( TIFFRGBAImage *  img,
uint32_t *  raster,
uint32_t  rwidth,
uint32_t  rheight 
)
static

Read contiguous tiles into a clipped RGBA raster.

Computes placement/skews, validates byte-aligned column offsets, allocates temporary decoded storage, reads striles, dispatches the installed put callback, then optionally flips horizontally. For subsampled YCbCr data that the codec does not upsample, the read offset within a tile is computed in whole subsampling blocks (horizontal*vertical luma samples plus two chroma samples per block), so cropped or offset reads stay within the decoded tile; zero subsampling is diagnosed and rejected, as is a column offset that is not a multiple of the horizontal subsampling. Temporary storage is released on normal completion and read-error exits; early arithmetic rejection paths need not undo prior state. Requires selected callbacks and valid positive raster geometry. stoponerr zero can continue after failed reads when storage exists, using partial or retained bytes. Reader/codec state, raster and file position can change before failure; no rollback or output ownership transfer.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.
[out]rasterBorrowed writable positive rwidth*rheight pixel allocation, disjoint from state/input.
[in]rwidthPositive raster stride in pixels.
[in]rheightPositive raster height; allocation product must be representable.
Returns
One after traversal including tolerated read errors, zero on detected fatal geometry/allocation/read failure.

Definition at line 1063 of file tif_getimage.c.

References _TIFFfreeExt(), _TIFFReadTileAndAllocBuffer(), _TIFFRGBAImage::bitspersample, calcCopyToRasterParameter(), checkColOffsetByteAligned(), _TIFFRGBAImage::col_offset, _TIFFRGBAImage::contig, FLIP_HORIZONTALLY, FLIP_VERTICALLY, isUpSampled, _TIFFRGBAImage::photometric, PHOTOMETRIC_YCBCR, _TIFFRGBAImage::put, _TIFFRGBAImage::row_offset, _TIFFRGBAImage::samplesperpixel, _TIFFRGBAImage::stoponerr, _TIFFRGBAImage::tif, TIFFErrorExtR(), TIFFFileName(), TIFFGetField(), TIFFGetFieldDefaulted(), TIFFhowmany_32, TIFFTAG_TILELENGTH, TIFFTAG_TILEWIDTH, TIFFTAG_YCBCRSUBSAMPLING, TIFFTileRowSize(), and TIFFTileSize().

Referenced by PickContigCase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gtTileSeparate()

static int gtTileSeparate ( TIFFRGBAImage *  img,
uint32_t *  raster,
uint32_t  rwidth,
uint32_t  rheight 
)
static

Read separate-plane tiles into a clipped RGBA raster.

Computes placement/skews, validates byte-aligned column offsets, allocates temporary decoded storage, reads striles, dispatches the installed put callback, then optionally flips horizontally. Temporary storage is released on normal completion and read-error exits; early arithmetic rejection paths need not undo prior state. Requires selected callbacks and valid positive raster geometry. stoponerr zero can continue after failed reads when storage exists, using partial or retained bytes. Reader/codec state, raster and file position can change before failure; no rollback or output ownership transfer.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.
[out]rasterBorrowed writable positive rwidth*rheight pixel allocation, disjoint from state/input.
[in]rwidthPositive raster stride in pixels.
[in]rheightPositive raster height; allocation product must be representable.
Returns
One after traversal including tolerated read errors, zero on detected fatal geometry/allocation/read failure.

Definition at line 1302 of file tif_getimage.c.

References _TIFFfreeExt(), _TIFFMultiplySSize(), _TIFFReadTileAndAllocBuffer(), _TIFFRGBAImage::alpha, _TIFFRGBAImage::bitspersample, calcCopyToRasterParameter(), checkColOffsetByteAligned(), _TIFFRGBAImage::col_offset, FLIP_HORIZONTALLY, FLIP_VERTICALLY, _TIFFRGBAImage::photometric, PHOTOMETRIC_MINISBLACK, PHOTOMETRIC_MINISWHITE, PHOTOMETRIC_PALETTE, _TIFFRGBAImage::put, _TIFFRGBAImage::row_offset, _TIFFRGBAImage::separate, _TIFFRGBAImage::stoponerr, _TIFFRGBAImage::tif, TIFFErrorExtR(), TIFFFileName(), TIFFGetField(), TIFFReadTile(), TIFFTAG_TILELENGTH, TIFFTAG_TILEWIDTH, TIFFTileRowSize(), and TIFFTileSize().

Referenced by PickSeparateCase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initCIELabConversion()

static tileContigRoutine initCIELabConversion ( TIFFRGBAImage *  img)
static

Prepare Lab state and select an 8- or 16-bit packer.

Fetches the white point and rejects it only when y compares exactly equal to zero or is NaN (TIFF_FLOAT_EQ is an exact test; x is not checked). Converts it to XYZ with Y=100, allocates/reuses reader-owned state and initialises the sRGB display tables. Getters/diagnostics can invoke callbacks; no pixel I/O. The current colour initialiser always returns zero, so its negative-status cleanup branch is dormant; if reached, it would free img->cielab without clearing it, and TIFFRGBAImageEnd() would then free it again. State is otherwise released by End.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.
Returns
Borrowed static packer callback, or NULL for unsupported depth/detected setup failure; code remains live with the library.

Definition at line 4545 of file tif_getimage.c.

References _TIFFfreeExt(), _TIFFmallocExt(), _TIFFRGBAImage::bitspersample, _TIFFRGBAImage::cielab, display_sRGB, putcontig8bitCIELab16(), putcontig8bitCIELab8(), _TIFFRGBAImage::tif, TIFF_FLOAT_EQ, TIFFCIELabToRGBInit(), TIFFErrorExtR(), TIFFGetFieldDefaulted(), and TIFFTAG_WHITEPOINT.

Referenced by PickContigCase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initYCbCrConversion()

static int initYCbCrConversion ( TIFFRGBAImage *  img)
static

Allocate and initialise RGBA YCbCr contribution tables.

Reuses or allocates the correctly sized trailing-table block, fetches defaulted coefficients/endpoints, rejects NaN coefficients, a green coefficient that compares exactly equal to zero (TIFF_FLOAT_EQ is an exact test, so a tiny nonzero value is accepted) and out-of-range ReferenceBlackWhite endpoints, then initialises tables. On later failure the allocation remains reader-owned for End; no pixel I/O. Getters/diagnostics can invoke callbacks.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.
Returns
One on setup, zero on invalid coefficients or endpoints, or on allocation failure.

Definition at line 4476 of file tif_getimage.c.

References _TIFFmallocExt(), isInRefBlackWhiteRange(), _TIFFRGBAImage::tif, TIFF_FLOAT_EQ, TIFFErrorExtR(), TIFFGetFieldDefaulted(), TIFFroundup_32, TIFFTAG_REFERENCEBLACKWHITE, TIFFTAG_YCBCRCOEFFICIENTS, TIFFYCbCrToRGBInit(), and _TIFFRGBAImage::ycbcr.

Referenced by PickContigCase(), and PickSeparateCase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCCITTCompression()

static int isCCITTCompression ( TIFF *  tif)
static

Recognise CCITT fax compression schemes.

Queries the compression tag through the handle methods; assumes a configured directory. No output allocation or ownership transfer.

Parameters
[in]tifNon-NULL live handle with a current directory; only queried through TIFFGetField(). Serialise access externally.
Returns
Nonzero for Fax3/Fax4/RLE/RLEW, zero otherwise.

Definition at line 385 of file tif_getimage.c.

References COMPRESSION_CCITTFAX3, COMPRESSION_CCITTFAX4, COMPRESSION_CCITTRLE, COMPRESSION_CCITTRLEW, TIFFGetField(), and TIFFTAG_COMPRESSION.

Referenced by TIFFRGBAImageBegin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInRefBlackWhiteRange()

static int isInRefBlackWhiteRange ( float  f)
static

Check a reference endpoint against conversion integer bounds.

Strict comparisons also reject NaN. Pure arithmetic without side effects, allocation, diagnostics, or ownership effects.

Parameters
[in]fReference endpoint value.
Returns
One inside the accepted open interval, zero otherwise.

Definition at line 4454 of file tif_getimage.c.

Referenced by initYCbCrConversion().

Here is the caller graph for this function:

◆ makebwmap()

static int makebwmap ( TIFFRGBAImage *  img)
static

Build byte-indexed packed grayscale expansion tables.

Requires a valid Map and supported bit depth. Allocates combined pointer/pixel storage owned by img until End; existing BWmap must be NULL to avoid leaks. Diagnostics report allocation failure, leaving NULL. No pixel I/O.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.
Returns
One on table construction, zero on allocation failure.

Definition at line 4610 of file tif_getimage.c.

References _TIFFmallocExt(), _TIFFRGBAImage::bitspersample, _TIFFRGBAImage::BWmap, GREY, _TIFFRGBAImage::Map, _TIFFRGBAImage::tif, TIFFErrorExtR(), and TIFFFileName().

Referenced by setupMap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makecmap()

static int makecmap ( TIFFRGBAImage *  img)
static

Build byte-indexed packed palette expansion tables.

Requires valid eight-bit palette entries and bit depth 1/2/4/8. Allocates combined pointer/pixel storage owned by img until End; PALmap must initially be NULL. Reports allocation failure; no pixel I/O.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.
Returns
One on construction, zero on allocation failure.

Definition at line 4812 of file tif_getimage.c.

References _TIFFmallocExt(), _TIFFRGBAImage::bitspersample, _TIFFRGBAImage::bluecmap, CMAP, _TIFFRGBAImage::greencmap, _TIFFRGBAImage::PALmap, _TIFFRGBAImage::redcmap, _TIFFRGBAImage::tif, TIFFErrorExtR(), and TIFFFileName().

Referenced by buildMap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PickContigCase()

static int PickContigCase ( TIFFRGBAImage *  img)
static

Select contiguous get/put callbacks for the conversion.

Examines photometric, channel count, depth, alpha and YCbCr subsampling; can build reader-owned maps/conversion state and diagnose failure. Supports enumerated subsampling pairs and rejects image extents smaller than their sampling block. Updates callbacks before returning; partial allocations remain for End. No pixel reads.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.
Returns
One if both callbacks selected, zero on unsupported layout or helper failure.

Definition at line 4949 of file tif_getimage.c.

References _TIFFRGBAImage::alpha, _TIFFRGBAImage::bitspersample, buildMap(), BuildMapBitdepth16To8(), BuildMapUaToAa(), _TIFFRGBAImage::contig, EXTRASAMPLE_ASSOCALPHA, EXTRASAMPLE_UNASSALPHA, _TIFFRGBAImage::get, gtStripContig(), gtTileContig(), _TIFFRGBAImage::height, initCIELabConversion(), initYCbCrConversion(), _TIFFRGBAImage::Map, _TIFFRGBAImage::photometric, PHOTOMETRIC_CIELAB, PHOTOMETRIC_MINISBLACK, PHOTOMETRIC_MINISWHITE, PHOTOMETRIC_PALETTE, PHOTOMETRIC_RGB, PHOTOMETRIC_SEPARATED, PHOTOMETRIC_YCBCR, _TIFFRGBAImage::put, put16bitbwtile(), put1bitbwtile(), put1bitcmaptile(), put2bitbwtile(), put2bitcmaptile(), put4bitbwtile(), put4bitcmaptile(), put8bitcmaptile(), putagreytile(), putcontig8bitYCbCr11tile(), putcontig8bitYCbCr12tile(), putcontig8bitYCbCr21tile(), putcontig8bitYCbCr22tile(), putcontig8bitYCbCr41tile(), putcontig8bitYCbCr42tile(), putcontig8bitYCbCr44tile(), putgreytile(), putRGBAAcontig16bittile(), putRGBAAcontig8bittile(), putRGBcontig16bittile(), putRGBcontig8bitCMYKMaptile(), putRGBcontig8bitCMYKtile(), putRGBcontig8bittile(), putRGBUAcontig16bittile(), putRGBUAcontig8bittile(), _TIFFRGBAImage::samplesperpixel, _TIFFRGBAImage::tif, TIFFErrorExtR(), TIFFFileName(), TIFFGetFieldDefaulted(), TIFFIsTiled(), TIFFTAG_YCBCRSUBSAMPLING, and _TIFFRGBAImage::width.

Referenced by TIFFRGBAImageBegin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PickSeparateCase()

static int PickSeparateCase ( TIFFRGBAImage *  img)
static

Select separate-plane get/put callbacks for the conversion.

Supports enumerated grayscale/RGB/CMYK and 1x1 YCbCr cases, with applicable alpha/depth maps. CMYK uses the fourth plane through the alpha input slot. Updates callbacks and can allocate or diagnose; partial state remains for End. No pixel reads.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.
Returns
One if both callbacks selected, zero on unsupported layout or helper failure.

Definition at line 5151 of file tif_getimage.c.

References _TIFFRGBAImage::alpha, _TIFFRGBAImage::bitspersample, BuildMapBitdepth16To8(), BuildMapUaToAa(), EXTRASAMPLE_ASSOCALPHA, EXTRASAMPLE_UNASSALPHA, _TIFFRGBAImage::get, gtStripSeparate(), gtTileSeparate(), initYCbCrConversion(), _TIFFRGBAImage::photometric, PHOTOMETRIC_MINISBLACK, PHOTOMETRIC_MINISWHITE, PHOTOMETRIC_RGB, PHOTOMETRIC_SEPARATED, PHOTOMETRIC_YCBCR, _TIFFRGBAImage::put, putCMYKseparate8bittile(), putRGBAAseparate16bittile(), putRGBAAseparate8bittile(), putRGBseparate16bittile(), putRGBseparate8bittile(), putRGBUAseparate16bittile(), putRGBUAseparate8bittile(), putseparate8bitYCbCr11tile(), _TIFFRGBAImage::samplesperpixel, _TIFFRGBAImage::separate, _TIFFRGBAImage::tif, TIFFGetFieldDefaulted(), TIFFIsTiled(), and TIFFTAG_YCBCRSUBSAMPLING.

Referenced by TIFFRGBAImageBegin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ put16bitbwtile()

static void put16bitbwtile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack 16bitbwtile samples into RGBA words.

16-bit greyscale => colormap/RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 2595 of file tif_getimage.c.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ put1bitbwtile()

static void put1bitbwtile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack 1bitbwtile samples into RGBA words.

1-bit bilevel => colormap/RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 2652 of file tif_getimage.c.

References UNROLL8.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ put1bitcmaptile()

static void put1bitcmaptile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack 1bitcmaptile samples into RGBA words.

1-bit palette => colormap/RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 2443 of file tif_getimage.c.

References UNROLL8.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ put2bitbwtile()

static void put2bitbwtile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack 2bitbwtile samples into RGBA words.

2-bit greyscale => colormap/RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 2699 of file tif_getimage.c.

References UNROLL4.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ put2bitcmaptile()

static void put2bitcmaptile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack 2bitcmaptile samples into RGBA words.

2-bit palette => colormap/RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 2396 of file tif_getimage.c.

References UNROLL4.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ put4bitbwtile()

static void put4bitbwtile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack 4bitbwtile samples into RGBA words.

4-bit greyscale => colormap/RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 2746 of file tif_getimage.c.

References UNROLL2.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ put4bitcmaptile()

static void put4bitcmaptile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack 4bitcmaptile samples into RGBA words.

4-bit palette => colormap/RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 2349 of file tif_getimage.c.

References UNROLL2.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ put8bitcmaptile()

static void put8bitcmaptile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack 8bitcmaptile samples into RGBA words.

8-bit palette => colormap/RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 2297 of file tif_getimage.c.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putagreytile()

static void putagreytile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack agreytile samples into RGBA words.

Eight-bit greyscale with alpha, selected for either alpha association. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words. This packer copies the gray map and alpha directly; it does not premultiply unassociated gray through UaToAa. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 2543 of file tif_getimage.c.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putCMYKseparate8bittile()

static void putCMYKseparate8bittile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  r,
unsigned char *  g,
unsigned char *  b,
unsigned char *  a 
)
static

Pack CMYKseparate8bittile samples into RGBA words.

8-bit unpacked CMYK samples => RGBA. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha; the fourth plane is black (K), not alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource pixels to skip after each row; added unscaled to every plane cursor, since each plane holds one sample per pixel.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]rBorrowed non-NULL cyan plane of 8-bit samples.
[in]gBorrowed non-NULL magenta plane.
[in]bBorrowed non-NULL yellow plane.
[in]aBorrowed non-NULL black (K) plane; PickSeparateCase() sets img->alpha so that the caller reads and passes the fourth plane.

Definition at line 3341 of file tif_getimage.c.

References PACK4, and SKEW4.

Referenced by PickSeparateCase().

Here is the caller graph for this function:

◆ putcontig8bitCIELab16()

static void putcontig8bitCIELab16 ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack contig8bitCIELab16 samples into RGBA words.

16-bit packed CIE L a b 1976 samples => RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 3674 of file tif_getimage.c.

References PACK, TIFFCIELab16ToXYZ(), and TIFFXYZToRGB().

Referenced by initCIELabConversion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ putcontig8bitCIELab8()

static void putcontig8bitCIELab8 ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack contig8bitCIELab8 samples into RGBA words.

8-bit packed CIE L a b 1976 samples => RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 3622 of file tif_getimage.c.

References PACK, TIFFCIELabToXYZ(), and TIFFXYZToRGB().

Referenced by initCIELabConversion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ putcontig8bitYCbCr11tile()

static void putcontig8bitYCbCr11tile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack contig8bitYCbCr11tile samples into RGBA words.

8-bit packed YCbCr samples w/ no subsampling => RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 4368 of file tif_getimage.c.

References YCbCrtoRGB.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putcontig8bitYCbCr12tile()

static void putcontig8bitYCbCr12tile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack contig8bitYCbCr12tile samples into RGBA words.

8-bit packed YCbCr samples w/ 1,2 subsampling => RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 4297 of file tif_getimage.c.

References YCbCrtoRGB.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putcontig8bitYCbCr21tile()

static void putcontig8bitYCbCr21tile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack contig8bitYCbCr21tile samples into RGBA words.

8-bit packed YCbCr samples w/ 2,1 subsampling => RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 4229 of file tif_getimage.c.

References YCbCrtoRGB.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putcontig8bitYCbCr22tile()

static void putcontig8bitYCbCr22tile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack contig8bitYCbCr22tile samples into RGBA words.

8-bit packed YCbCr samples w/ 2,2 subsampling => RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 4136 of file tif_getimage.c.

References YCbCrtoRGB.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putcontig8bitYCbCr41tile()

static void putcontig8bitYCbCr41tile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack contig8bitYCbCr41tile samples into RGBA words.

8-bit packed YCbCr samples w/ 4,1 subsampling => RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 4054 of file tif_getimage.c.

References YCbCrtoRGB.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putcontig8bitYCbCr42tile()

static void putcontig8bitYCbCr42tile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack contig8bitYCbCr42tile samples into RGBA words.

8-bit packed YCbCr samples w/ 4,2 subsampling => RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 3920 of file tif_getimage.c.

References YCbCrtoRGB.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putcontig8bitYCbCr44tile()

static void putcontig8bitYCbCr44tile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack contig8bitYCbCr44tile samples into RGBA words.

8-bit packed YCbCr samples w/ 4,4 subsampling => RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 3749 of file tif_getimage.c.

References YCbCrtoRGB.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putgreytile()

static void putgreytile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack greytile samples into RGBA words.

8-bit greyscale => colormap/RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 2490 of file tif_getimage.c.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putRGBAAcontig16bittile()

static void putRGBAAcontig16bittile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack RGBAAcontig16bittile samples into RGBA words.

16-bit packed samples => RGBA w/ associated alpha (known to have Map == NULL). Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words, copying the associated alpha sample into the alpha byte. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 3002 of file tif_getimage.c.

References PACK4.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putRGBAAcontig8bittile()

static void putRGBAAcontig8bittile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack RGBAAcontig8bittile samples into RGBA words.

8-bit packed samples => RGBA w/ associated alpha (known to have Map == NULL). Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words, copying the associated alpha sample into the alpha byte. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 2843 of file tif_getimage.c.

References NOP, PACK4, and UNROLL8.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putRGBAAseparate16bittile()

static void putRGBAAseparate16bittile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  r,
unsigned char *  g,
unsigned char *  b,
unsigned char *  a 
)
static

Pack RGBAAseparate16bittile samples into RGBA words.

16-bit unpacked samples => RGBA w/ associated alpha. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words, copying the associated alpha sample into the alpha byte. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource pixels to skip after each row; added unscaled to every plane cursor, counted in uint16_t samples.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]rBorrowed non-NULL red (or grey) plane of uint16_t (passed as unsigned char *) samples; for one-channel images g and b alias it.
[in]gBorrowed non-NULL green plane; the same pointer as r for one-channel images.
[in]bBorrowed non-NULL blue plane; the same pointer as r for one-channel images.
[in]aBorrowed non-NULL associated-alpha plane.

Definition at line 3510 of file tif_getimage.c.

References PACK4, and SKEW4.

Referenced by PickSeparateCase().

Here is the caller graph for this function:

◆ putRGBAAseparate8bittile()

static void putRGBAAseparate8bittile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  r,
unsigned char *  g,
unsigned char *  b,
unsigned char *  a 
)
static

Pack RGBAAseparate8bittile samples into RGBA words.

8-bit unpacked samples => RGBA w/ associated alpha. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words, copying the associated alpha sample into the alpha byte. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource pixels to skip after each row; added unscaled to every plane cursor, since each plane holds one sample per pixel.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]rBorrowed non-NULL red (or grey) plane of 8-bit samples; for one-channel images g and b alias it.
[in]gBorrowed non-NULL green plane; the same pointer as r for one-channel images.
[in]bBorrowed non-NULL blue plane; the same pointer as r for one-channel images.
[in]aBorrowed non-NULL associated-alpha plane.

Definition at line 3294 of file tif_getimage.c.

References NOP, PACK4, SKEW4, and UNROLL8.

Referenced by PickSeparateCase().

Here is the caller graph for this function:

◆ putRGBcontig16bittile()

static void putRGBcontig16bittile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack RGBcontig16bittile samples into RGBA words.

16-bit packed samples => RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 2949 of file tif_getimage.c.

References PACK.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putRGBcontig8bitCMYKMaptile()

static void putRGBcontig8bitCMYKMaptile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack RGBcontig8bitCMYKMaptile samples into RGBA words.

8-bit packed CMYK samples w/Map => RGB NB: The conversion of CMYK->RGB is very crude.. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 3168 of file tif_getimage.c.

References PACK.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putRGBcontig8bitCMYKtile()

static void putRGBcontig8bitCMYKtile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack RGBcontig8bitCMYKtile samples into RGBA words.

8-bit packed CMYK samples w/o Map => RGB NB: The conversion of CMYK->RGB is very crude.. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 3114 of file tif_getimage.c.

References NOP, PACK, and UNROLL8.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putRGBcontig8bittile()

static void putRGBcontig8bittile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack RGBcontig8bittile samples into RGBA words.

8-bit packed samples, no Map => RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 2793 of file tif_getimage.c.

References NOP, PACK, and UNROLL8.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putRGBseparate16bittile()

static void putRGBseparate16bittile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  r,
unsigned char *  g,
unsigned char *  b,
unsigned char *  a 
)
static

Pack RGBseparate16bittile samples into RGBA words.

16-bit unpacked samples => RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource pixels to skip after each row; added unscaled to every plane cursor, counted in uint16_t samples.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]rBorrowed non-NULL red (or grey) plane of uint16_t (passed as unsigned char *) samples; for one-channel images g and b alias it.
[in]gBorrowed non-NULL green plane; the same pointer as r for one-channel images.
[in]bBorrowed non-NULL blue plane; the same pointer as r for one-channel images.
[in]aNot used by this packer; NULL when img->alpha is zero.

Definition at line 3456 of file tif_getimage.c.

References PACK, and SKEW.

Referenced by PickSeparateCase().

Here is the caller graph for this function:

◆ putRGBseparate8bittile()

static void putRGBseparate8bittile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  r,
unsigned char *  g,
unsigned char *  b,
unsigned char *  a 
)
static

Pack RGBseparate8bittile samples into RGBA words.

8-bit unpacked samples => RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource pixels to skip after each row; added unscaled to every plane cursor, since each plane holds one sample per pixel.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]rBorrowed non-NULL red (or grey) plane of 8-bit samples; for one-channel images g and b alias it.
[in]gBorrowed non-NULL green plane; the same pointer as r for one-channel images.
[in]bBorrowed non-NULL blue plane; the same pointer as r for one-channel images.
[in]aNot used by this packer; NULL when img->alpha is zero.

Definition at line 3244 of file tif_getimage.c.

References NOP, PACK, SKEW, and UNROLL8.

Referenced by PickSeparateCase().

Here is the caller graph for this function:

◆ putRGBUAcontig16bittile()

static void putRGBUAcontig16bittile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack RGBUAcontig16bittile samples into RGBA words.

16-bit packed samples => RGBA w/ unassociated alpha (known to have Map == NULL). Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words, premultiplying the colour samples by the unassociated alpha through UaToAa. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 3055 of file tif_getimage.c.

References PACK4.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putRGBUAcontig8bittile()

static void putRGBUAcontig8bittile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  pp 
)
static

Pack RGBUAcontig8bittile samples into RGBA words.

8-bit packed samples => RGBA w/ unassociated alpha (known to have Map == NULL). Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words, premultiplying the colour samples by the unassociated alpha through UaToAa. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource row adjustment in pixels (sample groups); scaled by this packer for byte/word/subsampling layout.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]ppBorrowed contiguous decoded samples with the selected format, padded groups, and alignment (uint16_t for sixteen-bit samples).

Definition at line 2893 of file tif_getimage.c.

References PACK4.

Referenced by PickContigCase().

Here is the caller graph for this function:

◆ putRGBUAseparate16bittile()

static void putRGBUAseparate16bittile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  r,
unsigned char *  g,
unsigned char *  b,
unsigned char *  a 
)
static

Pack RGBUAseparate16bittile samples into RGBA words.

16-bit unpacked samples => RGBA w/ unassociated alpha. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words, premultiplying the colour samples by the unassociated alpha through UaToAa. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource pixels to skip after each row; added unscaled to every plane cursor, counted in uint16_t samples.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]rBorrowed non-NULL red (or grey) plane of uint16_t (passed as unsigned char *) samples; for one-channel images g and b alias it.
[in]gBorrowed non-NULL green plane; the same pointer as r for one-channel images.
[in]bBorrowed non-NULL blue plane; the same pointer as r for one-channel images.
[in]aBorrowed non-NULL unassociated-alpha plane.

Definition at line 3565 of file tif_getimage.c.

References PACK4, and SKEW4.

Referenced by PickSeparateCase().

Here is the caller graph for this function:

◆ putRGBUAseparate8bittile()

static void putRGBUAseparate8bittile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  r,
unsigned char *  g,
unsigned char *  b,
unsigned char *  a 
)
static

Pack RGBUAseparate8bittile samples into RGBA words.

8-bit unpacked samples => RGBA w/ unassociated alpha. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words, premultiplying the colour samples by the unassociated alpha through UaToAa. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource pixels to skip after each row; added unscaled to every plane cursor, since each plane holds one sample per pixel.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]rBorrowed non-NULL red (or grey) plane of 8-bit samples; for one-channel images g and b alias it.
[in]gBorrowed non-NULL green plane; the same pointer as r for one-channel images.
[in]bBorrowed non-NULL blue plane; the same pointer as r for one-channel images.
[in]aBorrowed non-NULL unassociated-alpha plane.

Definition at line 3398 of file tif_getimage.c.

References PACK4, and SKEW4.

Referenced by PickSeparateCase().

Here is the caller graph for this function:

◆ putseparate8bitYCbCr11tile()

static void putseparate8bitYCbCr11tile ( TIFFRGBAImage *  img,
uint32_t *  cp,
uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
int32_t  fromskew,
int32_t  toskew,
unsigned char *  r,
unsigned char *  g,
unsigned char *  b,
unsigned char *  a 
)
static

Pack separate8bitYCbCr11tile samples into RGBA words.

8-bit packed YCbCr samples w/ no subsampling => RGB. Inputs and destination must not overlap. Assumes prior geometry, capacity, sample-format and table validation; no bounds checking or status result. Converts into numeric 0xAABBGGRR words with opaque alpha. No allocation, I/O, diagnostics, retained pointers, or ownership transfer.

Parameters
[in]imgBorrowed initialised conversion state with the maps/format selected for this packer.
[out]cpBorrowed writable output region covering w by h pixels and all signed row steps.
[in]xHorizontal coordinate or scratch loop value; default packers do not retain it.
[in]yVertical coordinate; default packers do not retain it.
[in]wPositive visible width compatible with the selected sampling/packing case.
[in]hPositive visible row count, with full padded sampling groups available in input.
[in]fromskewSource pixels to skip after each row; added unscaled to every plane cursor, since each plane holds one sample per pixel.
[in]toskewSigned destination adjustment in uint32_t pixels after each visible row.
[in]rBorrowed non-NULL Y plane of 8-bit samples.
[in]gBorrowed non-NULL Cb plane.
[in]bBorrowed non-NULL Cr plane.
[in]aNot used by this packer; NULL when img->alpha is zero.

Definition at line 4423 of file tif_getimage.c.

References PACK, SKEW, and TIFFYCbCrtoRGB().

Referenced by PickSeparateCase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setorientation()

static int setorientation ( TIFFRGBAImage *  img)
static

Choose horizontal and vertical raster flips.

Normalises invalid requested orientation to bottom-left with a warning. Does not rotate or transpose; warns for requested/image orientation families requiring rotation. Mutates req_orientation; diagnostics can invoke callbacks. No allocation or pixel I/O.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.
Returns
Bitmask of FLIP_VERTICALLY and FLIP_HORIZONTALLY.

Definition at line 743 of file tif_getimage.c.

References checkedOrientation(), FLIP_HORIZONTALLY, FLIP_VERTICALLY, _TIFFRGBAImage::orientation, ORIENTATION_BOTLEFT, ORIENTATION_BOTRIGHT, ORIENTATION_LEFTBOT, ORIENTATION_LEFTTOP, ORIENTATION_RIGHTBOT, ORIENTATION_RIGHTTOP, ORIENTATION_TOPLEFT, ORIENTATION_TOPRIGHT, orientationStrings, _TIFFRGBAImage::req_orientation, _TIFFRGBAImage::tif, TIFFFileName(), and TIFFWarningExtR().

Referenced by calcCopyToRasterParameter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupMap()

static int setupMap ( TIFFRGBAImage *  img)
static

Build sample scaling and grayscale unpacking maps.

Allocates reader-owned Map, maps to 0..255 with inversion for miniswhite, treats sixteen-bit input via eight-bit reduction, and optionally builds BWmap then releases Map. Requires supported nonzero bit depth and fresh pointers. Allocation failures can retain partial state for End; diagnostics can run. No pixel I/O.

Parameters
[in,out]imgNon-NULL caller-owned RGBA state; its borrowed handle must remain live.
Returns
One after map setup, zero on allocation/helper failure.

Definition at line 4692 of file tif_getimage.c.

References _TIFFfreeExt(), _TIFFmallocExt(), _TIFFRGBAImage::bitspersample, makebwmap(), _TIFFRGBAImage::Map, _TIFFRGBAImage::photometric, PHOTOMETRIC_MINISBLACK, PHOTOMETRIC_MINISWHITE, _TIFFRGBAImage::tif, TIFFErrorExtR(), and TIFFFileName().

Referenced by buildMap().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ display_sRGB

const TIFFDisplay display_sRGB
static
Initial value:
= {
{
{3.2410f, -1.5374f, -0.4986f},
{-0.9692f, 1.8760f, 0.0416f},
{0.0556f, -0.2040f, 1.0570f}},
100.0f,
100.0f,
100.0f,
255,
255,
255,
1.0f,
1.0f,
1.0f,
2.4f,
2.4f,
2.4f,
}

Describe the fixed display transform used for Lab output.

Immutable library-lifetime storage; no ownership transfer.

Definition at line 98 of file tif_getimage.c.

Referenced by initCIELabConversion().

◆ orientationStrings

char const* const orientationStrings[]
static
Initial value:
= {
"not valid",
"TOPLEFT",
"TOPRIGHT",
"BOTRIGHT",
"BOTLEFT",
"LEFTTOP",
"RIGHTTOP",
"RIGHTBOT",
"LEFTBOT"
}

Map checked orientation numbers to diagnostic labels.

Immutable library-lifetime storage; no ownership transfer.

Definition at line 123 of file tif_getimage.c.

Referenced by setorientation().

◆ photoTag

const char photoTag[] = "PhotometricInterpretation"
static

Name the photometric tag in diagnostic messages.

Immutable library-lifetime storage; no ownership transfer.

Definition at line 56 of file tif_getimage.c.

Referenced by TIFFRGBAImageBegin(), and TIFFRGBAImageOK().