|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Manage TIFF LZW dictionaries bit streams and predictor-aware transfers. More...
Data Structures | |
| struct | LZWBaseState |
| Prefix LZW state with Predictor hooks and shared bit-code state. More... | |
| struct | hash_t |
| Pair an encoder hash key with its dictionary code. More... | |
| struct | code_ent |
| Link one decoder string to its preceding dictionary string. More... | |
| struct | LZWCodecState |
| Own LZW dictionaries hash storage and transfer restart state. More... | |
Macros | |
| #define | SIZEOF_WORDTYPE SIZEOF_SIZE_T |
| Size in bytes of WordType, the decoder bit-buffer word. | |
| #define | LZW_COMPAT /* include backwards compatibility code */ |
| Include decoding of historical reversed-bit-order LZW data. | |
| #define | MAXCODE(n) ((1 << (n)) - 1) |
| Compute the inclusive maximum code for a valid bit width. | |
| #define | BITS_MIN 9 /* start with 9 bits */ |
| Initial and post-clear code width: 9 bits. | |
| #define | BITS_MAX 12 /* max of 12 bit strings */ |
| Maximum code width allowed by TIFF LZW: 12 bits. | |
| #define | CODE_CLEAR 256 /* code to clear string table */ |
| Reserved code 256 that resets the string table. | |
| #define | CODE_EOI 257 /* end-of-information code */ |
| Reserved code 257 that ends the strip or tile. | |
| #define | CODE_FIRST 258 /* first free code entry */ |
| First dictionary code assigned to a new string: 258. | |
| #define | CODE_MAX MAXCODE(BITS_MAX) |
| Largest 12-bit code: MAXCODE(BITS_MAX), i.e. 4095. | |
| #define | HSIZE 9001 /* 91% occupancy */ |
| Number of entries in the encoder hash table: 9001. | |
| #define | HSHIFT (13 - 8) |
| Left shift applied to the input byte when hashing encoder strings. | |
| #define | CSIZE (MAXCODE(BITS_MAX) + 1024L) |
| Number of entries allocated for the decoder string table. | |
| #define | lzw_nbits base.nbits |
| Member alias for base.nbits, the current code width. | |
| #define | lzw_maxcode base.maxcode |
| Member alias for base.maxcode, the largest code at this width. | |
| #define | lzw_free_ent base.free_ent |
| Member alias for base.free_ent, the next free dictionary code. | |
| #define | lzw_nextdata base.nextdata |
| Member alias for base.nextdata, the buffered code bits. | |
| #define | lzw_nextbits base.nextbits |
| Member alias for base.nextbits, the number of buffered bits. | |
| #define | CHECK_GAP 10000 |
| Encoder input bytes between compression-ratio checks: 10000. | |
| #define | LZWState(tif) ((LZWBaseState *)(tif)->tif_data) |
| Cast tif->tif_data to the shared LZWBaseState prefix. | |
| #define | LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif)) |
| Cast tif->tif_data to the full LZWCodecState for decoding. | |
| #define | LZWEncoderState(tif) ((LZWCodecState *)LZWState(tif)) |
| Cast tif->tif_data to the full LZWCodecState for encoding. | |
| #define | GetNextData(nextdata, bp) |
| Load SIZEOF_WORDTYPE bytes at bp into nextdata, first byte most significant. | |
| #define | GetNextCodeLZW() |
| Extract the next nbits-wide MSB-first code from the decoder bit cache into code, refilling from bp as needed. | |
| #define | NextCode(_tif, _sp, _bp, _code, _get, dec_bitsleft) |
| Fetch the next compatibility-mode code with _get, or yield CODE_EOI with a warning when fewer than nbits input bits remain. | |
| #define | GetNextCodeCompat(sp, bp, code) |
| Extract the next nbits-wide LSB-first code for old reversed-order LZW data. | |
| #define | CALCRATIO(sp, rat) |
| Compute the encoder compression ratio incount/outcount as a 24.8 fixed-point value into rat. | |
| #define | PutNextCode(op, c) |
| Append the nbits-wide code c MSB-first to the encoder output at op. | |
Typedefs | |
| typedef size_t | WordType |
| Select the native size_t word for buffered LZW bits. | |
| typedef uint16_t | hcode_t |
| Store an encoder dictionary code in sixteen bits. | |
| typedef struct code_ent | code_t |
| Link one decoder string to its preceding dictionary string. | |
| typedef int(* | decodeFunc) (TIFF *tif, uint8_t *buf, tmsize_t size, uint16_t sample) |
| Signature shared by the LZW decode entry points (recorded in dec_decode). | |
Functions | |
| static int | LZWFixupTags (TIFF *tif) |
| Accept LZW tag fixup without changes. | |
| static int | LZWSetupDecode (TIFF *tif) |
| Allocate and initialise the LZW decode dictionary. | |
| static int | LZWPreDecode (TIFF *tif, uint16_t s) |
| Reset LZW bit and dictionary state for a strile. | |
| static int | LZWDecode (TIFF *tif, uint8_t *op0, tmsize_t occ0, uint16_t s) |
| Expand standard TIFF LZW codes into caller output. | |
| static int | LZWDecodeCompat (TIFF *tif, uint8_t *op0, tmsize_t occ0, uint16_t s) |
| Expand historical reversed-order LZW codes into caller output. | |
| static int | LZWSetupEncode (TIFF *tif) |
| Allocate the LZW encoder hash table. | |
| static int | LZWPreEncode (TIFF *tif, uint16_t s) |
| Reset the LZW encoder dictionary bit cache and counters. | |
| static int | LZWEncode (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s) |
| Compress borrowed bytes into buffered TIFF LZW codes. | |
| static int | LZWPostEncode (TIFF *tif) |
| Emit the final LZW string end code and padding bits. | |
| static void | cl_hash (LZWCodecState *sp) |
| Mark every LZW encoder hash slot unused. | |
| static void | LZWCleanup (TIFF *tif) |
| Release LZW tables and codec state and reset methods. | |
| static uint64_t | LZWGetMaxCompressionRatio (TIFF *tif) |
| Report the empirical LZW expansion heuristic. | |
| int | TIFFInitLZW (TIFF *tif, int scheme) |
| Allocate LZW codec state and install predictor-aware methods. | |
Manage TIFF LZW dictionaries bit streams and predictor-aware transfers.
| #define BITS_MAX 12 /* max of 12 bit strings */ |
| #define BITS_MIN 9 /* start with 9 bits */ |
| #define CALCRATIO | ( | sp, | |
| rat | |||
| ) |
Compute the encoder compression ratio incount/outcount as a 24.8 fixed-point value into rat.
Reads the LZWEncode() locals incount (input bytes) and outcount (output bits); the sp operand is not used. If incount > 0x007fffff it divides incount by outcount >> 8 to avoid overflowing the shift, giving 0x7fffffff when that is 0; otherwise it computes (incount << 8) / outcount, which requires outcount != 0. rat is assigned up to twice. No hidden control flow or diagnostics.
| [in] | sp | Unused. |
| [in,out] | rat | Lvalue that receives the ratio. |
| #define CHECK_GAP 10000 |
| #define CODE_CLEAR 256 /* code to clear string table */ |
| #define CODE_EOI 257 /* end-of-information code */ |
| #define CODE_FIRST 258 /* first free code entry */ |
Largest 12-bit code: MAXCODE(BITS_MAX), i.e. 4095.
Number of entries allocated for the decoder string table.
MAXCODE(BITS_MAX) + 1024 with LZW_COMPAT (headroom for old files), otherwise MAXCODE(BITS_MAX) + 1.
| #define GetNextCodeCompat | ( | sp, | |
| bp, | |||
| code | |||
| ) |
Extract the next nbits-wide LSB-first code for old reversed-order LZW data.
ORs one byte, or two if nextbits is still below nbits, from *bp into the caller locals nextdata/nextbits, advancing bp each time; then assigns code = nextdata & nbitsmask and shifts nbits out of nextdata. Reads the caller locals nbits and nbitsmask. Performs no bounds check: NextCode() ensures dec_bitsleft >= nbits first. The sp operand is not used.
| [in] | sp | Unused; present for the NextCode() _get signature. |
| [in,out] | bp | Input byte-pointer lvalue, advanced by 1 or 2. |
| [in,out] | code | Lvalue that receives the code. |
| #define GetNextCodeLZW | ( | ) |
Extract the next nbits-wide MSB-first code from the decoder bit cache into code, refilling from bp as needed.
Operates entirely on locals of LZWDecode(): reads nbits and nbitsmask, reads and updates nextbits, nextdata, bp and dec_bitsleft, and assigns code. When the cache runs short it loads a whole word with GetNextData() if dec_bitsleft holds at least one word, otherwise one or two single bytes. dec_bitsleft is reduced by the bits loaded, not by nbits.
Hidden control flow: if fewer than 8 bits remain in dec_bitsleft when a byte is needed, it executes goto no_eoi, so the enclosing function must define a no_eoi label (LZWDecode() zeroes the output, sets read_error, reports a missing EOI with TIFFErrorExtR() and returns 0 there). Its internal break only leaves the macro's own do/while.
| #define GetNextData | ( | nextdata, | |
| bp | |||
| ) |
Load SIZEOF_WORDTYPE bytes at bp into nextdata, first byte most significant.
Statement macro used by GetNextCodeLZW() to refill the bit cache with a whole word. Assigns nextdata and reads SIZEOF_WORDTYPE bytes from bp without a bounds check; does not advance bp. The portable variants evaluate bp once per byte, and the memcpy/bswap variants expand to two statements, so bp must be free of side effects and the macro must be used inside braces. The _M_X64/_M_X86 variants dereference bp through a wider pointer type, i.e. an unaligned load.
| [in,out] | nextdata | Unsigned WordType lvalue that receives the word. |
| [in] | bp | Byte pointer to at least SIZEOF_WORDTYPE readable bytes. |
| #define HSHIFT (13 - 8) |
| #define HSIZE 9001 /* 91% occupancy */ |
| #define LZW_COMPAT /* include backwards compatibility code */ |
Include decoding of historical reversed-bit-order LZW data.
Defined unconditionally. Enables LZWDecodeCompat(), its detection in LZWPreDecode() and 1024 extra decode-table entries in CSIZE.
| #define lzw_free_ent base.free_ent |
| #define lzw_maxcode base.maxcode |
| #define lzw_nbits base.nbits |
| #define lzw_nextbits base.nextbits |
| #define lzw_nextdata base.nextdata |
| #define LZWDecoderState | ( | tif | ) | ((LZWCodecState *)LZWState(tif)) |
Cast tif->tif_data to the full LZWCodecState for decoding.
Pure cast via LZWState(); tif is evaluated once. Requires the LZW codec to be initialised.
| [in] | tif | Handle whose codec state is returned. |
| #define LZWEncoderState | ( | tif | ) | ((LZWCodecState *)LZWState(tif)) |
Cast tif->tif_data to the full LZWCodecState for encoding.
Pure cast via LZWState(); tif is evaluated once. Requires the LZW codec to be initialised.
| [in] | tif | Handle whose codec state is returned. |
| #define LZWState | ( | tif | ) | ((LZWBaseState *)(tif)->tif_data) |
Cast tif->tif_data to the shared LZWBaseState prefix.
Pure cast; tif is evaluated once. Requires the LZW codec to be initialised (tif_data non-NULL).
| [in] | tif | Handle whose codec state is returned. |
| #define MAXCODE | ( | n | ) | ((1 << (n)) - 1) |
| #define NextCode | ( | _tif, | |
| _sp, | |||
| _bp, | |||
| _code, | |||
| _get, | |||
| dec_bitsleft | |||
| ) |
Fetch the next compatibility-mode code with _get, or yield CODE_EOI with a warning when fewer than nbits input bits remain.
Defined only with LZW_COMPAT and used by LZWDecodeCompat(). Also reads the caller locals nbits and module. If dec_bitsleft < nbits it emits TIFFWarningExtR() ("not terminated with EOI code") naming _tif->tif_dir.td_curstrip, sets _code to CODE_EOI and consumes no input; this is not treated as an error. Otherwise it expands _get(_sp, _bp, _code) and subtracts nbits from dec_bitsleft. _tif is evaluated twice on the warning path. No hidden return or goto.
| [in] | _tif | TIFF handle used for the warning. |
| [in] | _sp | Codec state passed through to _get. |
| [in,out] | _bp | Input byte-pointer lvalue, advanced by _get. |
| [in,out] | _code | Lvalue that receives the code. |
| [in] | _get | Code-fetch macro name, e.g. GetNextCodeCompat. |
| [in,out] | dec_bitsleft | Lvalue holding the remaining input bit count. |
| #define PutNextCode | ( | op, | |
| c | |||
| ) |
Append the nbits-wide code c MSB-first to the encoder output at op.
Shifts c into the LZWEncode()/LZWPostEncode() locals nextdata and nextbits, stores one or two complete bytes at op (advancing it each time) and adds nbits to outcount. Writes without a bounds check: callers compare op with enc_rawlimit (which reserves 4 bytes, room for two codes) and flush first. c is evaluated once; op is read and incremented up to twice. No hidden control flow or diagnostics.
| [in,out] | op | Output byte-pointer lvalue, advanced by 1 or 2. |
| [in] | c | Code value, below 1 << nbits. |
| #define SIZEOF_WORDTYPE SIZEOF_SIZE_T |
Size in bytes of WordType, the decoder bit-buffer word.
Equals SIZEOF_SIZE_T; selects the GetNextData() variant and how many bytes GetNextCodeLZW() loads at once (4 or 8).
Link one decoder string to its preceding dictionary string.
Element of the CSIZE-entry dec_codetab array owned by LZWCodecState; next links point into the same array.
Signature shared by the LZW decode entry points (recorded in dec_decode).
Matches LZWDecode() and LZWDecodeCompat(). No pointer of this type is ever called: decoding is dispatched through tif_decoderow, tif_decodestrip and tif_decodetile.
| [in,out] | tif | LZW handle being decoded. |
| [out] | buf | Decoded output of size bytes. |
| [in] | size | Requested decoded byte count. |
| [in] | sample | Sample plane, ignored by LZW. |
| typedef uint16_t hcode_t |
| typedef size_t WordType |
|
static |
Mark every LZW encoder hash slot unused.
Requires a live HSIZE-entry table. Sets hash fields to minus one; code fields need not be cleared. No allocation, I/O, diagnostics, ownership changes or error status.
| [in,out] | sp | Non-NULL codec state owning an allocated HSIZE-entry encoder table. |
Definition at line 1662 of file tif_lzw.c.
References LZWCodecState::enc_hashtab, hash_t::hash, and HSIZE.
Referenced by LZWEncode(), and LZWPreEncode().
|
static |
Release LZW tables and codec state and reset methods.
Requires live initialised LZW state. Restores predictor chains, frees dictionary and hash table if present, frees outer state and sets tif_data NULL, then installs default compression methods. Invalidates all state/table views. Does not flush payload or close the borrowed handle; no separate status result.
| [in,out] | tif | Non-NULL live LZW handle with valid state, raw-buffer cursors and matching geometry; serialise access. |
Definition at line 1699 of file tif_lzw.c.
References _TIFFfreeExt(), _TIFFSetDefaultCompressionState(), LZWDecoderState, LZWEncoderState, tiff::tif_data, and TIFFPredictorCleanup().
Referenced by TIFFInitLZW().
Expand standard TIFF LZW codes into caller output.
Requires a nonnegative writable output extent and coherent predecode dictionary/bit state. Supports interrupted-string restart across calls, clear/end codes and TIFF early code-width changes. Updates dictionary, bit cache and raw cursors on normal exits. Detected corrupt/truncated input clears the unfilled tail, latches read_error, diagnoses and returns zero; some error exits do not commit local cursor state. Further calls in the same strile clear requested output and fail until predecode resets the latch. No allocation/client I/O or ownership transfer.
| [in,out] | tif | Non-NULL live LZW handle with valid state, raw-buffer cursors and matching geometry; serialise access. |
| [out] | op0 | Borrowed writable output of occ0 bytes, disjoint from raw input and codec tables. |
| [in] | occ0 | Nonnegative requested decoded bytes; use a positive extent during an interrupted-string restart. |
| [in] | s | Unused sample plane; predictor wrappers manage channel stride. |
Definition at line 571 of file tif_lzw.c.
References BITS_MAX, BITS_MIN, CODE_CLEAR, CODE_EOI, CODE_FIRST, CSIZE, code_ent::firstchar, GetNextCodeLZW, code_ent::length, LZWDecoderState, MAXCODE, code_ent::next, code_ent::repeated, TIFFDirectory::td_curstrip, TIFFDirectory::td_row, tiff::tif_dir, tiff::tif_name, tiff::tif_rawcc, tiff::tif_rawcp, TIFFErrorExtR(), and code_ent::value.
Referenced by LZWPreDecode(), and TIFFInitLZW().
Expand historical reversed-order LZW codes into caller output.
Requires compatibility predecode selection, nonnegative output extent and valid dictionary/raw state. Maintains restart, bit and dictionary progress across calls. Corrupt dictionary codes and zero-length strings clear the entire requested output (including bytes already decoded), latch read_error, diagnose and return zero without committing local cursor state. Running out of input bits is treated as an end code with only a warning; if output is then short, the unfilled tail is cleared, read_error latched and zero returned. While read_error is latched, further calls clear the requested output and fail until predecode resets it. No allocation/client I/O or ownership transfer.
| [in,out] | tif | Non-NULL live LZW handle with valid state, raw-buffer cursors and matching geometry; serialise access. |
| [out] | op0 | Borrowed writable output of occ0 bytes, disjoint from raw input and codec tables. |
| [in] | occ0 | Nonnegative requested decoded bytes; use a positive extent during an interrupted-string restart. |
| [in] | s | Unused sample plane; predictor wrappers manage channel stride. |
Definition at line 996 of file tif_lzw.c.
References _TIFFmemset(), BITS_MAX, BITS_MIN, CODE_CLEAR, CODE_EOI, CODE_FIRST, CSIZE, code_ent::firstchar, GetNextCodeCompat, code_ent::length, LZWDecoderState, MAXCODE, code_ent::next, NextCode, TIFFDirectory::td_row, tiff::tif_dir, tiff::tif_name, tiff::tif_rawcc, tiff::tif_rawcp, TIFFErrorExtR(), and code_ent::value.
Referenced by LZWPreDecode().
Compress borrowed bytes into buffered TIFF LZW codes.
Requires successful encoder setup/preencode, nonnegative input length and usable raw capacity/limit. Updates code/hash state, emits clear codes and adjusts code width; ratio checkpoints can reset the dictionary. Flushes when needed, invoking client I/O and diagnostics. Input is not changed. Early flush failure can leave output bytes, dictionary and local/cached progress inconsistent for retry; no rollback or ownership transfer.
| [in,out] | tif | Non-NULL live LZW handle with valid state, raw-buffer cursors and matching geometry; serialise access. |
| [in] | bp | Borrowed readable cc-byte input, not retained. |
| [in] | cc | Nonnegative input byte count. |
| [in] | s | Unused sample plane; predictor wrappers manage channel stride. |
Definition at line 1403 of file tif_lzw.c.
References BITS_MAX, BITS_MIN, CALCRATIO, CHECK_GAP, cl_hash(), hash_t::code, CODE_CLEAR, CODE_FIRST, CODE_MAX, LZWCodecState::enc_checkpoint, LZWCodecState::enc_hashtab, LZWCodecState::enc_incount, LZWCodecState::enc_oldcode, LZWCodecState::enc_outcount, LZWCodecState::enc_ratio, LZWCodecState::enc_rawlimit, hash_t::hash, HSHIFT, HSIZE, LZWEncoderState, MAXCODE, PutNextCode, tiff::tif_rawcc, tiff::tif_rawcp, tiff::tif_rawdata, and TIFFFlushData1().
Referenced by TIFFInitLZW().
|
static |
Accept LZW tag fixup without changes.
No allocation, I/O, diagnostics, mutation or ownership effects.
| [in] | tif | Unused handle. |
Definition at line 282 of file tif_lzw.c.
Referenced by TIFFInitLZW().
|
static |
Report the empirical LZW expansion heuristic.
Ignores the handle; no allocation, I/O, diagnostics, state or ownership effects. Not a universal compression bound or data-validation guarantee.
| [in] | tif | Unused handle. |
Definition at line 1727 of file tif_lzw.c.
Referenced by TIFFInitLZW().
|
static |
Emit the final LZW string end code and padding bits.
Requires valid encoder state and reserved raw capacity. Can flush first, emit clear/width changes, append EOI and pad the last byte, then set rawcc. Does not persist the IFD or guarantee final buffered bytes were written. Raw/file state can change before failed flush; no ownership transfer.
| [in,out] | tif | Non-NULL live LZW handle with valid state, raw-buffer cursors and matching geometry; serialise access. |
Definition at line 1595 of file tif_lzw.c.
References BITS_MAX, BITS_MIN, CODE_CLEAR, CODE_EOI, CODE_MAX, LZWCodecState::enc_oldcode, LZWCodecState::enc_outcount, LZWCodecState::enc_rawlimit, LZWEncoderState, PutNextCode, tiff::tif_rawcc, tiff::tif_rawcp, tiff::tif_rawdata, and TIFFFlushData1().
Referenced by TIFFInitLZW().
|
static |
Reset LZW bit and dictionary state for a strile.
Requires live outer state; lazily attempts setup if needed and rejects a missing dictionary. Tests the first two raw bytes for historical reversed code order on every call and, with LZW_COMPAT (always defined), sets the matching lzw_maxcode convention. Only on the first predecode after codec initialisation (dec_decode still NULL) does it act on the result: for old-style data it warns, installs LZWDecodeCompat() as the row/strip/tile decoder and re-runs setup so that predictor wrappers rebind. The decoder choice is not revisited for later striles: a later strile with the other code order keeps the decoder chosen first (and the warning is not repeated). Without LZW_COMPAT, old-style data fails on every strile but is diagnosed only the first time. The setup statuses are ignored. Clears restart/error state and resets code pointers/bit cache. Does not allocate output or read client bytes directly; setup can allocate/diagnose.
| [in,out] | tif | Non-NULL live LZW handle with valid state, raw-buffer cursors and matching geometry; serialise access. |
| [in] | s | Unused sample plane; predictor wrappers manage channel stride. |
Definition at line 389 of file tif_lzw.c.
References BITS_MIN, LZWDecode(), LZWDecodeCompat(), LZWDecoderState, MAXCODE, tiff::tif_decoderow, tiff::tif_decodestrip, tiff::tif_decodetile, tiff::tif_rawcc, tiff::tif_rawdata, tiff::tif_setupdecode, TIFFErrorExtR(), and TIFFWarningExtR().
Referenced by TIFFInitLZW().
|
static |
Reset the LZW encoder dictionary bit cache and counters.
Requires valid outer state and an allocated hash table. A raw output buffer smaller than five bytes, the most LZWEncode() and LZWPostEncode() write after their room checks, is diagnosed and rejected. If table is NULL it invokes setup but does not check its return before clearing the table; caller must ensure setup succeeds. Resets code widths, checkpoint, pending code and output limit. Does not emit payload directly; setup can allocate/diagnose.
| [in,out] | tif | Non-NULL live LZW handle with valid state, raw-buffer cursors and matching geometry; serialise access. |
| [in] | s | Unused sample plane; predictor wrappers manage channel stride. |
Definition at line 1297 of file tif_lzw.c.
References BITS_MIN, CHECK_GAP, cl_hash(), CODE_FIRST, LZWEncoderState, MAXCODE, tiff::tif_rawdata, tiff::tif_rawdatasize, tiff::tif_setupencode, TIFF_SSIZE_FORMAT, and TIFFErrorExtR().
Referenced by TIFFInitLZW().
|
static |
Allocate and initialise the LZW decode dictionary.
Allocates handle-owned codec state when absent, installs predictor hooks on that path, and lazily allocates CSIZE entries. Preloads literal entries and clears reserved entries. Allocation failure diagnoses and can retain outer state for cleanup; no pixel I/O. Predictor initialisation status is not propagated.
| [in,out] | tif | Non-NULL live LZW handle; tif_data may still be NULL, in which case the state is allocated here. Serialise access. |
Definition at line 302 of file tif_lzw.c.
References _TIFFmallocExt(), CODE_CLEAR, CODE_FIRST, CSIZE, LZWDecoderState, tiff::tif_data, TIFFErrorExtR(), and TIFFPredictorInit().
Referenced by TIFFInitLZW().
|
static |
Allocate the LZW encoder hash table.
Requires existing codec state and no previous unreleased encoder table; assigns a new handle-owned HSIZE allocation. Diagnoses allocation failure; no pixel I/O. Cleanup releases the table.
| [in,out] | tif | Non-NULL live LZW handle with valid state, raw-buffer cursors and matching geometry; serialise access. |
Definition at line 1259 of file tif_lzw.c.
References _TIFFmallocExt(), HSIZE, LZWEncoderState, and TIFFErrorExtR().
Referenced by TIFFInitLZW().
|
extern |
Allocate LZW codec state and install predictor-aware methods.
Requires COMPRESSION_LZW and cleaned-up previous codec state. Allocates handle-owned state, initialises table pointers, installs callbacks and attempts predictor hook installation. PredictorInit status is ignored, so success does not guarantee that field merging succeeded. Encoding methods are omitted in LZW_READ_ONLY builds. Allocation failure diagnoses; partial state/callback effects are not rolled back. No pixel I/O.
| [in,out] | tif | Non-NULL handle whose previous codec state has been cleaned up; receives the new codec state. Serialise access. |
| [in] | scheme | COMPRESSION_LZW; asserted in debug builds. |
Definition at line 1742 of file tif_lzw.c.
References _TIFFmallocExt(), COMPRESSION_LZW, LZWCleanup(), LZWDecode(), LZWDecoderState, LZWEncode(), LZWEncoderState, LZWFixupTags(), LZWGetMaxCompressionRatio(), LZWPostEncode(), LZWPreDecode(), LZWPreEncode(), LZWSetupDecode(), LZWSetupEncode(), LZWState, tiff::tif_cleanup, 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_mode, tiff::tif_postencode, tiff::tif_predecode, tiff::tif_preencode, tiff::tif_setupdecode, tiff::tif_setupencode, TIFFErrorExtR(), and TIFFPredictorInit().