LibTIFF 4.7.2
TIFF library public API and implementation reference
Loading...
Searching...
No Matches
Files | Data Structures | Macros | Typedefs | Functions | Variables

Compress logarithmic luminance and packed LogLuv pixel rows. More...

Collaboration diagram for SGILog codec:

Files

file  uvcode.h
 Preserve the historical LogLuv chromaticity-bin table.
 

Data Structures

struct  logLuvState
 Own SGILog translation pixels and selected format conversion. More...
 

Macros

#define DecoderState(tif)   ((LogLuvState *)(tif)->tif_data)
 Borrow handle-owned SGILog decode state.
 
#define EncoderState(tif)   ((LogLuvState *)(tif)->tif_data)
 Borrow handle-owned SGILog encode state.
 
#define SGILOGDATAFMT_UNKNOWN   -1
 Mark a user representation not yet inferred.
 
#define MINRUN   4 /* minimum run length */
 Choose four pixels as the minimum byte-plane run.
 
#define U_NEU   0.210526316
 Select neutral u-prime chromaticity.
 
#define V_NEU   0.473684211
 Select neutral v-prime chromaticity.
 
#define UVSCALE   410.
 Scale uniform eight-bit chromaticity for LogLuv32.
 
#define M_LN2   0.69314718055994530942
 Supply the natural logarithm of two when absent.
 
#define M_PI   3.14159265358979323846
 Supply pi when absent.
 
#define TIFF_RAND_MAX   32767
 Limit SGILog pseudo-random output to fifteen bits.
 
#define NANGLES   100
 Partition the gamut perimeter into one hundred hue angles.
 
#define uv2ang(u, v)
 Map finite chromaticity to a bounded hue lookup angle.
 
#define PACK(s, b, f)   (((b) << 6) | ((s) << 3) | (f))
 Combine directory format fields for a local inference switch.
 
#define PACK(a, b)   (((a) << 3) | (b))
 Combine directory format fields for a local inference switch.
 

Typedefs

typedef struct logLuvState LogLuvState
 Name the SGILog codec-owned translation state.
 

Functions

static int LogLuvReserve (TIFF *tif, uint8_t **opp, tmsize_t *occ, tmsize_t need)
 Flush the raw data buffer when fewer than need bytes remain.
 
static int LogLuvFits (TIFF *tif, const char *module, const uint8_t *op, tmsize_t need)
 Verify that need bytes fit before the raw buffer end.
 
