|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Compand linear samples into predicted eleven-bit zlib streams. More...
Data Structures | |
| struct | PixarLogState |
| Own PixarLog companding tables predictor prefix and zlib progress. More... | |
Macros | |
| #define | TSIZE 2048 /* decode table size (11-bit tokens) */ |
| Count the 2048 eleven-bit code values. | |
| #define | TSIZEP1 2049 /* Plus one for slop */ |
| Include one repeated endpoint in decode tables. | |
| #define | ONE 1250 /* token value of 1.0 exactly */ |
| Select code 1250 for linear value one. | |
| #define | RATIO 1.004 /* nominal ratio for log part */ |
| Choose the nominal log-region step ratio. | |
| #define | CODE_MASK 0x7ff /* 11 bits. */ |
| Mask accumulated codes to eleven bits. | |
| #define | REPEAT(n, op) |
| Repeat a statement n times, and at least once. | |
| #define | SCALE12 2048.0f |
| Scale PICIO output by 2048. | |
| #define | CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071) |
| Cap positive PICIO output at 3071. | |
| #define | PLSTATE_INIT 1 |
| Mark dependency stream initialised. | |
| #define | PixarLogDecoderState(tif) ((PixarLogState *)(tif)->tif_data) |
| Borrow the handle-owned PixarLog decoder state. | |
| #define | PixarLogEncoderState(tif) ((PixarLogState *)(tif)->tif_data) |
| Borrow the handle-owned PixarLog encoder state. | |
| #define | PIXARLOGDATAFMT_UNKNOWN -1 |
| Mark an application format not yet inferred or selected. | |
| #define | CLAMP(v) |
| Map one float sixteen-bit or byte input to a companded code in its enclosing converter. | |
| #define | CLAMP(v) From14[(v) >> 2] |
| Map one float sixteen-bit or byte input to a companded code in its enclosing converter. | |
| #define | CLAMP(v) (From8[(v)]) |
| Map one float sixteen-bit or byte input to a companded code in its enclosing converter. | |
Functions | |
| static float | PixarLogLoadFloatNativeUnaligned (const uint8_t *cp) |
| Read one unaligned native-order float. | |
| static void | PixarLogStoreFloatNativeUnaligned (uint8_t *cp, float v) |
| Write one unaligned native-order float. | |
| static uint16_t | PixarLogLoad16NativeUnaligned (const uint8_t *cp) |
| Read one unaligned native-order sixteen-bit sample. | |
| static void | PixarLogStore16NativeUnaligned (uint8_t *cp, uint16_t v) |
| Write one unaligned native-order sixteen-bit sample. | |
| static void | horizontalAccumulateF (uint16_t *wp, tmsize_t n, int stride, uint8_t *op, float *ToLinearF) |
| Accumulate PixarLog prediction into float32 linear samples. | |
| static void | horizontalAccumulate12 (uint16_t *wp, tmsize_t n, int stride, uint8_t *op, float *ToLinearF) |
| Accumulate PixarLog prediction into twelve-bit PICIO values scaled by 2048 and capped at 3071. | |
| static void | horizontalAccumulate16 (uint16_t *wp, tmsize_t n, int stride, uint8_t *op, uint16_t *ToLinear16) |
| Accumulate PixarLog prediction into clipped unsigned sixteen-bit linear samples. | |
| static void | horizontalAccumulate11 (uint16_t *wp, tmsize_t n, int stride, uint8_t *op) |
| Accumulate PixarLog prediction into raw eleven-bit code words in native uint16_t slots. | |
| static void | horizontalAccumulate8 (uint16_t *wp, tmsize_t n, int stride, unsigned char *op, unsigned char *ToLinear8) |
| Accumulate PixarLog prediction into clipped unsigned eight-bit linear samples. | |
| static void | horizontalAccumulate8abgr (uint16_t *wp, tmsize_t n, int stride, unsigned char *op, unsigned char *ToLinear8) |
| Accumulate PixarLog prediction into eight-bit ABGR bytes. | |
| static int | PixarLogMakeTables (TIFF *tif, PixarLogState *sp) |
| Build linear/log companding tables for PixarLog sample formats. | |
| static int | PixarLogGuessDataFmt (TIFFDirectory *td) |
| Infer the PixarLog user format from depth and sample format. | |
| static tmsize_t | multiply_ms (TIFF *tif, const char *module, tmsize_t m1, tmsize_t m2) |
| Multiply positive buffer extents with signed-size checking. | |
| static tmsize_t | add_ms (tmsize_t m1, tmsize_t m2) |
| Add positive buffer extents with signed overflow rejection. | |
| static int | PixarLogFixupTags (TIFF *tif) |
| Accept PixarLog tag fixup without changes. | |
| static int | PixarLogSetupDecode (TIFF *tif) |
| Allocate companded row storage and initialise PixarLog inflation. | |
| static int | PixarLogPreDecode (TIFF *tif, uint16_t s) |
| Reset PixarLog inflation over the current raw strile. | |
| static int | PixarLogDecode (TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s) |
| Inflate companded samples and convert complete PixarLog output rows. | |
| static int | PixarLogSetupEncode (TIFF *tif) |
| Allocate PixarLog code staging and initialise zlib deflation. | |
| static int | PixarLogPreEncode (TIFF *tif, uint16_t s) |
| Reset PixarLog deflation with the current raw output buffer. | |
| static void | horizontalDifferenceF (const uint8_t *ip, tmsize_t n, int stride, uint16_t *wp, uint16_t *FromLT2) |
| Compand finite native float32 samples and difference eleven-bit codes. | |
| static void | horizontalDifference16 (const uint8_t *ip, tmsize_t n, int stride, unsigned short *wp, uint16_t *From14) |
| Compand native unsigned sixteen-bit samples and difference eleven-bit codes. | |
| static void | horizontalDifference8 (unsigned char *ip, tmsize_t n, int stride, unsigned short *wp, uint16_t *From8) |
| Compand unsigned eight-bit samples and difference eleven-bit codes. | |
| static int | PixarLogEncode (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s) |
| Compand and difference complete input rows then deflate their codes. | |
| static int | PixarLogPostEncode (TIFF *tif) |
| Finish PixarLog deflation and flush encoded output. | |
| static void | PixarLogClose (TIFF *tif) |
| Present initialised PixarLog directory metadata as unsigned eight-bit samples. | |
| static void | PixarLogCleanup (TIFF *tif) |
| Restore PixarLog method chains and release companding storage. | |
| static int | PixarLogVSetField (TIFF *tif, uint32_t tag, va_list ap) |
| Set PixarLog quality or user data format and update directory sizes. | |
| static int | PixarLogVGetField (TIFF *tif, uint32_t tag, va_list ap) |
| Retrieve PixarLog quality or format or delegate another query. | |
| static uint64_t | PixarLogGetMaxCompressionRatio (TIFF *tif) |
| Report a conservative PixarLog expansion allocation heuristic. | |
| int | TIFFInitPixarLog (TIFF *tif, int scheme) |
| Install PixarLog codec state methods and companding tables. | |
Variables | |
| static float | Fltsize |
| Scale low-range float lookup indices. | |
| static float | LogK1 |
| Scale logarithmic float companding. | |
| static float | LogK2 |
| Normalise logarithmic float companding. | |
| static const TIFFField | pixarlogFields [] |
| Define PixarLog format and quality pseudo-tags. | |
Compand linear samples into predicted eleven-bit zlib streams.
| #define CLAMP | ( | v | ) |
Map one float sixteen-bit or byte input to a companded code in its enclosing converter.
Defined three times as a local helper. In horizontalDifferenceF it maps a float through FromLT2 below 2.0, returns 2047 above 24.2, and otherwise applies the LogK1/LogK2 logarithm; it evaluates v (unparenthesised) up to four times. In horizontalDifference16 it indexes From14 with v >> 2, and in horizontalDifference8 it indexes From8 with v; both evaluate v once.
| [in] | v | Input sample value. |
| #define CLAMP | ( | v | ) | From14[(v) >> 2] |
Map one float sixteen-bit or byte input to a companded code in its enclosing converter.
Defined three times as a local helper. In horizontalDifferenceF it maps a float through FromLT2 below 2.0, returns 2047 above 24.2, and otherwise applies the LogK1/LogK2 logarithm; it evaluates v (unparenthesised) up to four times. In horizontalDifference16 it indexes From14 with v >> 2, and in horizontalDifference8 it indexes From8 with v; both evaluate v once.
| [in] | v | Input sample value. |
| #define CLAMP | ( | v | ) | (From8[(v)]) |
Map one float sixteen-bit or byte input to a companded code in its enclosing converter.
Defined three times as a local helper. In horizontalDifferenceF it maps a float through FromLT2 below 2.0, returns 2047 above 24.2, and otherwise applies the LogK1/LogK2 logarithm; it evaluates v (unparenthesised) up to four times. In horizontalDifference16 it indexes From14 with v >> 2, and in horizontalDifference8 it indexes From8 with v; both evaluate v once.
| [in] | v | Input sample value. |
| #define CLAMP12 | ( | t | ) | (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071) |
Cap positive PICIO output at 3071.
Evaluates t twice. Values below 3071 are converted to int16_t through uint16_t; larger values become 3071. Used only by horizontalAccumulate12.
| [in] | t | Scaled float sample value. |
| #define CODE_MASK 0x7ff /* 11 bits. */ |
Mask accumulated codes to eleven bits.
Value 0x7ff. The accumulators and differencers apply it so that horizontal prediction wraps modulo 2048.
Definition at line 109 of file tif_pixarlog.c.
| #define ONE 1250 /* token value of 1.0 exactly */ |
Select code 1250 for linear value one.
Value 1250: the code that maps to linear 1.0. PixarLogMakeTables scales the logarithmic region so that ToLinearF[ONE] is 1.0.
Definition at line 106 of file tif_pixarlog.c.
| #define PIXARLOGDATAFMT_UNKNOWN -1 |
Mark an application format not yet inferred or selected.
Value -1 in PixarLogState::user_datafmt. Set by TIFFInitPixarLog and returned by PixarLogGuessDataFmt; setup then guesses the format from the directory and fails with a diagnostic if none matches.
Definition at line 1026 of file tif_pixarlog.c.
| #define PixarLogDecoderState | ( | tif | ) | ((PixarLogState *)(tif)->tif_data) |
Borrow the handle-owned PixarLog decoder state.
Expands to a cast of tif->tif_data to PixarLogState *, evaluating tif once. The state is not checked; it is valid only after TIFFInitPixarLog.
| [in] | tif | TIFF handle whose codec state is borrowed. |
Definition at line 1020 of file tif_pixarlog.c.
| #define PixarLogEncoderState | ( | tif | ) | ((PixarLogState *)(tif)->tif_data) |
Borrow the handle-owned PixarLog encoder state.
Expands to a cast of tif->tif_data to PixarLogState *, evaluating tif once. The state is not checked; it is valid only after TIFFInitPixarLog.
| [in] | tif | TIFF handle whose codec state is borrowed. |
Definition at line 1021 of file tif_pixarlog.c.
| #define PLSTATE_INIT 1 |
Mark dependency stream initialised.
Bit in PixarLogState::state, set once setup has initialised the zlib stream. Checked to avoid repeating setup, to decide whether cleanup ends the stream, and before applying quality changes or the close-time tag rewrite.
Definition at line 848 of file tif_pixarlog.c.
| #define RATIO 1.004 /* nominal ratio for log part */ |
Choose the nominal log-region step ratio.
Value 1.004. PixarLogMakeTables derives nlin = (int)(1 / log(RATIO)) linear codes, and the logarithmic region then steps by exp(1 / nlin), approximately RATIO, per code.
Definition at line 107 of file tif_pixarlog.c.
| #define REPEAT | ( | n, | |
| op | |||
| ) |
Repeat a statement n times, and at least once.
Expands to a block that declares a local int i, evaluates n once into it, and runs op in a do/while loop. op therefore executes max(n, 1) times, even when n <= 0, and must not refer to an outer variable named i.
| [in] | n | Repeat count, evaluated once. |
| [in] | op | Statement executed max(n, 1) times. |
Definition at line 140 of file tif_pixarlog.c.
| #define SCALE12 2048.0f |
Scale PICIO output by 2048.
Value 2048.0f: multiplies ToLinearF values into the PIXARLOGDATAFMT_12BITPICIO range, where linear 1.0 maps to 2048.
| #define TSIZE 2048 /* decode table size (11-bit tokens) */ |
Count the 2048 eleven-bit code values.
Value 2048: the number of 11-bit code values. PixarLogMakeTables fills ToLinearF for codes 0 to TSIZE - 1.
Definition at line 104 of file tif_pixarlog.c.
| #define TSIZEP1 2049 /* Plus one for slop */ |
Include one repeated endpoint in decode tables.
Value 2049 (TSIZE plus one): the size of the ToLinearF, ToLinear16 and ToLinear8 decode tables, which repeat the last entry so that index TSIZE is valid.
Definition at line 105 of file tif_pixarlog.c.
Add positive buffer extents with signed overflow rejection.
Requires nonnegative operands, asserted in debug builds. Treats either zero as a prior failure sentinel rather than an arithmetic identity. No allocation, I/O, diagnostics, state or ownership effects.
| [in] | m1 | Nonnegative first extent. |
| [in] | m2 | Nonnegative second extent. |
Definition at line 1109 of file tif_pixarlog.c.
References TIFF_TMSIZE_T_MAX.
Referenced by PixarLogSetupDecode().
|
static |
Accumulate PixarLog prediction into raw eleven-bit code words in native uint16_t slots.
Requires positive stride and n complete interleaved samples, with disjoint code/output storage. Recovers horizontal prediction modulo 2048; generic stride paths update the input code array in place. Does nothing when n is less than stride. Stores the accumulated codes themselves (no lookup table) as native uint16_t values through the unaligned store helper. For stride 3 and 4 the first pixel's codes are copied unmasked, so output from malformed streams can exceed 11 bits; later pixels and the generic-stride path are masked. No allocation, I/O, diagnostics, retained pointers, ownership transfer or independent extent validation; void result.
| [in,out] | wp | Aligned n-entry uint16_t code input; generic-stride paths update it in place. |
| [in] | n | Nonnegative sample count divisible by positive stride; buffers must cover complete rows. |
| [in] | stride | Positive samples per interleaved pixel, or one for separate data. |
| [out] | op | Writable format-specific output for n samples. |
Definition at line 560 of file tif_pixarlog.c.
References CODE_MASK, PixarLogStore16NativeUnaligned(), and REPEAT.
Referenced by PixarLogDecode().
|
static |
Accumulate PixarLog prediction into twelve-bit PICIO values scaled by 2048 and capped at 3071.
Requires positive stride and n complete interleaved samples, with disjoint code/output storage. Recovers horizontal prediction modulo 2048; generic stride paths update the input code array in place. Does nothing when n is less than stride. Maps codes through ToLinearF, scales by SCALE12 and caps with CLAMP12, storing native 16-bit values through the unaligned store helper. No allocation, I/O, diagnostics, retained pointers, ownership transfer or independent extent validation; void result.
| [in,out] | wp | Aligned n-entry uint16_t code input; generic-stride paths update it in place. |
| [in] | n | Nonnegative sample count divisible by positive stride; buffers must cover complete rows. |
| [in] | stride | Positive samples per interleaved pixel, or one for separate data. |
| [out] | op | Writable format-specific output for n samples. |
| [in] | ToLinearF | Borrowed initialised float decode table of TSIZEP1 entries. |
Definition at line 346 of file tif_pixarlog.c.
References CLAMP12, CODE_MASK, PixarLogStore16NativeUnaligned(), REPEAT, and SCALE12.
Referenced by PixarLogDecode().
|
static |
Accumulate PixarLog prediction into clipped unsigned sixteen-bit linear samples.
Requires positive stride and n complete interleaved samples, with disjoint code/output storage. Recovers horizontal prediction modulo 2048; generic stride paths update the input code array in place. Does nothing when n is less than stride. Maps codes through ToLinear16 and stores native uint16_t values through the unaligned store helper. No allocation, I/O, diagnostics, retained pointers, ownership transfer or independent extent validation; void result.
| [in,out] | wp | Aligned n-entry uint16_t code input; generic-stride paths update it in place. |
| [in] | n | Nonnegative sample count divisible by positive stride; buffers must cover complete rows. |
| [in] | stride | Positive samples per interleaved pixel, or one for separate data. |
| [out] | op | Writable format-specific output for n samples. |
| [in] | ToLinear16 | Borrowed initialised uint16_t decode table of TSIZEP1 entries. |
Definition at line 458 of file tif_pixarlog.c.
References CODE_MASK, PixarLogStore16NativeUnaligned(), and REPEAT.
Referenced by PixarLogDecode().
|
static |
Accumulate PixarLog prediction into clipped unsigned eight-bit linear samples.
Requires positive stride and n complete interleaved samples, with disjoint code/output storage. Recovers horizontal prediction modulo 2048; generic stride paths update the input code array in place. Does nothing when n is less than stride. Maps codes through ToLinear8 and writes one byte per sample. No allocation, I/O, diagnostics, retained pointers, ownership transfer or independent extent validation; void result.
| [in,out] | wp | Aligned n-entry uint16_t code input; generic-stride paths update it in place. |
| [in] | n | Nonnegative sample count divisible by positive stride; buffers must cover complete rows. |
| [in] | stride | Positive samples per interleaved pixel, or one for separate data. |
| [out] | op | Writable format-specific output for n samples. |
| [in] | ToLinear8 | Borrowed initialised byte decode table of TSIZEP1 entries. |
Definition at line 659 of file tif_pixarlog.c.
References CODE_MASK, and REPEAT.
Referenced by PixarLogDecode().
|
static |
Accumulate PixarLog prediction into eight-bit ABGR bytes.
Requires positive stride and n complete interleaved samples, with disjoint code/output storage. Recovers horizontal prediction modulo 2048; generic stride paths update the input code array in place. Does nothing when n is less than stride. Maps codes through ToLinear8 and writes bytes. Stride three expands each RGB triplet to four bytes with a leading zero; stride four reverses RGBA to ABGR; other strides preserve order. No allocation, I/O, diagnostics, retained pointers, ownership transfer or independent extent validation; void result.
| [in,out] | wp | Aligned n-entry uint16_t code input; generic-stride paths update it in place. |
| [in] | n | Nonnegative sample count divisible by positive stride; buffers must cover complete rows. |
| [in] | stride | Positive samples per interleaved pixel, or one for separate data. |
| [out] | op | Borrowed writable format-specific output for the requested complete samples/rows; ABGR stride three requires four bytes per pixel. |
| [in] | ToLinear8 | Borrowed initialised byte decode table of TSIZEP1 entries. |
Definition at line 739 of file tif_pixarlog.c.
References CODE_MASK, and REPEAT.
Referenced by PixarLogDecode().
|
static |
Accumulate PixarLog prediction into float32 linear samples.
Requires positive stride and n complete interleaved samples, with disjoint code/output storage. Recovers horizontal prediction modulo 2048; generic stride paths update the input code array in place. Does nothing when n is less than stride. Maps codes through ToLinearF and stores native floats through the unaligned store helper. No allocation, I/O, diagnostics, retained pointers, ownership transfer or independent extent validation; void result.
| [in,out] | wp | Aligned n-entry uint16_t code input; generic-stride paths update it in place. |
| [in] | n | Nonnegative sample count divisible by positive stride; buffers must cover complete rows. |
| [in] | stride | Positive samples per interleaved pixel, or one for separate data. |
| [out] | op | Writable format-specific output for n samples. |
| [in] | ToLinearF | Borrowed initialised float decode table of TSIZEP1 entries. |
Definition at line 248 of file tif_pixarlog.c.
References CODE_MASK, PixarLogStoreFloatNativeUnaligned(), and REPEAT.
Referenced by PixarLogDecode().
|
static |
Compand native unsigned sixteen-bit samples and difference eleven-bit codes.
Requires positive stride and n complete interleaved samples, disjoint input/code storage and an initialised From14 table. Keeps first-pixel codes then stores horizontal code differences modulo 2048. Sixteen-bit input is reduced to fourteen significant lookup bits. Native memcpy load helpers allow unaligned input; code output remains uint16_t aligned. Does nothing when n is less than stride. No allocation, I/O, diagnostics, retained pointers, ownership transfer or status result.
| [in] | ip | Borrowed n native-order uint16_t input samples; unaligned allowed. |
| [in] | n | Nonnegative sample count divisible by positive stride; buffers must cover complete rows. |
| [in] | stride | Positive samples per interleaved pixel, or one for separate data. |
| [out] | wp | Aligned n-entry uint16_t code output. |
| [in] | From14 | Borrowed initialised 16384-entry high-fourteen-bit input table. |
Definition at line 1768 of file tif_pixarlog.c.
References CLAMP, CODE_MASK, PixarLogLoad16NativeUnaligned(), and REPEAT.
Referenced by PixarLogEncode().
|
static |
Compand unsigned eight-bit samples and difference eleven-bit codes.
Requires positive stride and n complete interleaved samples, disjoint input/code storage and an initialised From8 table. Keeps first-pixel codes then stores horizontal code differences modulo 2048. Uses all eight input bits for lookup. Does nothing when n is less than stride. No allocation, I/O, diagnostics, retained pointers, ownership transfer or status result.
| [in] | ip | Borrowed n input bytes. |
| [in] | n | Nonnegative sample count divisible by positive stride; buffers must cover complete rows. |
| [in] | stride | Positive samples per interleaved pixel, or one for separate data. |
| [out] | wp | Aligned n-entry uint16_t code output. |
| [in] | From8 | Borrowed initialised 256-entry input table. |
Definition at line 1878 of file tif_pixarlog.c.
References CLAMP, CODE_MASK, and REPEAT.
Referenced by PixarLogEncode().
|
static |
Compand finite native float32 samples and difference eleven-bit codes.
Requires positive stride and n complete interleaved samples, disjoint input/code storage and initialised mapping coefficients/tables. Keeps first-pixel codes then stores horizontal code differences modulo 2048. Float negatives clamp to zero, values above 24.2 cap at 2047 and intermediate values use linear/log mapping; NaNs are not safe for casts. Reads global coefficients that table setup writes. Native memcpy load helpers allow unaligned public wide input; code output remains uint16_t aligned. No allocation, I/O, diagnostics, retained pointers, ownership transfer or status result.
| [in] | ip | Borrowed complete n-sample input, finite when floating point, native byte order. |
| [in] | n | Nonnegative sample count divisible by positive stride; buffers must cover complete rows. |
| [in] | stride | Positive samples per interleaved pixel, or one for separate data. |
| [out] | wp | Aligned n-entry uint16_t code output. |
| [in] | FromLT2 | Borrowed initialised low-range float companding table matching global coefficients. |
Definition at line 1645 of file tif_pixarlog.c.
References CLAMP, CODE_MASK, Fltsize, PixarLogLoadFloatNativeUnaligned(), and REPEAT.
Referenced by PixarLogEncode().
Multiply positive buffer extents with signed-size checking.
Delegates to _TIFFMultiplySSize with the calling handle and label, so a rejected or overflowed product is reported through the per-handle error handler. No allocation, I/O, state or ownership effects.
| [in] | tif | Open TIFF handle used to report a rejection. |
| [in] | module | Name of the calling function, used as the message label. |
| [in] | m1 | Nonnegative first extent. |
| [in] | m2 | Nonnegative second extent. |
Definition at line 1091 of file tif_pixarlog.c.
References _TIFFMultiplySSize().
Referenced by PixarLogSetupDecode().
|
static |
Restore PixarLog method chains and release companding storage.
Restores predictor and saved tag hooks, frees all six tables, ends zlib in the mode inferred from the handle open mode, frees tbuf and outer Ext state, clears tif_data and installs default methods. Invalidates all codec-owned views. Does not finish/flush pending payload or close the handle; no status result.
| [in,out] | tif | Non-NULL live PixarLog handle with valid state/geometry; serialise handle operations. |
Definition at line 2245 of file tif_pixarlog.c.
References _TIFFfreeExt(), _TIFFSetDefaultCompressionState(), PixarLogState::From14, PixarLogState::From8, PixarLogState::FromLT2, PLSTATE_INIT, PixarLogState::state, PixarLogState::stream, PixarLogState::tbuf, tiff::tif_data, tiff::tif_mode, tiff::tif_tagmethods, TIFFPredictorCleanup(), PixarLogState::ToLinear16, PixarLogState::ToLinear8, PixarLogState::ToLinearF, TIFFTagMethods::vgetfield, PixarLogState::vgetparent, TIFFTagMethods::vsetfield, and PixarLogState::vsetparent.
Referenced by TIFFInitPixarLog().
|
static |
Present initialised PixarLog directory metadata as unsigned eight-bit samples.
When PLSTATE_INIT is set, directly changes BitsPerSample to eight and SampleFormat to unsigned before lifecycle directory writing. If BitsPerSample was not already eight, first releases and clears ColorMap and TransferFunction (sized by 1<<BitsPerSample) and SMinSampleValue and SMaxSampleValue (no longer describing the stored samples), so they are not written. This changes the advertised format regardless of application input representation. Does not free state, emit/flush payload, close the handle or return status; no ownership transfer.
| [in,out] | tif | Non-NULL live PixarLog handle with valid state/geometry; serialise handle operations. |
Definition at line 2179 of file tif_pixarlog.c.
References _TIFFfreeExt(), FIELD_COLORMAP, FIELD_SMAXSAMPLEVALUE, FIELD_SMINSAMPLEVALUE, FIELD_TRANSFERFUNCTION, PLSTATE_INIT, SAMPLEFORMAT_UINT, PixarLogState::state, TIFFDirectory::td_bitspersample, TIFFDirectory::td_colormap, TIFFDirectory::td_colormap_alloc, TIFFDirectory::td_colormap_count, TIFFDirectory::td_sampleformat, TIFFDirectory::td_smaxsamplevalue, TIFFDirectory::td_sminsamplevalue, TIFFDirectory::td_transferfunction, TIFFDirectory::td_transferfunction_count, tiff::tif_data, tiff::tif_dir, and TIFFClrFieldBit.
Referenced by TIFFInitPixarLog().
Inflate companded samples and convert complete PixarLog output rows.
Requires successful predecode, positive stride/row width, representable whole-row extents and adequate format-specific caller storage. Inflates into bounded tbuf, commits raw cursors on success, swaps code words when needed, accumulates prediction and converts to the selected output format. A partial final sample row is warned/truncated and its unproduced output tail zeroed. Error paths generally clear requested output and diagnose after dependency state can change. The current three-channel ABGR size comparison rejects ordinary positive expanded requests; do not infer usable RGB-to-ABGR support from the format flag alone. No ownership transfer; dependency allocations can occur, no direct client I/O.
| [in,out] | tif | Non-NULL live PixarLog handle with valid state/geometry; serialise handle operations. |
| [out] | op | Borrowed writable format-specific output for the requested complete samples/rows; ABGR stride three requires four bytes per pixel. |
| [in] | occ | Nonnegative requested output bytes in the selected user format. |
| [in] | s | Unused sample-plane argument. |
Definition at line 1302 of file tif_pixarlog.c.
References horizontalAccumulate11(), horizontalAccumulate12(), horizontalAccumulate16(), horizontalAccumulate8(), horizontalAccumulate8abgr(), horizontalAccumulateF(), isTiled, PIXARLOGDATAFMT_11BITLOG, PIXARLOGDATAFMT_12BITPICIO, PIXARLOGDATAFMT_16BIT, PIXARLOGDATAFMT_8BIT, PIXARLOGDATAFMT_8BITABGR, PIXARLOGDATAFMT_FLOAT, PixarLogDecoderState, PixarLogState::stream, PixarLogState::stride, PixarLogState::tbuf, PixarLogState::tbuf_size, TIFFDirectory::td_row, tiff::tif_dir, tiff::tif_flags, tiff::tif_rawcc, tiff::tif_rawcp, TIFF_SSIZE_FORMAT, TIFF_SWAB, TIFFErrorExtR(), TIFFSwabArrayOfShort(), TIFFWarningExtR(), PixarLogState::ToLinear16, PixarLogState::ToLinear8, PixarLogState::ToLinearF, and PixarLogState::user_datafmt.
Referenced by TIFFInitPixarLog().
Compand and difference complete input rows then deflate their codes.
Requires successful setup/preencode and representable sample counts. Rows are TileWidth samples wide for a tiled image and ImageWidth otherwise, times the stride. A partial final row, or more rows than TileLength or RowsPerStrip, is diagnosed and rejected before any conversion, so the converters never read past the input. Grows the owned tbuf as needed with _TIFFCheckRealloc(); an allocation failure keeps the old buffer. Only float, sixteen-bit unsigned and eight-bit conversion cases are implemented. An unknown format is rejected immediately; PIXARLOGDATAFMT_8BITABGR, 11BITLOG and 12BITPICIO are diagnosed and rejected when the input holds at least one sample, while shorter input with them skips conversion and calls deflate with no new input. Writes owned tbuf, feeds bounded zlib input and flushes full raw buffers. Caller input remains unchanged; float samples must be finite for companding casts. Dependency/I/O failure can leave partial cache/file state; no rollback or ownership transfer.
| [in,out] | tif | Non-NULL live PixarLog handle with valid state/geometry; serialise handle operations. The float path reads the process-global Fltsize/LogK coefficients written by table initialisation. |
| [in] | bp | Borrowed readable cc-byte user input, disjoint from codec storage. |
| [in] | cc | Nonnegative complete-row input extent in the selected user format. |
| [in] | s | Unused sample-plane argument. |
Definition at line 1986 of file tif_pixarlog.c.
References _TIFFCheckRealloc(), PixarLogState::From14, PixarLogState::From8, PixarLogState::FromLT2, horizontalDifference16(), horizontalDifference8(), horizontalDifferenceF(), isTiled, PIXARLOGDATAFMT_11BITLOG, PIXARLOGDATAFMT_12BITPICIO, PIXARLOGDATAFMT_16BIT, PIXARLOGDATAFMT_8BIT, PIXARLOGDATAFMT_8BITABGR, PIXARLOGDATAFMT_FLOAT, PixarLogEncoderState, PixarLogState::stream, PixarLogState::stride, PixarLogState::tbuf, PixarLogState::tbuf_size, tiff::tif_dir, tiff::tif_rawcc, tiff::tif_rawdata, tiff::tif_rawdatasize, TIFFErrorExtR(), TIFFFlushData1(), and PixarLogState::user_datafmt.
Referenced by TIFFInitPixarLog().
|
static |
Accept PixarLog tag fixup without changes.
No allocation, I/O, diagnostics, state or ownership effects.
| [in] | tif | Unused PixarLog handle. |
Definition at line 1130 of file tif_pixarlog.c.
Referenced by TIFFInitPixarLog().
|
static |
Report a conservative PixarLog expansion allocation heuristic.
Ignores the handle; no allocation, I/O, diagnostics, state or ownership effects. Not a universal bound or successful-decode guarantee.
| [in] | tif | Unused PixarLog handle. |
Definition at line 2429 of file tif_pixarlog.c.
Referenced by TIFFInitPixarLog().
|
static |
Infer the PixarLog user format from depth and sample format.
Recognises float32, unsigned/void 8/11/16, and signed/void twelve-bit combinations. Reads borrowed directory only, without allocation, diagnostics, I/O or ownership effects.
| [in] | td | Borrowed current directory metadata. |
Definition at line 1039 of file tif_pixarlog.c.
References PIXARLOGDATAFMT_11BITLOG, PIXARLOGDATAFMT_12BITPICIO, PIXARLOGDATAFMT_16BIT, PIXARLOGDATAFMT_8BIT, PIXARLOGDATAFMT_FLOAT, PIXARLOGDATAFMT_UNKNOWN, SAMPLEFORMAT_IEEEFP, SAMPLEFORMAT_INT, SAMPLEFORMAT_UINT, SAMPLEFORMAT_VOID, TIFFDirectory::td_bitspersample, and TIFFDirectory::td_sampleformat.
Referenced by PixarLogSetupDecode(), and PixarLogSetupEncode().
|
static |
Read one unaligned native-order sixteen-bit sample.
Uses fixed-size memcpy and requires enough live byte storage. Does not convert byte order, allocate, do I/O, diagnose, retain pointers or transfer ownership.
| [in] | cp | Readable bytes for one native value; unaligned allowed. |
Definition at line 203 of file tif_pixarlog.c.
Referenced by horizontalDifference16().
|
static |
Read one unaligned native-order float.
Uses fixed-size memcpy and requires enough live byte storage. Does not convert byte order, allocate, do I/O, diagnose, retain pointers or transfer ownership.
| [in] | cp | Readable bytes for one native value; unaligned allowed. |
Definition at line 169 of file tif_pixarlog.c.
Referenced by horizontalDifferenceF().
|
static |
Build linear/log companding tables for PixarLog sample formats.
Requires fresh NULL table pointers. Allocates six Ext tables, derives linear low-end and logarithmic high-end mapping, clamps integer decode outputs and reduces sixteen-bit encode lookup to fourteen significant bits. Failure frees new tables and clears state pointers. Writes process-global Fltsize/LogK coefficients; serialise concurrent table initialisation and float encoding externally. Codec owns tables until cleanup; no pixel I/O.
| [in,out] | tif | Non-NULL live PixarLog handle whose Ext allocator receives the table allocations; serialise handle operations. |
| [in,out] | sp | Borrowed live codec state with fresh table pointers. |
Definition at line 890 of file tif_pixarlog.c.
References _TIFFfreeExt(), _TIFFmallocExt(), Fltsize, PixarLogState::From14, PixarLogState::From8, PixarLogState::FromLT2, LogK1, LogK2, ONE, RATIO, PixarLogState::ToLinear16, PixarLogState::ToLinear8, PixarLogState::ToLinearF, TSIZE, and TSIZEP1.
Referenced by TIFFInitPixarLog().
|
static |
Finish PixarLog deflation and flush encoded output.
Requires successful preencode, valid raw output and code state. Runs Z_FINISH until STREAM_END, flushing nonempty extents. Diagnostics report dependency errors; output/file progress can remain on failure. Does not persist IFD or promise durability; no ownership transfer.
| [in,out] | tif | Non-NULL live PixarLog handle with valid state/geometry; serialise handle operations. |
Definition at line 2124 of file tif_pixarlog.c.
References PixarLogEncoderState, tiff::tif_rawcc, tiff::tif_rawdata, tiff::tif_rawdatasize, TIFFErrorExtR(), and TIFFFlushData1().
Referenced by TIFFInitPixarLog().
|
static |
Reset PixarLog inflation over the current raw strile.
Requires successful decode setup. Attaches raw input, rejects a raw extent that does not round-trip through zlib uInt and calls inflateReset. Dependency state can change; no direct client I/O or ownership transfer.
| [in,out] | tif | Non-NULL live PixarLog handle with valid state/geometry; serialise handle operations. |
| [in] | s | Unused sample-plane argument. |
Definition at line 1256 of file tif_pixarlog.c.
References PixarLogDecoderState, tiff::tif_rawcc, tiff::tif_rawdata, and TIFFErrorExtR().
Referenced by TIFFInitPixarLog().
|
static |
Reset PixarLog deflation with the current raw output buffer.
Requires successful encoder setup and positive usable raw capacity. Attaches raw output, checks uInt round-trip conversion and calls deflateReset. No payload flush or ownership transfer; dependency state can change on reset failure.
| [in,out] | tif | Non-NULL live PixarLog handle with valid state/geometry; serialise handle operations. |
| [in] | s | Unused sample-plane argument. |
Definition at line 1600 of file tif_pixarlog.c.
References PixarLogEncoderState, tiff::tif_rawdata, tiff::tif_rawdatasize, and TIFFErrorExtR().
Referenced by TIFFInitPixarLog().
|
static |
Allocate companded row storage and initialise PixarLog inflation.
Returns immediately for initialised state. Disables ordinary postdecode swapping, derives positive sample stride, sizes tile/strip staging with an extra stride through checked size helpers, allocates Ext storage, guesses user format if needed and calls inflateInit. Detected format/dependency errors and extent multiplication overflow diagnose; an add overflow and ordinary allocation failure have no explicit diagnostic. Failure can change postdecode/stride and releases staging on specified format/dependency paths; no rollback or caller ownership transfer.
| [in,out] | tif | Non-NULL live PixarLog handle with valid state/geometry; serialise handle operations. |
Definition at line 1154 of file tif_pixarlog.c.
References _TIFFfreeExt(), _TIFFmallocExt(), _TIFFNoPostDecode(), add_ms(), isTiled, multiply_ms(), PIXARLOGDATAFMT_UNKNOWN, PixarLogDecoderState, PixarLogGuessDataFmt(), PLANARCONFIG_CONTIG, PLSTATE_INIT, PixarLogState::state, PixarLogState::stream, PixarLogState::stride, PixarLogState::tbuf, PixarLogState::tbuf_size, tiff::tif_dir, tiff::tif_postdecode, TIFFErrorExtR(), and PixarLogState::user_datafmt.
Referenced by TIFFInitPixarLog().
|
static |
Allocate PixarLog code staging and initialise zlib deflation.
Requires fresh encoder state. Sets the stride, guesses user format and calls deflateInit at cached quality. Does not allocate code staging: PixarLogEncode() sizes it from the data actually supplied, since RowsPerStrip may be unset or (uint32_t)-1 and a tiled image is not sized by strips. Failure can leave modified state for cleanup. No pixel I/O or caller ownership transfer.
| [in,out] | tif | Non-NULL live PixarLog handle with valid state/geometry; serialise handle operations. |
Definition at line 1543 of file tif_pixarlog.c.
References PIXARLOGDATAFMT_UNKNOWN, PixarLogEncoderState, PixarLogGuessDataFmt(), PLANARCONFIG_CONTIG, PLSTATE_INIT, PixarLogState::quality, PixarLogState::state, PixarLogState::stream, PixarLogState::stride, tiff::tif_dir, TIFFErrorExtR(), and PixarLogState::user_datafmt.
Referenced by TIFFInitPixarLog().
|
static |
Write one unaligned native-order sixteen-bit sample.
Uses fixed-size memcpy and requires enough live byte storage. Does not convert byte order, allocate, do I/O, diagnose, retain pointers or transfer ownership.
| [out] | cp | Writable bytes for one native value; unaligned allowed. |
| [in] | v | Native value to store. |
Definition at line 221 of file tif_pixarlog.c.
Referenced by horizontalAccumulate11(), horizontalAccumulate12(), and horizontalAccumulate16().
|
static |
Write one unaligned native-order float.
Uses fixed-size memcpy and requires enough live byte storage. Does not convert byte order, allocate, do I/O, diagnose, retain pointers or transfer ownership.
| [out] | cp | Writable bytes for one native value; unaligned allowed. |
| [in] | v | Native value to store. |
Definition at line 187 of file tif_pixarlog.c.
Referenced by horizontalAccumulateF().
|
static |
Retrieve PixarLog quality or format or delegate another query.
Pseudo-tags consume non-NULL int* outputs for cached values. Other tags follow saved parent contracts. No output allocation or ownership transfer for the scalar settings.
| [in,out] | tif | Non-NULL live PixarLog handle with valid state/geometry; serialise handle operations. |
| [in] | tag | Pseudo-tag or delegated identifier. |
| [in,out] | ap | Live tag-specific va_list, consumed synchronously without retention. |
Definition at line 2388 of file tif_pixarlog.c.
References PixarLogState::quality, tiff::tif_data, TIFFTAG_PIXARLOGDATAFMT, TIFFTAG_PIXARLOGQUALITY, PixarLogState::user_datafmt, and PixarLogState::vgetparent.
Referenced by TIFFInitPixarLog().
|
static |
Set PixarLog quality or user data format and update directory sizes.
Both pseudo-tags consume int and cache it without comprehensive validation. QUALITY can call deflateParams on an initialised writer; failure diagnoses after storing the value. DATAFMT changes depth/sample format through nested TIFFSetField calls whose statuses are ignored, then recomputes tile/scanline sizes and returns success even for unrecognised values. Changes apply beyond private state and can dirty tags/invoke callbacks; no rollback or ownership transfer. Other tags follow parent variadic contracts.
| [in,out] | tif | Non-NULL live PixarLog handle with valid state/geometry; serialise handle operations. |
| [in] | tag | Pseudo-tag or delegated identifier. |
| [in,out] | ap | Live tag-specific va_list, consumed synchronously without retention. |
Definition at line 2304 of file tif_pixarlog.c.
References isTiled, PIXARLOGDATAFMT_11BITLOG, PIXARLOGDATAFMT_12BITPICIO, PIXARLOGDATAFMT_16BIT, PIXARLOGDATAFMT_8BIT, PIXARLOGDATAFMT_8BITABGR, PIXARLOGDATAFMT_FLOAT, PLSTATE_INIT, SAMPLEFORMAT_IEEEFP, SAMPLEFORMAT_INT, SAMPLEFORMAT_UINT, TIFFDirectory::td_scanlinesize, TIFFDirectory::td_tilesize, tiff::tif_data, tiff::tif_dir, tiff::tif_mode, TIFFErrorExtR(), TIFFScanlineSize(), TIFFSetField(), TIFFTAG_BITSPERSAMPLE, TIFFTAG_PIXARLOGDATAFMT, TIFFTAG_PIXARLOGQUALITY, TIFFTAG_SAMPLEFORMAT, and TIFFTileSize().
Referenced by TIFFInitPixarLog().
|
extern |
Install PixarLog codec state methods and companding tables.
Requires COMPRESSION_PIXARLOG and cleaned-up previous state. Merges pseudo-tags, allocates zeroed Ext state, chains get/set hooks, installs transfer/close/cleanup methods and defaults unknown user format/default zlib quality. Attempts PredictorInit without propagating status, then builds tables and shared float coefficients. Serialise initialisation and float encoding across handles because those coefficients are process-global mutable storage. Failures can retain installed state for cleanup; no pixel I/O or caller ownership transfer.
| [in,out] | tif | Non-NULL handle whose previous codec state has been cleaned up; receives the new codec state. Serialise operations and shared-table initialisation. |
| [in] | scheme | COMPRESSION_PIXARLOG, asserted in debug builds. |
Definition at line 2439 of file tif_pixarlog.c.
References _TIFFmallocExt(), _TIFFmemset(), _TIFFMergeFields(), COMPRESSION_PIXARLOG, PixarLogCleanup(), PixarLogClose(), PIXARLOGDATAFMT_UNKNOWN, PixarLogDecode(), PixarLogEncode(), pixarlogFields, PixarLogFixupTags(), PixarLogGetMaxCompressionRatio(), PixarLogMakeTables(), PixarLogPostEncode(), PixarLogPreDecode(), PixarLogPreEncode(), PixarLogSetupDecode(), PixarLogSetupEncode(), PixarLogVGetField(), PixarLogVSetField(), tiff::tif_cleanup, tiff::tif_close, tiff::tif_data, tiff::tif_decoderow, tiff::tif_decodestrip, tiff::tif_decodetile, tiff::tif_encoderow, tiff::tif_encodestrip, tiff::tif_encodetile, tiff::tif_fixuptags, tiff::tif_getmaxcompressionratio, tiff::tif_postencode, tiff::tif_predecode, tiff::tif_preencode, tiff::tif_setupdecode, tiff::tif_setupencode, tiff::tif_tagmethods, TIFFArrayCount, TIFFErrorExtR(), TIFFPredictorInit(), TIFFTagMethods::vgetfield, and TIFFTagMethods::vsetfield.
|
static |
Scale low-range float lookup indices.
Process-global coefficient written by every PixarLogMakeTables call (always with the same value) and read by horizontalDifferenceF. The writes are unsynchronised, so serialise table construction against float encoding on other handles.
Definition at line 120 of file tif_pixarlog.c.
Referenced by horizontalDifferenceF(), and PixarLogMakeTables().
|
static |
Scale logarithmic float companding.
Process-global coefficient written by every PixarLogMakeTables call (always with the same value) and read by horizontalDifferenceF. The writes are unsynchronised, so serialise table construction against float encoding on other handles.
Definition at line 130 of file tif_pixarlog.c.
Referenced by PixarLogMakeTables().
|
static |
Normalise logarithmic float companding.
Process-global coefficient with the same lifetime and synchronisation requirements as LogK1.
Definition at line 138 of file tif_pixarlog.c.
Referenced by PixarLogMakeTables().
|
static |
Define PixarLog format and quality pseudo-tags.
Immutable library-lifetime metadata merged into a handle; no caller ownership transfer.
Definition at line 2413 of file tif_pixarlog.c.
Referenced by TIFFInitPixarLog().