static int LogL16Decode (TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
 Decode two compressed luminance byte planes and translate one row.
 
static int LogLuvDecode24 (TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
 Decode three stored bytes per packed colour pixel and translate one row.
 
static int LogLuvDecode32 (TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
 Decode four compressed colour byte planes and translate one row.
 
static int LogLuvDecodeStrip (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
 Decode complete SGILog strip rows through the selected row callback.
 
static int LogLuvDecodeTile (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
 Decode complete SGILog tile rows through the selected row callback.
 
static int LogL16Encode (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
 Translate one input row and emit luminance byte-plane runs.
 
static int LogLuvEncode24 (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
 Translate one input row and emit three-byte packed colour pixels.
 
static int LogLuvEncode32 (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
 Translate one input row and emit colour byte-plane runs.
 
static int LogLuvEncodeStrip (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
 Encode complete SGILog strip rows through the selected row callback.
 
static int LogLuvEncodeTile (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
 Encode complete SGILog tile rows through the selected row callback.
 
static uint32_t _TIFFRand (void)
 Advance the shared SGILog pseudo-random dither generator.
 
static int tiff_itrunc (double x, int m)
 Quantise a finite value with optional shared random dithering.
 
static float LogLuvLoadFloatNativeUnaligned (const uint8_t *cp)
 Read one native-order float through unaligned bytes.
 
static void LogLuvStoreFloatNativeUnaligned (uint8_t *cp, float v)
 Write one native-order float through unaligned bytes.
 
static int16_t LogLuvLoad16NativeUnaligned (const uint8_t *cp)
 Read one native-order signed sixteen-bit value through unaligned bytes.
 
static void LogLuvStore16NativeUnaligned (uint8_t *cp, int16_t v)
 Write one native-order signed sixteen-bit value through unaligned bytes.
 
static uint32_t LogLuvLoad32NativeUnaligned (const uint8_t *cp)
 Read one native-order unsigned thirty-two-bit value through unaligned bytes.
 
static void LogLuvStore32NativeUnaligned (uint8_t *cp, uint32_t v)
 Write one native-order unsigned thirty-two-bit value through unaligned bytes.
 
static void L16toL16 (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Copy encoded luminance words from staging to native caller bytes.
 
static void L16fromL16 (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Copy native caller luminance words into staging.
 
static void LuvRawToRaw (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Copy packed LogLuv words from staging to native caller bytes.
 
static void LuvRawFromRaw (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Copy native caller LogLuv words into staging.
 
static void L16toY (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Convert staged LogL16 values to native float luminance.
 
static void L16toGry (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Convert staged LogL16 values to clipped gamma-two grayscale bytes.
 
static void L16fromY (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Quantise native float luminance into staged LogL16 codes.
 
static int oog_encode (double u, double v)
 Map out-of-gamut chromaticity to a hue-matched boundary bin.
 
static void Luv24toXYZ (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Convert staged LogLuv24 codes to native float XYZ triplets.
 
static void Luv24toLuv48 (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Convert staged LogLuv24 codes to native signed Luv triplets.
 
static void Luv24toRGB (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Convert staged LogLuv24 codes to clipped gamma-two RGB bytes.
 
static void Luv24fromXYZ (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Quantise native float XYZ triplets into LogLuv24 staging.
 
static void Luv24fromLuv48 (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Quantise native signed Luv triplets into LogLuv24 staging.
 
static void Luv32toXYZ (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Convert staged LogLuv32 codes to native float XYZ triplets.
 
static void Luv32toLuv48 (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Convert staged LogLuv32 codes to native signed Luv triplets.
 
static void Luv32toRGB (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Convert staged LogLuv32 codes to clipped gamma-two RGB bytes.
 
static void Luv32fromXYZ (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Quantise native float XYZ triplets into LogLuv32 staging.
 
static void Luv32fromLuv48 (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Quantise native signed Luv triplets into LogLuv32 staging.
 
static void _logLuvNop (LogLuvState *sp, uint8_t *op, tmsize_t n)
 Perform no SGILog pixel translation.
 
static int LogL16GuessDataFmt (TIFFDirectory *td)
 Infer grayscale SGILog input format from directory fields.
 
static tmsize_t multiply_ms (TIFF *tif, const char *module, tmsize_t m1, tmsize_t m2)
 Multiply translation-buffer extents with signed-size checking.
 
static int LogL16InitState (TIFF *tif)
 Validate grayscale SGILog format and allocate translation pixels.
 
static int LogLuvGuessDataFmt (TIFFDirectory *td)
 Infer colour SGILog input format from directory fields.
 
static int LogLuvInitState (TIFF *tif)
 Validate contiguous LogLuv format and allocate packed translation pixels.
 
static int LogLuvFixupTags (TIFF *tif)
 Accept SGILog tag fixup without changes.
 
static int LogLuvSetupDecode (TIFF *tif)
 Select SGILog row decoding and application-format conversion.
 
static int LogLuvSetupEncode (TIFF *tif)
 Select SGILog row encoding and input conversion.
 
static void LogLuvClose (TIFF *tif)
 Normalise encoded SGILog directory sample metadata before writing.
 
static void LogLuvCleanup (TIFF *tif)
 Restore SGILog tag methods and release translation/codec state.
 
static int LogLuvVSetField (TIFF *tif, uint32_t tag, va_list ap)
 Set SGILog user format or dithering and update representation metadata.
 
static int LogLuvVGetField (TIFF *tif, uint32_t tag, va_list ap)
 Retrieve SGILog user format or delegate another tag query.
 
int TIFFInitSGILog (TIFF *tif, int scheme)
 Allocate SGILog codec state and install row dispatch and tag hooks.
 

Variables

void(* logLuvState::tfunc )(LogLuvState *, uint8_t *, tmsize_t)
 Translate pixels between caller bytes and packed codec staging.
 
static const TIFFField LogLuvFields []
 Define SGILog user format and encoding-method pseudo-tags.
 
struct { 
 
   float   ustart 
 Lower u-prime boundary of this row. More...
 
   short   nus 
 Count horizontal bins in this chromaticity row. More...
 
   short   ncum 
 Count all bins preceding this row. More...
 
} uv_row [UV_NVS] 
 Map each v-prime row to its u-prime start and bin index interval.
 

Detailed Description

Compress logarithmic luminance and packed LogLuv pixel rows.

Macro Definition Documentation

◆ DecoderState

#define DecoderState (   tif)    ((LogLuvState *)(tif)->tif_data)

Borrow handle-owned SGILog decode state.

Expands to a cast of tif->tif_data to LogLuvState *, evaluating tif once. The state is not checked; it is valid only after TIFFInitSGILog.

Parameters
[in]tifTIFF handle whose codec state is borrowed.

Definition at line 225 of file tif_luv.c.

◆ EncoderState

#define EncoderState (   tif)    ((LogLuvState *)(tif)->tif_data)

Borrow handle-owned SGILog encode state.

Expands to a cast of tif->tif_data to LogLuvState *, evaluating tif once. The state is not checked; it is valid only after TIFFInitSGILog.

Parameters
[in]tifTIFF handle whose codec state is borrowed.

Definition at line 226 of file tif_luv.c.

◆ M_LN2

#define M_LN2   0.69314718055994530942

Supply the natural logarithm of two when absent.

Fallback definition of ln 2 for platforms whose <math.h> lacks it; used by the log-luminance decoders.

Definition at line 1142 of file tif_luv.c.

◆ M_PI

#define M_PI   3.14159265358979323846

Supply pi when absent.

Fallback definition of pi for platforms whose <math.h> lacks it; used by uv2ang.

Definition at line 1145 of file tif_luv.c.

◆ MINRUN

#define MINRUN   4 /* minimum run length */

Choose four pixels as the minimum byte-plane run.

The run-length encoders emit a run code only for at least MINRUN (4) equal bytes in a byte plane; shorter repeats are written as literals.

Definition at line 230 of file tif_luv.c.

◆ NANGLES

#define NANGLES   100

Partition the gamut perimeter into one hundred hue angles.

Value 100: the number of hue bins in the static oog_encode lookup table. Undefined again after oog_encode.

Definition at line 1577 of file tif_luv.c.

◆ PACK [1/2]

#define PACK (   a,
  b 
)    (((a) << 3) | (b))

Combine directory format fields for a local inference switch.

The grayscale three-argument form takes [in] s sample count, [in] b bit depth, and [in] f sample format. The colour two-argument form takes [in] a bit depth and [in] b sample format. These function-local macros share a name; the reference displays the last parsed argument shape. Each argument is evaluated once; each macro is undefined at the end of its function.

Returns
Integer switch key under the enclosing format-inference layout.

◆ PACK [2/2]

#define PACK (   s,
  b,
  f 
)    (((b) << 6) | ((s) << 3) | (f))

Combine directory format fields for a local inference switch.

The grayscale three-argument form takes [in] s sample count, [in] b bit depth, and [in] f sample format. The colour two-argument form takes [in] a bit depth and [in] b sample format. These function-local macros share a name; the reference displays the last parsed argument shape. Each argument is evaluated once; each macro is undefined at the end of its function.

Returns
Integer switch key under the enclosing format-inference layout.

◆ SGILOGDATAFMT_UNKNOWN

#define SGILOGDATAFMT_UNKNOWN   -1

Mark a user representation not yet inferred.

Value -1 in LogLuvState::user_datafmt. Set by TIFFInitSGILog and returned by the format guessers; setup then infers the format from the directory and fails if none matches.

Definition at line 228 of file tif_luv.c.

◆ TIFF_RAND_MAX

#define TIFF_RAND_MAX   32767

Limit SGILog pseudo-random output to fifteen bits.

Value 32767, the largest value returned by _TIFFRand; tiff_itrunc divides by it to scale dither noise to one unit.

Definition at line 1148 of file tif_luv.c.

◆ U_NEU

#define U_NEU   0.210526316

Select neutral u-prime chromaticity.

Define the neutral CIE u-prime chromaticity used by LogLuv.

Value 4/19 (0.210526316), the CIE 1976 u' of the equal-energy white point. Substituted for chromaticity of zero-luminance or invalid input. Defined here only if UVSCALE is not already defined by tiffio.h.

Definition at line 5168 of file tiffio.h.

◆ uv2ang

#define uv2ang (   u,
  v 
)
Value:
((NANGLES * .499999999 / M_PI) * atan2((v) - V_NEU, (u) - U_NEU) + \
.5 * NANGLES)
#define U_NEU
Select neutral u-prime chromaticity.
Definition tiffio.h:5168
#define V_NEU
Select neutral v-prime chromaticity.
Definition tiffio.h:5173
#define NANGLES
Partition the gamut perimeter into one hundred hue angles.
Definition tif_luv.c:1577
#define M_PI
Supply pi when absent.
Definition tif_luv.c:1145

Map finite chromaticity to a bounded hue lookup angle.

Evaluates u and v once each and returns the atan2 hue around the neutral point (U_NEU, V_NEU), scaled to a double in [0, NANGLES). Undefined again after oog_encode.

Parameters
[in]uFinite u-prime chromaticity coordinate.
[in]vFinite v-prime chromaticity coordinate.

Definition at line 1578 of file tif_luv.c.

◆ UVSCALE

#define UVSCALE   410.

Scale uniform eight-bit chromaticity for LogLuv32.

Define the chromaticity scale factor for 32-bit LogLuv encoding.

Value 410: multiplies u' and v' into the 8-bit fields of a LogLuv32 pixel (u' and v' are below 0.62, so the product fits in 8 bits). Defined here only if not already defined by tiffio.h.

Definition at line 5178 of file tiffio.h.

◆ V_NEU

#define V_NEU   0.473684211

Select neutral v-prime chromaticity.

Define the neutral CIE v-prime chromaticity used by LogLuv.

Value 9/19 (0.473684211), the CIE 1976 v' of the equal-energy white point. Substituted for chromaticity of zero-luminance or invalid input. Defined here only if UVSCALE is not already defined by tiffio.h.

Definition at line 5173 of file tiffio.h.

Typedef Documentation

◆ LogLuvState

typedef struct logLuvState LogLuvState

Name the SGILog codec-owned translation state.

Definition at line 167 of file tif_luv.c.

Function Documentation

◆ _logLuvNop()

static void _logLuvNop ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Perform no SGILog pixel translation.

Ignores all arguments without touching buffers or state. Installed as the default tfunc by TIFFInitSGILog; decode/encode setup replaces it with a converter for any user format other than the native ones (SGILOGDATAFMT_16BIT for LogL, SGILOGDATAFMT_RAW for LogLuv), which the coders copy directly. No status result.

Parameters
[in]spUnused codec state.
[in]opUnused caller pixel bytes.
[in]nUnused pixel count.

Definition at line 2235 of file tif_luv.c.

Referenced by TIFFInitSGILog().

Here is the caller graph for this function:

◆ _TIFFRand()

static uint32_t _TIFFRand ( void  )
static

Advance the shared SGILog pseudo-random dither generator.

Seeds a static counter from time when zero, advances a fixed linear-congruential recurrence and returns fifteen output bits. State is process-global and unsynchronised; serialise all calls/dithered conversions across threads. No heap allocation, TIFF diagnostics, client I/O, returned storage or ownership transfer.

Returns
Pseudo-random integer from zero through TIFF_RAND_MAX.

Definition at line 1163 of file tif_luv.c.

References TIFF_RAND_MAX.

Referenced by tiff_itrunc().

Here is the caller graph for this function:

◆ L16fromL16()

static void L16fromL16 ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Copy native caller luminance words into staging.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Copies n native int16_t words one at a time through the unaligned load helper; no conversion, dithering or shared state. No allocation, I/O, diagnostics or status result.

Parameters
[in,out]spBorrowed live codec state whose aligned translation storage receives n staged pixels; encode_meth is not used.
[in]opCaller input of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 1383 of file tif_luv.c.

References LogLuvLoad16NativeUnaligned(), and logLuvState::tbuf.

Referenced by LogL16Encode().

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

◆ L16fromY()

static void L16fromY ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Quantise native float luminance into staged LogL16 codes.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Encodes one native float per pixel (unaligned input allowed) with LogL16fromY. When encode_meth is SGILOGENCODE_RANDITHER, dithering advances the process-global, unsynchronised _TIFFRand state; serialise such calls across threads. No allocation, I/O, diagnostics or status result.

Parameters
[in,out]spBorrowed live codec state whose aligned translation storage receives n staged pixels; encode_meth selects truncation or random dithering.
[in]opCaller input of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 1522 of file tif_luv.c.

References logLuvState::encode_meth, LogL16fromY(), LogLuvLoadFloatNativeUnaligned(), and logLuvState::tbuf.

Referenced by LogLuvSetupEncode().

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

◆ L16toGry()

static void L16toGry ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Convert staged LogL16 values to clipped gamma-two grayscale bytes.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Decodes each code with LogL16toY and writes one byte per pixel as 256*sqrt(Y), clipped to 0..255. Touches no shared state. No allocation, I/O, diagnostics or status result.

Parameters
[in]spBorrowed live codec state whose aligned translation storage holds n staged pixels; encode_meth is not used.
[out]opCaller output of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 1490 of file tif_luv.c.

References LogL16toY(), and logLuvState::tbuf.

Referenced by LogLuvSetupDecode().

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

◆ L16toL16()

static void L16toL16 ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Copy encoded luminance words from staging to native caller bytes.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Copies n native int16_t words one at a time through the unaligned store helper; no conversion, dithering or shared state. No allocation, I/O, diagnostics or status result.

Parameters
[in]spBorrowed live codec state whose aligned translation storage holds n staged pixels; encode_meth is not used.
[out]opCaller output of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 1356 of file tif_luv.c.

References LogLuvStore16NativeUnaligned(), and logLuvState::tbuf.

Referenced by LogL16Decode().

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

◆ L16toY()

static void L16toY ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Convert staged LogL16 values to native float luminance.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Decodes each code with LogL16toY and stores one native float per pixel; unaligned output is allowed. Touches no shared state. No allocation, I/O, diagnostics or status result.

Parameters
[in]spBorrowed live codec state whose aligned translation storage holds n staged pixels; encode_meth is not used.
[out]opCaller output of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 1464 of file tif_luv.c.

References LogL16toY(), LogLuvStoreFloatNativeUnaligned(), and logLuvState::tbuf.

Referenced by LogLuvSetupDecode().

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

◆ LogL16Decode()

static int LogL16Decode ( TIFF *  tif,
uint8_t *  op,
tmsize_t  occ,
uint16_t  s 
)
static

Decode two compressed luminance byte planes and translate one row.

Requires successful setup, sample zero, positive pixel_size and a complete nonnegative pixel extent; a translation buffer shorter than the row is diagnosed and rejected. Reconstructs staging from two run-length coded byte planes, then copies encoded values or invokes tfunc. Compressed runs are clipped to the requested pixel count. Short input diagnoses, commits consumed raw cursors and zeroes the occ caller bytes, as does a too-short translation buffer; output conversion is deferred until staging succeeds. State/tbuf/raw progress can change on failure. No allocation, direct client I/O, shared-state access or caller ownership transfer.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle operations.
[out]opCaller output for occ/pixel_size pixels in the selected user format.
[in]occNonnegative whole-pixel output byte count.
[in]sSample zero; row methods assert this for contiguous/gray coding.
Returns
One after reconstructed output, zero on translation-capacity or short-input rejection.

Definition at line 335 of file tif_luv.c.

References _TIFFmemset(), DecoderState, L16toL16(), SGILOGDATAFMT_16BIT, TIFFDirectory::td_row, tiff::tif_dir, tiff::tif_rawcc, tiff::tif_rawcp, TIFF_SSIZE_FORMAT, and TIFFErrorExtR().

Referenced by LogLuvSetupDecode().

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

◆ LogL16Encode()

static int LogL16Encode ( TIFF *  tif,
uint8_t *  bp,
tmsize_t  cc,
uint16_t  s 
)
static

Translate one input row and emit luminance byte-plane runs.

Requires successful setup, sample zero, positive pixel_size and complete nonnegative pixel input; a translation buffer shorter than the row is diagnosed and rejected. Copies native encoded/raw input or invokes tfunc, then writes cached output and flushes as needed through LogLuvReserve(). Before each write, LogLuvFits() checks the space left in the raw buffer, so a buffer too small for a literal packet (up to 128 bytes) or run is diagnosed and rejected instead of overrun. Input remains caller-owned and unchanged; translation may mutate shared dithering state, requiring cross-thread serialisation. Flush errors diagnose where detected and can leave partial stream/file progress. No rollback or ownership transfer.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle and shared dithering operations.
[in]bpCaller input of cc bytes.
[in]ccNonnegative byte count of whole user pixels.
[in]sSample zero; row methods assert this for contiguous/gray coding.
Returns
One after row bytes buffered, zero on capacity validation or flush failure.

Definition at line 739 of file tif_luv.c.

References EncoderState, L16fromL16(), LogLuvFits(), LogLuvReserve(), MINRUN, SGILOGDATAFMT_16BIT, tiff::tif_rawcc, tiff::tif_rawcp, tiff::tif_rawdatasize, and TIFFErrorExtR().

Referenced by LogLuvSetupEncode().

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

◆ LogL16GuessDataFmt()

static int LogL16GuessDataFmt ( TIFFDirectory *  td)
static

Infer grayscale SGILog input format from directory fields.

Recognises one-sample native float32, sixteen-bit encoded luminance and byte grayscale under the supported sample formats. Pure directory read with no allocation, I/O, diagnostics, mutation or ownership transfer.

Parameters
[in]tdBorrowed directory metadata.
Returns
SGILOGDATAFMT value or UNKNOWN for an unsupported combination.

Definition at line 2253 of file tif_luv.c.

References PACK, SAMPLEFORMAT_IEEEFP, SAMPLEFORMAT_INT, SAMPLEFORMAT_UINT, SAMPLEFORMAT_VOID, SGILOGDATAFMT_16BIT, SGILOGDATAFMT_8BIT, SGILOGDATAFMT_FLOAT, SGILOGDATAFMT_UNKNOWN, TIFFDirectory::td_bitspersample, TIFFDirectory::td_sampleformat, and TIFFDirectory::td_samplesperpixel.

Referenced by LogL16InitState().

Here is the caller graph for this function:

◆ LogL16InitState()

static int LogL16InitState ( TIFF *  tif)
static

Validate grayscale SGILog format and allocate translation pixels.

Requires PHOTOMETRIC_LOGL and fresh/released translation storage. Validates one sample, infers format if needed, sets pixel_size and chooses tile or bounded-strip pixel capacity. Checked multiplication guards allocation extent and reports an overflow once; Ext allocation becomes codec-owned. Failure diagnoses after cached state can change. Repeated success can overwrite an unreleased tbuf. No payload I/O or caller ownership transfer.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle operations.
Returns
One after allocation, zero on format/geometry/allocation failure.

Definition at line 2311 of file tif_luv.c.

References _TIFFfreeExt(), _TIFFmallocExt(), DecoderState, isTiled, LogL16GuessDataFmt(), multiply_ms(), PHOTOMETRIC_LOGL, logLuvState::pixel_size, SGILOGDATAFMT_16BIT, SGILOGDATAFMT_8BIT, SGILOGDATAFMT_FLOAT, SGILOGDATAFMT_UNKNOWN, logLuvState::tbuf, logLuvState::tbuflen, tiff::tif_dir, TIFFErrorExtR(), and logLuvState::user_datafmt.

Referenced by LogLuvSetupDecode(), and LogLuvSetupEncode().

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

◆ LogLuvCleanup()

static void LogLuvCleanup ( TIFF *  tif)
static

Restore SGILog tag methods and release translation/codec state.

Frees owned tbuf and outer Ext allocation, clears tif_data, restores saved tag hooks and installs default compression methods. Invalidates codec-owned views. Does not normalise metadata, finish/flush payload, close the handle or return status.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle operations.

Definition at line 2797 of file tif_luv.c.

References _TIFFfreeExt(), _TIFFSetDefaultCompressionState(), logLuvState::tbuf, tiff::tif_data, tiff::tif_tagmethods, TIFFTagMethods::vgetfield, logLuvState::vgetparent, TIFFTagMethods::vsetfield, and logLuvState::vsetparent.

Referenced by TIFFInitSGILog().

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

◆ LogLuvClose()

static void LogLuvClose ( TIFF *  tif)
static

Normalise encoded SGILog directory sample metadata before writing.

If encoder_state is set, directly changes SamplesPerPixel to one for LogL or three for LogLuv, BitsPerSample to sixteen and SampleFormat to signed. This affects advertised directory representation regardless of user format. When SamplesPerPixel or BitsPerSample actually changes, first frees and unsets ColorMap, TransferFunction (clearing their recorded lengths), SMinSampleValue and SMaxSampleValue, whose sizes depend on those values, so the directory writer cannot read past them. Direct assignment bypasses the TIFFSetField() checks that would refuse these changes once writing has begun. Does not free state, flush payload, close the handle or return status; no ownership transfer.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle operations.

Definition at line 2731 of file tif_luv.c.

References _TIFFfreeExt(), logLuvState::encoder_state, FIELD_COLORMAP, FIELD_SMAXSAMPLEVALUE, FIELD_SMINSAMPLEVALUE, FIELD_TRANSFERFUNCTION, PHOTOMETRIC_LOGL, SAMPLEFORMAT_INT, TIFFDirectory::td_bitspersample, TIFFDirectory::td_colormap, TIFFDirectory::td_colormap_alloc, TIFFDirectory::td_colormap_count, TIFFDirectory::td_photometric, TIFFDirectory::td_sampleformat, TIFFDirectory::td_samplesperpixel, TIFFDirectory::td_smaxsamplevalue, TIFFDirectory::td_sminsamplevalue, TIFFDirectory::td_transferfunction, TIFFDirectory::td_transferfunction_count, tiff::tif_data, tiff::tif_dir, and TIFFClrFieldBit.

Referenced by TIFFInitSGILog().

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

◆ LogLuvDecode24()

static int LogLuvDecode24 ( TIFF *  tif,
uint8_t *  op,
tmsize_t  occ,
uint16_t  s 
)
static

Decode three stored bytes per packed colour pixel and translate one row.

Requires successful setup, sample zero, positive pixel_size and a complete nonnegative pixel extent; a translation buffer shorter than the row is diagnosed and rejected. Unpacks fixed three-byte pixels into staging (there is no run coding), then copies raw values or invokes tfunc. Short input diagnoses, commits consumed raw cursors and zeroes the occ caller bytes, as does a too-short translation buffer. State/tbuf/raw progress can change on failure. No allocation, direct client I/O, shared-state access or caller ownership transfer.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle operations.
[out]opCaller output for occ/pixel_size pixels in the selected user format.
[in]occNonnegative whole-pixel output byte count.
[in]sSample zero; row methods assert this for contiguous/gray coding.
Returns
One after reconstructed output, zero on translation-capacity or short-input rejection.

Definition at line 437 of file tif_luv.c.

References _TIFFmemset(), DecoderState, LuvRawToRaw(), SGILOGDATAFMT_RAW, TIFFDirectory::td_row, tiff::tif_dir, tiff::tif_rawcc, tiff::tif_rawcp, TIFF_SSIZE_FORMAT, and TIFFErrorExtR().

Referenced by LogLuvSetupDecode().

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

◆ LogLuvDecode32()

static int LogLuvDecode32 ( TIFF *  tif,
uint8_t *  op,
tmsize_t  occ,
uint16_t  s 
)
static

Decode four compressed colour byte planes and translate one row.

Requires successful setup, sample zero, positive pixel_size and a complete nonnegative pixel extent; a translation buffer shorter than the row is diagnosed and rejected. Reconstructs staging from four run-length coded byte planes, then copies raw values or invokes tfunc. Compressed runs are clipped to the requested pixel count. Short input diagnoses, commits consumed raw cursors and zeroes the occ caller bytes, as does a too-short translation buffer; output conversion is deferred until staging succeeds. State/tbuf/raw progress can change on failure. No allocation, direct client I/O, shared-state access or caller ownership transfer.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle operations.
[out]opCaller output for occ/pixel_size pixels in the selected user format.
[in]occNonnegative whole-pixel output byte count.
[in]sSample zero; row methods assert this for contiguous/gray coding.
Returns
One after reconstructed output, zero on translation-capacity or short-input rejection.

Definition at line 516 of file tif_luv.c.

References _TIFFmemset(), DecoderState, LuvRawToRaw(), SGILOGDATAFMT_RAW, TIFFDirectory::td_row, tiff::tif_dir, tiff::tif_rawcc, tiff::tif_rawcp, TIFF_SSIZE_FORMAT, and TIFFErrorExtR().

Referenced by LogLuvSetupDecode().

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

◆ LogLuvDecodeStrip()

static int LogLuvDecodeStrip ( TIFF *  tif,
uint8_t *  bp,
tmsize_t  cc,
uint16_t  s 
)
static

Decode complete SGILog strip rows through the selected row callback.

Queries the positive decoded scanline byte size, rejects fractional requests and dispatches one row at a time. Requires nonnegative complete-row extent and a selected callback. Continues for nonzero row status; installed SGILog row decoders use zero/one. A zero row size or fractional request zeroes all cc caller bytes; a row failure zeroes the failed row and every later one. Earlier rows, raw state and codec/file progress remain on failure. No result allocation or ownership transfer; row decoder effects apply.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle operations.
[out]bpCaller output of cc bytes.
[in]ccByte count; a nonnegative multiple of TIFFScanlineSize.
[in]sSample zero; row methods assert this for contiguous/gray coding.
Returns
One when all bytes processed, zero on zero-row-size, fractional extent or row failure.

Definition at line 619 of file tif_luv.c.

References _TIFFmemset(), tiff::tif_decoderow, TIFFErrorExtR(), and TIFFScanlineSize().

Referenced by TIFFInitSGILog().

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

◆ LogLuvDecodeTile()

static int LogLuvDecodeTile ( TIFF *  tif,
uint8_t *  bp,
tmsize_t  cc,
uint16_t  s 
)
static

Decode complete SGILog tile rows through the selected row callback.

Queries the positive decoded tile-row byte size, rejects fractional requests and dispatches one row at a time. Requires nonnegative complete-row extent and a selected callback. Continues for nonzero row status; installed SGILog row decoders use zero/one. A zero row size or fractional request zeroes all cc caller bytes; a row failure zeroes the failed row and every later one. Earlier rows, raw state and codec/file progress remain on failure. No result allocation or ownership transfer; row decoder effects apply.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle operations.
[out]bpCaller output of cc bytes.
[in]ccByte count; a nonnegative multiple of TIFFTileRowSize.
[in]sSample zero; row methods assert this for contiguous/gray coding.
Returns
One when all bytes processed, zero on zero-row-size, fractional extent or row failure.

Definition at line 679 of file tif_luv.c.

References _TIFFmemset(), tiff::tif_decoderow, TIFFErrorExtR(), and TIFFTileRowSize().

Referenced by TIFFInitSGILog().

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

◆ LogLuvEncode24()

static int LogLuvEncode24 ( TIFF *  tif,
uint8_t *  bp,
tmsize_t  cc,
uint16_t  s 
)
static

Translate one input row and emit three-byte packed colour pixels.

Requires successful setup, sample zero, positive pixel_size and complete nonnegative pixel input; a translation buffer shorter than the row is diagnosed and rejected. Copies native encoded/raw input or invokes tfunc, then writes cached output and flushes as needed. A raw buffer that cannot hold three bytes after a flush is diagnosed and rejected instead of overrun. Input remains caller-owned and unchanged; translation may mutate the shared _TIFFRand dithering state and lazily fill the shared oog_encode table, requiring cross-thread serialisation. Flush errors diagnose where detected and can leave partial stream/file progress. No rollback or ownership transfer.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle and shared dithering operations.
[in]bpCaller input of cc bytes.
[in]ccNonnegative byte count of whole user pixels.
[in]sSample zero; row methods assert this for contiguous/gray coding.
Returns
One after row bytes buffered, zero on capacity validation or flush failure.

Definition at line 866 of file tif_luv.c.

References EncoderState, LogLuvFits(), LogLuvReserve(), LuvRawFromRaw(), SGILOGDATAFMT_RAW, tiff::tif_rawcc, tiff::tif_rawcp, tiff::tif_rawdatasize, and TIFFErrorExtR().

Referenced by LogLuvSetupEncode().

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

◆ LogLuvEncode32()

static int LogLuvEncode32 ( TIFF *  tif,
uint8_t *  bp,
tmsize_t  cc,
uint16_t  s 
)
static

Translate one input row and emit colour byte-plane runs.

Requires successful setup, sample zero, positive pixel_size and complete nonnegative pixel input; a translation buffer shorter than the row is diagnosed and rejected. Copies native encoded/raw input or invokes tfunc, then writes cached output and flushes as needed through LogLuvReserve(). Before each write, LogLuvFits() checks the space left in the raw buffer, so a buffer too small for a literal packet (up to 128 bytes) or run is diagnosed and rejected instead of overrun. Input remains caller-owned and unchanged; translation may mutate shared dithering state, requiring cross-thread serialisation. Flush errors diagnose where detected and can leave partial stream/file progress. No rollback or ownership transfer.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle and shared dithering operations.
[in]bpCaller input of cc bytes.
[in]ccNonnegative byte count of whole user pixels.
[in]sSample zero; row methods assert this for contiguous/gray coding.
Returns
One after row bytes buffered, zero on capacity validation or flush failure.

Definition at line 938 of file tif_luv.c.

References EncoderState, LogLuvFits(), LogLuvReserve(), LuvRawFromRaw(), MINRUN, SGILOGDATAFMT_RAW, tiff::tif_rawcc, tiff::tif_rawcp, tiff::tif_rawdatasize, and TIFFErrorExtR().

Referenced by LogLuvSetupEncode().

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

◆ LogLuvEncodeStrip()

static int LogLuvEncodeStrip ( TIFF *  tif,
uint8_t *  bp,
tmsize_t  cc,
uint16_t  s 
)
static

Encode complete SGILog strip rows through the selected row callback.

Queries the positive decoded scanline byte size, rejects fractional requests and dispatches one row at a time. Requires nonnegative complete-row extent and a selected callback. Continues only for callback status exactly one. Earlier rows, raw state and codec/file progress remain on failure. No result allocation or ownership transfer; row converter/dither/I/O effects apply.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle and shared dithering operations.
[in]bpCaller input of cc bytes.
[in]ccByte count; a nonnegative multiple of TIFFScanlineSize.
[in]sSample zero; row methods assert this for contiguous/gray coding.
Returns
One when all bytes processed, zero on zero-row-size, fractional extent or row failure.

Definition at line 1063 of file tif_luv.c.

References tiff::tif_encoderow, TIFFErrorExtR(), and TIFFScanlineSize().

Referenced by TIFFInitSGILog().

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

◆ LogLuvEncodeTile()

static int LogLuvEncodeTile ( TIFF *  tif,
uint8_t *  bp,
tmsize_t  cc,
uint16_t  s 
)
static

Encode complete SGILog tile rows through the selected row callback.

Queries the positive decoded tile-row byte size, rejects fractional requests and dispatches one row at a time. Requires nonnegative complete-row extent and a selected callback. Continues only for callback status exactly one. Earlier rows, raw state and codec/file progress remain on failure. No result allocation or ownership transfer; row converter/dither/I/O effects apply.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle and shared dithering operations.
[in]bpCaller input of cc bytes.
[in]ccByte count; a nonnegative multiple of TIFFTileRowSize.
[in]sSample zero; row methods assert this for contiguous/gray coding.
Returns
One when all bytes processed, zero on zero-row-size, fractional extent or row failure.

Definition at line 1108 of file tif_luv.c.

References tiff::tif_encoderow, TIFFErrorExtR(), and TIFFTileRowSize().

Referenced by TIFFInitSGILog().

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

◆ LogLuvFits()

static int LogLuvFits ( TIFF *  tif,
const char *  module,
const uint8_t *  op,
tmsize_t  need 
)
static

Verify that need bytes fit before the raw buffer end.

One loop iteration of the run-length encoders can emit a 128-byte literal block followed by a 2-byte run; a raw data buffer smaller than that used to be silently overrun. This helper reports an error via TIFFErrorExtR() and returns zero instead. It does not write to the raw buffer or modify any cursor.

Parameters
[in]tifLive SGILog handle; only tif_rawdata and tif_rawdatasize are read.
[in]moduleBorrowed diagnostic prefix string.
[in]opBorrowed pointer to the current output cursor within the raw buffer.
[in]needNumber of bytes the next write unit requires.
Returns
One if need bytes fit between op and the buffer end; zero otherwise (error already reported).

Definition at line 290 of file tif_luv.c.

References tiff::tif_rawdata, tiff::tif_rawdatasize, TIFF_SSIZE_FORMAT, and TIFFErrorExtR().

Referenced by LogL16Encode(), LogLuvEncode24(), and LogLuvEncode32().

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

◆ LogLuvFixupTags()

static int LogLuvFixupTags ( TIFF *  tif)
static

Accept SGILog tag fixup without changes.

No allocation, I/O, diagnostics, state or ownership effects.

Parameters
[in]tifUnused SGILog handle.
Returns
One unconditionally.

Definition at line 2523 of file tif_luv.c.

Referenced by TIFFInitSGILog().

Here is the caller graph for this function:

◆ LogLuvGuessDataFmt()

static int LogLuvGuessDataFmt ( TIFFDirectory *  td)
static

Infer colour SGILog input format from directory fields.

Recognises float XYZ, sixteen-bit Luv triples, byte RGB or one-sample packed raw words, checking the relevant sample-count combinations. Pure directory read with no allocation, I/O, diagnostics, mutation or ownership transfer.

Parameters
[in]tdBorrowed directory metadata.
Returns
SGILOGDATAFMT value or UNKNOWN for an unsupported combination.

Definition at line 2382 of file tif_luv.c.

References PACK, SAMPLEFORMAT_IEEEFP, SAMPLEFORMAT_INT, SAMPLEFORMAT_UINT, SAMPLEFORMAT_VOID, SGILOGDATAFMT_16BIT, SGILOGDATAFMT_8BIT, SGILOGDATAFMT_FLOAT, SGILOGDATAFMT_RAW, SGILOGDATAFMT_UNKNOWN, TIFFDirectory::td_bitspersample, TIFFDirectory::td_sampleformat, and TIFFDirectory::td_samplesperpixel.

Referenced by LogLuvInitState().

Here is the caller graph for this function:

◆ LogLuvInitState()

static int LogLuvInitState ( TIFF *  tif)
static

Validate contiguous LogLuv format and allocate packed translation pixels.

Requires PHOTOMETRIC_LOGLUV, contiguous layout and fresh/released translation storage. Infers supported XYZ/Luv48/raw/RGB format, caches pixel bytes and allocates checked tile/bounded-strip uint32_t staging; an extent overflow is reported once. Failure diagnoses after state can change; repeated setup can overwrite unreleased storage. No payload I/O or caller ownership transfer.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle operations.
Returns
One after allocation, zero on layout/format/geometry/allocation failure.

Definition at line 2452 of file tif_luv.c.

References _TIFFfreeExt(), _TIFFmallocExt(), DecoderState, isTiled, LogLuvGuessDataFmt(), multiply_ms(), PHOTOMETRIC_LOGLUV, logLuvState::pixel_size, PLANARCONFIG_CONTIG, SGILOGDATAFMT_16BIT, SGILOGDATAFMT_8BIT, SGILOGDATAFMT_FLOAT, SGILOGDATAFMT_RAW, SGILOGDATAFMT_UNKNOWN, logLuvState::tbuf, logLuvState::tbuflen, tiff::tif_dir, TIFFErrorExtR(), and logLuvState::user_datafmt.

Referenced by LogLuvSetupDecode(), and LogLuvSetupEncode().

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

◆ LogLuvLoad16NativeUnaligned()

static int16_t LogLuvLoad16NativeUnaligned ( const uint8_t *  cp)
static

Read one native-order signed sixteen-bit value through unaligned bytes.

Uses fixed-size memcpy on sufficient live byte storage. No byte-order conversion, allocation, I/O, diagnostics, retained pointer or ownership transfer.

Parameters
[in]cpReadable bytes for one native value; unaligned allowed.
Returns
Loaded native value.

Definition at line 1280 of file tif_luv.c.

Referenced by L16fromL16(), Luv24fromLuv48(), and Luv32fromLuv48().

Here is the caller graph for this function:

◆ LogLuvLoad32NativeUnaligned()

static uint32_t LogLuvLoad32NativeUnaligned ( const uint8_t *  cp)
static

Read one native-order unsigned thirty-two-bit value through unaligned bytes.

Uses fixed-size memcpy on sufficient live byte storage. No byte-order conversion, allocation, I/O, diagnostics, retained pointer or ownership transfer.

Parameters
[in]cpReadable bytes for one native value; unaligned allowed.
Returns
Loaded native value.

Definition at line 1316 of file tif_luv.c.

Referenced by LuvRawFromRaw().

Here is the caller graph for this function:

◆ LogLuvLoadFloatNativeUnaligned()

static float LogLuvLoadFloatNativeUnaligned ( const uint8_t *  cp)
static

Read one native-order float through unaligned bytes.

Uses fixed-size memcpy on sufficient live byte storage. No byte-order conversion, allocation, I/O, diagnostics, retained pointer or ownership transfer.

Parameters
[in]cpReadable bytes for one native value; unaligned allowed.
Returns
Loaded native value.

Definition at line 1245 of file tif_luv.c.

Referenced by L16fromY(), Luv24fromXYZ(), and Luv32fromXYZ().

Here is the caller graph for this function:

◆ LogLuvReserve()

static int LogLuvReserve ( TIFF *  tif,
uint8_t **  opp,
tmsize_t *  occ,
tmsize_t  need 
)
static

Flush the raw data buffer when fewer than need bytes remain.

If the local remaining count (*occ) already satisfies need, returns immediately with no I/O. Otherwise publishes the local cursor into tif->tif_rawcp / tif->tif_rawcc, calls TIFFFlushData1(), and reloads *opp / *occ from the refreshed handle state. A successful flush can never provide more than tif_rawdatasize bytes, so the caller must still verify capacity via LogLuvFits() before writing. On flush failure *opp and *occ are not reloaded; diagnostics are emitted by TIFFFlushData1. No allocation occurs; opp and occ are borrowed in/out pointers.

Parameters
[in,out]tifLive SGILog handle whose raw cursor and count may change across the flush.
[in,out]oppBorrowed pointer to the encoder's local raw output cursor; updated on successful flush.
[in,out]occBorrowed pointer to the local remaining byte count; updated on successful flush.
[in]needMinimum bytes the caller requires before writing.
Returns
One if *occ already provided need bytes or the flush succeeded (a successful flush still does not guarantee need bytes; the caller must re-check, e.g. via LogLuvFits()); zero if TIFFFlushData1() failed.

Definition at line 258 of file tif_luv.c.

References tiff::tif_rawcc, tiff::tif_rawcp, tiff::tif_rawdatasize, and TIFFFlushData1().

Referenced by LogL16Encode(), LogLuvEncode24(), and LogLuvEncode32().

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

◆ LogLuvSetupDecode()

static int LogLuvSetupDecode ( TIFF *  tif)
static

Select SGILog row decoding and application-format conversion.

Disables ordinary postdecode swapping, validates LogL/LogLuv photometric and allocates translation state through its initialiser. Selects 16-bit luminance, 24-bit raw-packed or 32-bit byte-plane row decoding and the appropriate conversion callback. Raw/encoded-luminance paths use explicit copies; some converter slots remain no-op. Failure can retain allocations and changed methods/postdecode for cleanup. No pixel I/O or caller ownership transfer.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle operations.
Returns
One after selection, zero on unsupported photometric or state setup failure.

Definition at line 2546 of file tif_luv.c.

References _TIFFNoPostDecode(), COMPRESSION_SGILOG24, DecoderState, L16toGry(), L16toY(), LogL16Decode(), LogL16InitState(), LogLuvDecode24(), LogLuvDecode32(), LogLuvInitState(), Luv24toLuv48(), Luv24toRGB(), Luv24toXYZ(), Luv32toLuv48(), Luv32toRGB(), Luv32toXYZ(), PHOTOMETRIC_LOGL, PHOTOMETRIC_LOGLUV, SGILOGDATAFMT_16BIT, SGILOGDATAFMT_8BIT, SGILOGDATAFMT_FLOAT, TIFFDirectory::td_compression, TIFFDirectory::td_photometric, tiff::tif_decoderow, tiff::tif_dir, tiff::tif_postdecode, and TIFFErrorExtR().

Referenced by LogLuvVSetField(), and TIFFInitSGILog().

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

◆ LogLuvSetupEncode()

static int LogLuvSetupEncode ( TIFF *  tif)
static

Select SGILog row encoding and input conversion.

Initialises LogL/LogLuv translation storage, chooses 16/24/32-bit row coding and supported float/encoded/raw input conversion, then marks encoder_state. Byte display input is not encodable here. Failure can retain allocation/method changes; diagnoses unsupported format/photometric. No pixel I/O or caller ownership transfer.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle operations.
Returns
One after selection, zero on unsupported input or state setup failure.

Definition at line 2636 of file tif_luv.c.

References COMPRESSION_SGILOG24, EncoderState, L16fromY(), LogL16Encode(), LogL16InitState(), LogLuvEncode24(), LogLuvEncode32(), LogLuvInitState(), Luv24fromLuv48(), Luv24fromXYZ(), Luv32fromLuv48(), Luv32fromXYZ(), PHOTOMETRIC_LOGL, PHOTOMETRIC_LOGLUV, SGILOGDATAFMT_16BIT, SGILOGDATAFMT_FLOAT, SGILOGDATAFMT_RAW, TIFFDirectory::td_compression, TIFFDirectory::td_photometric, tiff::tif_dir, tiff::tif_encoderow, and TIFFErrorExtR().

Referenced by TIFFInitSGILog().

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

◆ LogLuvStore16NativeUnaligned()

static void LogLuvStore16NativeUnaligned ( uint8_t *  cp,
int16_t  v 
)
static

Write one native-order signed sixteen-bit value through unaligned bytes.

Uses fixed-size memcpy on sufficient live byte storage. No byte-order conversion, allocation, I/O, diagnostics, retained pointer or ownership transfer.

Parameters
[out]cpWritable bytes for one native value; unaligned allowed.
[in]vValue to store.

Definition at line 1299 of file tif_luv.c.

Referenced by L16toL16(), Luv24toLuv48(), and Luv32toLuv48().

Here is the caller graph for this function:

◆ LogLuvStore32NativeUnaligned()

static void LogLuvStore32NativeUnaligned ( uint8_t *  cp,
uint32_t  v 
)
static

Write one native-order unsigned thirty-two-bit value through unaligned bytes.

Uses fixed-size memcpy on sufficient live byte storage. No byte-order conversion, allocation, I/O, diagnostics, retained pointer or ownership transfer.

Parameters
[out]cpWritable bytes for one native value; unaligned allowed.
[in]vValue to store.

Definition at line 1335 of file tif_luv.c.

Referenced by LuvRawToRaw().

Here is the caller graph for this function:

◆ LogLuvStoreFloatNativeUnaligned()

static void LogLuvStoreFloatNativeUnaligned ( uint8_t *  cp,
float  v 
)
static

Write one native-order float through unaligned bytes.

Uses fixed-size memcpy on sufficient live byte storage. No byte-order conversion, allocation, I/O, diagnostics, retained pointer or ownership transfer.

Parameters
[out]cpWritable bytes for one native value; unaligned allowed.
[in]vValue to store.

Definition at line 1263 of file tif_luv.c.

Referenced by L16toY(), Luv24toXYZ(), and Luv32toXYZ().

Here is the caller graph for this function:

◆ LogLuvVGetField()

static int LogLuvVGetField ( TIFF *  tif,
uint32_t  tag,
va_list  ap 
)
static

Retrieve SGILog user format or delegate another tag query.

SGILOGDATAFMT consumes non-NULL int* and writes the cached format. SGILOGENCODE is not handled here and follows the parent getter contract, which can reject it. No output allocation or ownership transfer for the format.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle operations.
[in]tagCodec pseudo-tag or delegated identifier.
[in,out]apLive tag-specific va_list, consumed synchronously without retention.
Returns
One for format retrieval, otherwise parent getter status.

Definition at line 2954 of file tif_luv.c.

References tiff::tif_data, TIFFTAG_SGILOGDATAFMT, logLuvState::user_datafmt, and logLuvState::vgetparent.

Referenced by TIFFInitSGILog().

Here is the caller graph for this function:

◆ LogLuvVSetField()

static int LogLuvVSetField ( TIFF *  tif,
uint32_t  tag,
va_list  ap 
)
static

Set SGILog user format or dithering and update representation metadata.

SGILOGDATAFMT consumes int and stores before validation; supported values change depth/sample format through nested TIFFSetField calls, with RAW additionally setting SamplesPerPixel one. The first nested failure returns zero, leaving earlier nested changes and the stored format in place. Recalculates tile/scanline caches. SGILOGENCODE consumes int and stores before rejecting values other than NODITHER/RANDITHER. Failed assignments can retain changed values/metadata; other tags delegate. No ownership transfer.

Parameters
[in,out]tifNon-NULL live SGILog handle with valid current geometry/state; serialise handle operations.
[in]tagCodec pseudo-tag or delegated identifier.
[in,out]apLive tag-specific va_list, consumed synchronously without retention.
Returns
One on supported pseudo-tag handling, zero on explicit validation rejection, otherwise parent setter status.

Definition at line 2836 of file tif_luv.c.

References DecoderState, isTiled, LogLuvSetupDecode(), NOSTRIP, NOTILE, PHOTOMETRIC_LOGLUV, SAMPLEFORMAT_IEEEFP, SAMPLEFORMAT_INT, SAMPLEFORMAT_UINT, SGILOGDATAFMT_16BIT, SGILOGDATAFMT_8BIT, SGILOGDATAFMT_FLOAT, SGILOGDATAFMT_RAW, SGILOGENCODE_NODITHER, SGILOGENCODE_RANDITHER, TIFFDirectory::td_curstrip, TIFFDirectory::td_curtile, TIFFDirectory::td_photometric, TIFFDirectory::td_scanlinesize, TIFFDirectory::td_tilesize, tiff::tif_dir, tiff::tif_flags, tiff::tif_name, TIFF_CODERSETUP, TIFFErrorExtR(), TIFFScanlineSize(), TIFFSetField(), TIFFTAG_BITSPERSAMPLE, TIFFTAG_SAMPLEFORMAT, TIFFTAG_SAMPLESPERPIXEL, TIFFTAG_SGILOGDATAFMT, TIFFTAG_SGILOGENCODE, and TIFFTileSize().

Referenced by TIFFInitSGILog().

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

◆ Luv24fromLuv48()

static void Luv24fromLuv48 ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Quantise native signed Luv triplets into LogLuv24 staging.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Encodes three native int16_t values per pixel (unaligned input allowed): L is clamped to the 10-bit range and u, v (scaled by 2^15) are encoded with uv_encode. When encode_meth is SGILOGENCODE_RANDITHER, dithering advances the process-global, unsynchronised _TIFFRand state. With either method, out-of-gamut chromaticity may lazily initialise the process-global, unsynchronised oog_encode table. Serialise such calls across threads. No allocation, I/O, diagnostics or status result.

Parameters
[in,out]spBorrowed live codec state whose aligned translation storage receives n staged pixels; encode_meth selects truncation or random dithering.
[in]opCaller input of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 1938 of file tif_luv.c.

References logLuvState::encode_meth, LogLuvLoad16NativeUnaligned(), SGILOGENCODE_NODITHER, logLuvState::tbuf, tiff_itrunc(), U_NEU, uv_encode(), and V_NEU.

Referenced by LogLuvSetupEncode().

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

◆ Luv24fromXYZ()

static void Luv24fromXYZ ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Quantise native float XYZ triplets into LogLuv24 staging.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Encodes three native floats per pixel (unaligned input allowed) with LogLuv24fromXYZ. When encode_meth is SGILOGENCODE_RANDITHER, dithering advances the process-global, unsynchronised _TIFFRand state. With either method, out-of-gamut chromaticity may lazily initialise the process-global, unsynchronised oog_encode table. Serialise such calls across threads. No allocation, I/O, diagnostics or status result.

Parameters
[in,out]spBorrowed live codec state whose aligned translation storage receives n staged pixels; encode_meth selects truncation or random dithering.
[in]opCaller input of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 1902 of file tif_luv.c.

References logLuvState::encode_meth, LogLuv24fromXYZ(), LogLuvLoadFloatNativeUnaligned(), and logLuvState::tbuf.

Referenced by LogLuvSetupEncode().

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

◆ Luv24toLuv48()

static void Luv24toLuv48 ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Convert staged LogLuv24 codes to native signed Luv triplets.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Expands each code into three native int16_t values: L rebased from the 10-bit log luminance, and u and v as u' and v' scaled by 2^15. Invalid chromaticity indices decode as the neutral point. Unaligned output is allowed. Touches no shared state. No allocation, I/O, diagnostics or status result.

Parameters
[in]spBorrowed live codec state whose aligned translation storage holds n staged pixels; encode_meth is not used.
[out]opCaller output of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 1824 of file tif_luv.c.

References LogLuvStore16NativeUnaligned(), logLuvState::tbuf, U_NEU, uv_decode(), and V_NEU.

Referenced by LogLuvSetupDecode().

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

◆ Luv24toRGB()

static void Luv24toRGB ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Convert staged LogLuv24 codes to clipped gamma-two RGB bytes.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Decodes each code with LogLuv24toXYZ and XYZtoRGB24, writing three bytes per pixel (CCIR-709 primaries, gamma 2, clipped to 0..255). Touches no shared state. No allocation, I/O, diagnostics or status result.

Parameters
[in]spBorrowed live codec state whose aligned translation storage holds n staged pixels; encode_meth is not used.
[out]opCaller output of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 1867 of file tif_luv.c.

References LogLuv24toXYZ(), logLuvState::tbuf, and XYZtoRGB24().

Referenced by LogLuvSetupDecode().

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

◆ Luv24toXYZ()

static void Luv24toXYZ ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Convert staged LogLuv24 codes to native float XYZ triplets.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Decodes each code with LogLuv24toXYZ and stores three native floats per pixel; unaligned output is allowed. Invalid chromaticity indices decode as the neutral point. Touches no shared state. No allocation, I/O, diagnostics or status result.

Parameters
[in]spBorrowed live codec state whose aligned translation storage holds n staged pixels; encode_meth is not used.
[out]opCaller output of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 1791 of file tif_luv.c.

References LogLuv24toXYZ(), LogLuvStoreFloatNativeUnaligned(), and logLuvState::tbuf.

Referenced by LogLuvSetupDecode().

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

◆ Luv32fromLuv48()

static void Luv32fromLuv48 ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Quantise native signed Luv triplets into LogLuv32 staging.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Packs three native int16_t values per pixel (unaligned input allowed): L is stored unchanged in the upper 16 bits and u, v are rescaled by UVSCALE/2^15 and masked (not clipped) to 8 bits. With SGILOGENCODE_NODITHER this uses integer arithmetic; otherwise each component is dithered through the process-global, unsynchronised _TIFFRand state, so serialise such calls across threads. No allocation, I/O, diagnostics or status result.

Parameters
[in,out]spBorrowed live codec state whose aligned translation storage receives n staged pixels; encode_meth selects truncation or random dithering.
[in]opCaller input of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 2185 of file tif_luv.c.

References logLuvState::encode_meth, LogLuvLoad16NativeUnaligned(), SGILOGENCODE_NODITHER, logLuvState::tbuf, tiff_itrunc(), and UVSCALE.

Referenced by LogLuvSetupEncode().

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

◆ Luv32fromXYZ()

static void Luv32fromXYZ ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Quantise native float XYZ triplets into LogLuv32 staging.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Encodes three native floats per pixel (unaligned input allowed) with LogLuv32fromXYZ; u and v are clipped to 0..255. When encode_meth is SGILOGENCODE_RANDITHER, dithering advances the process-global, unsynchronised _TIFFRand state; serialise such calls across threads. No allocation, I/O, diagnostics or status result.

Parameters
[in,out]spBorrowed live codec state whose aligned translation storage receives n staged pixels; encode_meth selects truncation or random dithering.
[in]opCaller input of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 2150 of file tif_luv.c.

References logLuvState::encode_meth, LogLuv32fromXYZ(), LogLuvLoadFloatNativeUnaligned(), and logLuvState::tbuf.

Referenced by LogLuvSetupEncode().

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

◆ Luv32toLuv48()

static void Luv32toLuv48 ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Convert staged LogLuv32 codes to native signed Luv triplets.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Splits each code into three native int16_t values: L copied from the upper 16 bits, and u and v rescaled from the 8-bit fields to u' and v' times 2^15. Unaligned output is allowed. Touches no shared state. No allocation, I/O, diagnostics or status result.

Parameters
[in]spBorrowed live codec state whose aligned translation storage holds n staged pixels; encode_meth is not used.
[out]opCaller output of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 2077 of file tif_luv.c.

References LogLuvStore16NativeUnaligned(), logLuvState::tbuf, and UVSCALE.

Referenced by LogLuvSetupDecode().

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

◆ Luv32toRGB()

static void Luv32toRGB ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Convert staged LogLuv32 codes to clipped gamma-two RGB bytes.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Decodes each code with LogLuv32toXYZ and XYZtoRGB24, writing three bytes per pixel (CCIR-709 primaries, gamma 2, clipped to 0..255). Touches no shared state. No allocation, I/O, diagnostics or status result.

Parameters
[in]spBorrowed live codec state whose aligned translation storage holds n staged pixels; encode_meth is not used.
[out]opCaller output of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 2116 of file tif_luv.c.

References LogLuv32toXYZ(), logLuvState::tbuf, and XYZtoRGB24().

Referenced by LogLuvSetupDecode().

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

◆ Luv32toXYZ()

static void Luv32toXYZ ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Convert staged LogLuv32 codes to native float XYZ triplets.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Decodes each code with LogLuv32toXYZ and stores three native floats per pixel; unaligned output is allowed. Touches no shared state. No allocation, I/O, diagnostics or status result.

Parameters
[in]spBorrowed live codec state whose aligned translation storage holds n staged pixels; encode_meth is not used.
[out]opCaller output of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 2045 of file tif_luv.c.

References LogLuv32toXYZ(), LogLuvStoreFloatNativeUnaligned(), and logLuvState::tbuf.

Referenced by LogLuvSetupDecode().

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

◆ LuvRawFromRaw()

static void LuvRawFromRaw ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Copy native caller LogLuv words into staging.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Copies n native uint32_t words one at a time through the unaligned load helper; no conversion, dithering or shared state. No allocation, I/O, diagnostics or status result.

Parameters
[in,out]spBorrowed live codec state whose aligned translation storage receives n staged pixels; encode_meth is not used.
[in]opCaller input of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 1437 of file tif_luv.c.

References LogLuvLoad32NativeUnaligned(), and logLuvState::tbuf.

Referenced by LogLuvEncode24(), and LogLuvEncode32().

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

◆ LuvRawToRaw()

static void LuvRawToRaw ( LogLuvState *  sp,
uint8_t *  op,
tmsize_t  n 
)
static

Copy packed LogLuv words from staging to native caller bytes.

Requires n complete pixels of aligned codec staging and disjoint caller storage for n pixels in the selected native format. Copies n native uint32_t words one at a time through the unaligned store helper; no conversion, dithering or shared state. No allocation, I/O, diagnostics or status result.

Parameters
[in]spBorrowed live codec state whose aligned translation storage holds n staged pixels; encode_meth is not used.
[out]opCaller output of n pixels in the selected native format.
[in]nNonnegative pixel count, not bytes, within translation capacity.

Definition at line 1410 of file tif_luv.c.

References LogLuvStore32NativeUnaligned(), and logLuvState::tbuf.

Referenced by LogLuvDecode24(), and LogLuvDecode32().

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

◆ multiply_ms()

static tmsize_t multiply_ms ( TIFF *  tif,
const char *  module,
tmsize_t  m1,
tmsize_t  m2 
)
static

Multiply translation-buffer extents with signed-size checking.

Delegates to _TIFFMultiplySSize with the calling handle and label, so an overflow is reported through the per-handle error handler instead of returning a bare zero. No allocation, I/O, state or ownership effects.

Parameters
[in]tifOpen TIFF handle used to report an overflow.
[in]moduleName of the calling function, used as the message label.
[in]m1Nonnegative first buffer extent.
[in]m2Nonnegative second buffer extent.
Returns
Positive product, or zero for zero/rejected/overflowed operands.

Definition at line 2289 of file tif_luv.c.

References _TIFFMultiplySSize().

Referenced by LogL16InitState(), and LogLuvInitState().

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

◆ oog_encode()

static int oog_encode ( double  u,
double  v 
)
static

Map out-of-gamut chromaticity to a hue-matched boundary bin.

Requires finite coordinates with a representable hue index. Lazily fills a static perimeter lookup from immutable uv_row geometry and nearest populated angles, then indexes it by atan2 hue. First-use initialisation is unsynchronised and must be serialised across threads. No heap allocation, I/O, diagnostics or ownership transfer.

Parameters
[in]uFinite u-prime chromaticity coordinate.
[in]vFinite v-prime chromaticity coordinate.
Returns
Selected chromaticity table index; no independent error status.

Definition at line 1596 of file tif_luv.c.

References NANGLES, nus, ustart, uv2ang, UV_NVS, uv_row, UV_SQSIZ, and UV_VSTART.

Referenced by uv_encode().

Here is the caller graph for this function:

◆ tiff_itrunc()

static int tiff_itrunc ( double  x,
int  m 
)
static

Quantise a finite value with optional shared random dithering.

Requires the input and dithered result to fit int. NODITHER casts directly, otherwise adds uniform approximate half-unit noise from _TIFFRand before truncation. Serialise shared random-state access. No heap allocation, client I/O, diagnostics or ownership transfer.

Parameters
[in]xFinite value whose quantisation and dithered result fit int.
[in]mNODITHER for direct truncation, otherwise shared random dithering.
Returns
Truncated or dithered integer; no error sentinel.

Definition at line 1189 of file tif_luv.c.

References _TIFFRand(), SGILOGENCODE_NODITHER, and TIFF_RAND_MAX.

Referenced by LogL10fromY(), LogL16fromY(), LogLuv32fromXYZ(), Luv24fromLuv48(), Luv32fromLuv48(), and uv_encode().

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

◆ TIFFInitSGILog()

int TIFFInitSGILog ( TIFF *  tif,
int  scheme 
)
extern

Allocate SGILog codec state and install row dispatch and tag hooks.

Requires SGILOG/SGILOG24 and cleaned-up previous codec state. Merges pseudo-tags, allocates zeroed Ext state, saves tag methods and installs strile/setup/close/cleanup dispatch. Row methods are selected at later setup. Defaults no dither for SGILOG and random dither for SGILOG24, unknown user format and no-op translation. Merge/allocation failures diagnose without rollback; no pixel I/O or caller ownership transfer.

Parameters
[in,out]tifNon-NULL handle whose previous codec state has been cleaned up; receives the new codec state. Serialise access.
[in]schemeCOMPRESSION_SGILOG or COMPRESSION_SGILOG24, selecting default dithering.
Returns
One after installation, zero on field merge or state allocation failure.

Definition at line 2981 of file tif_luv.c.

References _logLuvNop(), _TIFFmallocExt(), _TIFFmemset(), _TIFFMergeFields(), COMPRESSION_SGILOG, COMPRESSION_SGILOG24, LogLuvCleanup(), LogLuvClose(), LogLuvDecodeStrip(), LogLuvDecodeTile(), LogLuvEncodeStrip(), LogLuvEncodeTile(), LogLuvFields, LogLuvFixupTags(), LogLuvSetupDecode(), LogLuvSetupEncode(), LogLuvVGetField(), LogLuvVSetField(), SGILOGDATAFMT_UNKNOWN, SGILOGENCODE_NODITHER, SGILOGENCODE_RANDITHER, tiff::tif_cleanup, tiff::tif_close, tiff::tif_data, tiff::tif_decodestrip, tiff::tif_decodetile, tiff::tif_encodestrip, tiff::tif_encodetile, tiff::tif_fixuptags, tiff::tif_name, tiff::tif_setupdecode, tiff::tif_setupencode, tiff::tif_tagmethods, TIFFArrayCount, TIFFErrorExtR(), TIFFTagMethods::vgetfield, and TIFFTagMethods::vsetfield.

Here is the call graph for this function:

Variable Documentation

◆ LogLuvFields

const TIFFField LogLuvFields[]
static
Initial value:
= {
TRUE, FALSE, "SGILogDataFmt", NULL},
TRUE, FALSE, "SGILogEncode", NULL}}
#define FIELD_PSEUDO
Share bit zero with FIELD_IGNORE for pseudo-tags.
Definition tif_dir.h:620
@ TIFF_SETGET_INT
Promoted int scalar representation.
Definition tif_dir.h:762
#define TRUE
Represent the legacy internal true value.
Definition tiffiop.h:131
#define FALSE
Represent the legacy internal false value.
Definition tiffiop.h:136
#define TIFFTAG_SGILOGENCODE
Pseudo-tag: SGILog data encoding control.
Definition tiff.h:1627
#define TIFFTAG_SGILOGDATAFMT
Pseudo-tag: SGILog user data format.
Definition tiff.h:1617
@ TIFF_SHORT
Unsigned 16-bit integer.
Definition tiff.h:237

Define SGILog user format and encoding-method pseudo-tags.

Immutable library-lifetime metadata merged into a handle; no caller ownership transfer.

Definition at line 2975 of file tif_luv.c.

Referenced by TIFFInitSGILog().

◆ []

short { ... } ::ncum

Count all bins preceding this row.

Definition at line 33 of file uvcode.h.

◆ []

short { ... } ::nus

Count horizontal bins in this chromaticity row.

Definition at line 31 of file uvcode.h.

◆ tfunc

void(* logLuvState::tfunc) (LogLuvState *, uint8_t *, tmsize_t)

Translate pixels between caller bytes and packed codec staging.

Invoked synchronously. First argument [in,out] is borrowed LogLuvState, second [in,out] is borrowed caller pixel storage (input for encoding, output for decoding), third [in] is a nonnegative pixel count within both capacities. Wide caller bytes may be unaligned; tbuf is allocator aligned. No pointer retention or ownership transfer. Encoding can mutate shared dither/perimeter state; there is no return status. The selected concrete converter states its representation and direction.

Definition at line 214 of file tif_luv.c.

◆ []

float { ... } ::ustart

Lower u-prime boundary of this row.

Definition at line 29 of file uvcode.h.

◆ uv_row

uv_row
static

Map each v-prime row to its u-prime start and bin index interval.

Map v-prime rows to u-prime boundaries and bin index intervals.

Immutable library-lifetime storage; do not modify or free it. nus is the horizontal bin count and ncum is the number of preceding bins.

Immutable library-lifetime table; do not modify or free it.

Referenced by oog_encode(), uv_decode(), and uv_encode().