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

Stage scalar samples validity masks and secondary compression. More...

Collaboration diagram for LERC frame codec:

Data Structures

struct  LERCState
 Own LERC full-strile staging masks and secondary-compression state. More...
 

Macros

#define LIBDEFLATE_MAX_COMPRESSION_LEVEL   12
 Highest accepted TIFFTAG_ZIPQUALITY value: 12.
 
#define LSTATE_INIT_DECODE   0x01
 Bit 0x01 of the codec state field: decoding has been set up.
 
#define LSTATE_INIT_ENCODE   0x02
 Bit 0x02 of the codec state field: encoding has been set up.
 
#define LERC_AT_LEAST_VERSION(maj, min, patch)   0
 Fallback used when the LERC header lacks LERC_AT_LEAST_VERSION.
 
#define GetLERCState(tif)   ((LERCState *)(tif)->tif_data)
 Cast tif->tif_data to the LERCState.
 
#define LERCDecoderState(tif)   GetLERCState(tif)
 Alias of GetLERCState(), returning the LERCState for decoding.
 
#define LERCEncoderState(tif)   GetLERCState(tif)
 Alias of GetLERCState(), returning the LERCState for encoding.
 

Functions

static int LERCFixupTags (TIFF *tif)
 Accept LERC tag fixup without changes.
 
static int LERCSetupDecode (TIFF *tif)
 Select LERC decode mode.
 
static int GetLercDataType (TIFF *tif)
 Map TIFF sample format and depth to a LERC scalar code.
 
static int SetupBuffers (TIFF *tif, LERCState *sp, const char *module)
 Size and reserve full-strile sample and validity-mask storage.
 
static int LERCPreDecode (TIFF *tif, uint16_t s)
 Decode and validate an entire LERC strile into owned staging.
 
static int LERCDecode (TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
 Copy the next decoded byte extent from LERC staging.
 
static int LERCSetupEncode (TIFF *tif)
 Select LERC encode mode.
 
static int LERCPreEncode (TIFF *tif, uint16_t s)
 Validate LERC sample type and prepare full-strile input storage.
 
static int LERCEncode (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
 Stage the next LERC input bytes for later frame encoding.
 
static int LERCPostEncode (TIFF *tif)
 Encode a fully staged LERC strile and flush optional secondary compression.
 
static void LERCCleanup (TIFF *tif)
 Release LERC staging masks secondary compressors and outer state.
 
static int LERCVSetFieldBase (TIFF *tif, uint32_t tag,...)
 Forward a variadic assignment directly to the saved parent setter.
 
static int LERCVSetField (TIFF *tif, uint32_t tag, va_list ap)
 Set LERC version error tolerance or secondary-compression controls.
 
static int LERCVGetField (TIFF *tif, uint32_t tag, va_list ap)
 Retrieve cached LERC controls or delegate another tag query.
 
int TIFFInitLERC (TIFF *tif, int scheme)
 Allocate LERC staging state and install frame callbacks and pseudo-tags.
 

Variables

static const TIFFField LERCFields []
 Define LERC parameters error tolerance version and secondary-compression tags.
 

Detailed Description

Stage scalar samples validity masks and secondary compression.

Macro Definition Documentation

◆ GetLERCState

#define GetLERCState (   tif)    ((LERCState *)(tif)->tif_data)

Cast tif->tif_data to the LERCState.

tif is evaluated once. Requires the codec to be initialised (tif_data non-NULL).

Parameters
[in]tifHandle whose codec state is returned.

Definition at line 145 of file tif_lerc.c.

◆ LERC_AT_LEAST_VERSION

#define LERC_AT_LEAST_VERSION (   maj,
  min,
  patch 
)    0

Fallback used when the LERC header lacks LERC_AT_LEAST_VERSION.

Always expands to 0, so code guarded by it treats the dependency as older than any tested version. The operands are not evaluated.

Parameters
[in]majMajor version (unused).
[in]minMinor version (unused).
[in]patchPatch version (unused).

Definition at line 57 of file tif_lerc.c.

◆ LERCDecoderState

#define LERCDecoderState (   tif)    GetLERCState(tif)

Alias of GetLERCState(), returning the LERCState for decoding.

tif is evaluated once. Requires the codec to be initialised.

Parameters
[in]tifHandle whose codec state is returned.

Definition at line 146 of file tif_lerc.c.

◆ LERCEncoderState

#define LERCEncoderState (   tif)    GetLERCState(tif)

Alias of GetLERCState(), returning the LERCState for encoding.

tif is evaluated once. Requires the codec to be initialised.

Parameters
[in]tifHandle whose codec state is returned.

Definition at line 147 of file tif_lerc.c.

◆ LIBDEFLATE_MAX_COMPRESSION_LEVEL

#define LIBDEFLATE_MAX_COMPRESSION_LEVEL   12

Highest accepted TIFFTAG_ZIPQUALITY value: 12.

Matches the libdeflate maximum level; the zlib path caps the level at Z_BEST_COMPRESSION (9). The tag setter rejects values outside [-1, 12].

Definition at line 49 of file tif_lerc.c.

◆ LSTATE_INIT_DECODE

#define LSTATE_INIT_DECODE   0x01

Bit 0x01 of the codec state field: decoding has been set up.

Set by LERCSetupDecode(). Each setup first tears down the other mode, if active, and clears the field.

Definition at line 53 of file tif_lerc.c.

◆ LSTATE_INIT_ENCODE

#define LSTATE_INIT_ENCODE   0x02

Bit 0x02 of the codec state field: encoding has been set up.

Set by LERCSetupEncode(). Each setup first tears down the other mode, if active, and clears the field.

Definition at line 54 of file tif_lerc.c.

Function Documentation

◆ GetLercDataType()

static int GetLercDataType ( TIFF *  tif)
static

Map TIFF sample format and depth to a LERC scalar code.

Recognises signed/unsigned 8/16/32-bit integers and IEEE 32/64-bit floats. Diagnoses unsupported combinations; no allocation, I/O, state mutation or ownership transfer.

Parameters
[in]tifNon-NULL live LERC handle; only its SampleFormat and BitsPerSample are read (and it is passed to the error handler).
Returns
LERC data type code zero through seven, or minus one on unsupported input.

Definition at line 207 of file tif_lerc.c.

References SAMPLEFORMAT_IEEEFP, SAMPLEFORMAT_INT, SAMPLEFORMAT_UINT, TIFFDirectory::td_bitspersample, TIFFDirectory::td_sampleformat, tiff::tif_dir, and TIFFErrorExtR().

Referenced by LERCPostEncode(), LERCPreDecode(), LERCPreEncode(), and SetupBuffers().

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

◆ LERCCleanup()

static void LERCCleanup ( TIFF *  tif)
static

Release LERC staging masks secondary compressors and outer state.

Restores saved tag hooks, frees sample/multiband/compressed/mask Ext allocations and optional libdeflate objects, frees outer state, clears tif_data and resets compression methods. Invalidates all codec-owned views. Does not encode or flush pending staging, close the borrowed handle or return status.

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

Definition at line 1606 of file tif_lerc.c.

References _TIFFfreeExt(), _TIFFSetDefaultCompressionState(), LERCState::compressed_buffer, GetLERCState, LERCState::mask_buffer, tiff::tif_data, tiff::tif_tagmethods, LERCState::uncompressed_buffer, LERCState::uncompressed_buffer_multiband, TIFFTagMethods::vgetfield, LERCState::vgetparent, TIFFTagMethods::vsetfield, and LERCState::vsetparent.

Referenced by TIFFInitLERC().

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

◆ LERCDecode()

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

Copy the next decoded byte extent from LERC staging.

Requires successful predecode and a nonnegative request. Checks staging presence and remaining bounds, copies bytes and advances uncompressed_offset. Rejection clears requested output and diagnoses. No allocation, dependency decoding, client I/O or ownership transfer; source/destination must not overlap.

Parameters
[in,out]tifNon-NULL live LERC handle with valid current geometry/state; serialise access.
[out]opBorrowed writable occ-byte destination, disjoint from codec staging.
[in]occNonnegative decoded byte extent within remaining staging data.
[in]sUnused sample-plane compatibility argument.
Returns
One after copy, zero on missing staging or overread request.

Definition at line 928 of file tif_lerc.c.

References LERCDecoderState, LSTATE_INIT_DECODE, and TIFFErrorExtR().

Referenced by TIFFInitLERC().

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

◆ LERCEncode()

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

Stage the next LERC input bytes for later frame encoding.

Requires successful preencode and nonnegative cc; a state not initialised for encoding is diagnosed and rejected. Checks offset+cc against decoded strile size, copies borrowed input and advances offset. Does not compress until postencode; input remains unchanged. Rejection diagnoses without copying. No client I/O or ownership transfer.

Parameters
[in,out]tifNon-NULL live LERC handle with valid current geometry/state; serialise access.
[in]bpBorrowed readable cc-byte input copied synchronously; not retained or modified.
[in]ccNonnegative input byte extent within remaining staging capacity.
[in]sUnused sample-plane compatibility argument.
Returns
One after staging, zero on wrong codec state or excess input extent.

Definition at line 1049 of file tif_lerc.c.

References LERCEncoderState, LSTATE_INIT_ENCODE, and TIFFErrorExtR().

Referenced by TIFFInitLERC().

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

◆ LERCFixupTags()

static int LERCFixupTags ( TIFF *  tif)
static

Accept LERC tag fixup without changes.

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

Parameters
[in]tifUnused handle.
Returns
One unconditionally.

Definition at line 160 of file tif_lerc.c.

Referenced by TIFFInitLERC().

Here is the caller graph for this function:

◆ LERCPostEncode()

static int LERCPostEncode ( TIFF *  tif)
static

Encode a fully staged LERC strile and flush optional secondary compression.

A state not initialised for encoding is diagnosed and rejected. Requires exact staged byte count, valid scalar/geometry arithmetic and suitable masks; pixel-count and multiband byte-count products are checked and an overflow is diagnosed. Compacts binary unassociated alpha into validity masks or detects floating NaNs; per-band NaN masks require supported LERC versions. Can allocate multiband/compressed storage, mutate staging, encode the selected version/error tolerance, then optionally compress with Deflate/ZSTD. Temporarily replaces tif_rawdata and tif_rawdatasize with the codec buffer and its size during flush and restores both afterward; rawcp can still refer into codec staging until reset. Dependency/validation/I/O errors diagnose where handled and can leave changed buffers, metadata or file bytes; no rollback, IFD persistence or durability guarantee. Failure to allocate the compressed or multiband staging buffer returns zero without a codec diagnostic (only _TIFFmallocExt()'s memory-limit error, if a configured limit was exceeded). Caller input had already been copied; no ownership transfer.

Parameters
[in,out]tifNon-NULL live LERC handle with valid current geometry/state; serialise access.
Returns
One after encoding and payload flush, zero on wrong codec state or detected extent/mask/allocation/dependency/I/O failure.

Definition at line 1106 of file tif_lerc.c.

References _TIFFfreeExt(), _TIFFmallocExt(), _TIFFMultiply32(), EXTRASAMPLE_UNASSALPHA, GetLercDataType(), LERC_ADD_COMPRESSION_DEFLATE, LERC_ADD_COMPRESSION_NONE, LERC_ADD_COMPRESSION_ZSTD, LERC_AT_LEAST_VERSION, LERCEncoderState, LSTATE_INIT_ENCODE, PLANARCONFIG_CONTIG, SAMPLEFORMAT_IEEEFP, TIFFDirectory::td_bitspersample, TIFFDirectory::td_extrasamples, TIFFDirectory::td_planarconfig, TIFFDirectory::td_row, TIFFDirectory::td_sampleformat, TIFFDirectory::td_sampleinfo, TIFFDirectory::td_samplesperpixel, tiff::tif_dir, tiff::tif_rawcc, tiff::tif_rawdata, tiff::tif_rawdatasize, TIFFErrorExtR(), and TIFFFlushData1().

Referenced by TIFFInitLERC().

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

◆ LERCPreDecode()

static int LERCPreDecode ( TIFF *  tif,
uint16_t  s 
)
static

Decode and validate an entire LERC strile into owned staging.

Selects data type, reserves buffers and optionally decompresses Deflate/ZSTD into reusable compressed storage. Inspects blob type, dimensions, bands, size and masks, warning on unexpected version. Decodes samples, expands binary alpha masks or restores invalid floating samples as NaNs; supported multi-band mask layouts depend on LERC version. Pixel-count and multiband byte-count products are checked and an overflow is diagnosed. Requires valid representable geometry/counts and raw extents within dependency unsigned sizes. Buffers/dependency state can change on failure and staged data must not be used after failure. Allocations remain codec-owned until replacement/cleanup. Does not copy caller output, consume it, or transfer ownership; dependency/validation errors diagnose. Failure to allocate the compressed or multiband staging buffer returns zero without a codec diagnostic (only _TIFFmallocExt()'s memory-limit error, if a configured limit was exceeded).

Parameters
[in,out]tifNon-NULL live LERC handle with valid current geometry/state; serialise access.
[in]sUnused sample-plane compatibility argument.
Returns
One after complete staged decode, zero on detected format/geometry/allocation/dependency failure.

Definition at line 433 of file tif_lerc.c.

References _TIFFfreeExt(), _TIFFmallocExt(), _TIFFMultiply32(), LERCState::additional_compression, LERCState::compressed_buffer, LERCState::compressed_size, EXTRASAMPLE_UNASSALPHA, GetLercDataType(), LERC_ADD_COMPRESSION_DEFLATE, LERC_ADD_COMPRESSION_NONE, LERC_ADD_COMPRESSION_ZSTD, LERC_AT_LEAST_VERSION, LERCState::lerc_version, LERCDecoderState, LSTATE_INIT_DECODE, LERCState::mask_buffer, PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, SAMPLEFORMAT_IEEEFP, LERCState::segment_height, LERCState::segment_width, SetupBuffers(), LERCState::state, TIFFDirectory::td_bitspersample, TIFFDirectory::td_extrasamples, TIFFDirectory::td_planarconfig, TIFFDirectory::td_row, TIFFDirectory::td_sampleformat, TIFFDirectory::td_sampleinfo, TIFFDirectory::td_samplesperpixel, tiff::tif_dir, tiff::tif_rawcc, tiff::tif_rawcp, tiff::tif_setupdecode, TIFFErrorExtR(), TIFFWarningExtR(), LERCState::uncompressed_alloc, LERCState::uncompressed_buffer, LERCState::uncompressed_buffer_multiband, and LERCState::uncompressed_buffer_multiband_alloc.

Referenced by TIFFInitLERC().

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

◆ LERCPreEncode()

static int LERCPreEncode ( TIFF *  tif,
uint16_t  s 
)
static

Validate LERC sample type and prepare full-strile input storage.

Ensures encode mode, maps sample type and reserves buffers/masks through SetupBuffers. Requires valid representable geometry and successful setup; helper failures can invalidate old staging. No pixel I/O or caller ownership transfer.

Parameters
[in,out]tifNon-NULL live LERC handle with valid current geometry/state; serialise access.
[in]sUnused sample-plane compatibility argument.
Returns
One after preparation, zero on sample-type or buffer setup failure.

Definition at line 1005 of file tif_lerc.c.

References GetLercDataType(), LERCEncoderState, LSTATE_INIT_ENCODE, SetupBuffers(), and tiff::tif_setupencode.

Referenced by TIFFInitLERC().

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

◆ LERCSetupDecode()

static int LERCSetupDecode ( TIFF *  tif)
static

Select LERC decode mode.

Clears previous encode mode bits and marks decode initialisation without freeing reusable staging/dependency objects. No allocation, pixel I/O, diagnostics or ownership transfer.

Parameters
[in,out]tifNon-NULL live LERC handle with valid current geometry/state; serialise access.
Returns
One unconditionally.

Definition at line 178 of file tif_lerc.c.

References LERCDecoderState, LSTATE_INIT_DECODE, LSTATE_INIT_ENCODE, and LERCState::state.

Referenced by TIFFInitLERC().

Here is the caller graph for this function:

◆ LERCSetupEncode()

static int LERCSetupEncode ( TIFF *  tif)
static

Select LERC encode mode.

Clears previous decode mode bits and marks encoding without freeing reusable buffers. No allocation, diagnostics, payload I/O or ownership transfer.

Parameters
[in,out]tifNon-NULL live LERC handle with valid current geometry/state; serialise access.
Returns
One unconditionally.

Definition at line 972 of file tif_lerc.c.

References LERCEncoderState, LSTATE_INIT_DECODE, LSTATE_INIT_ENCODE, and LERCState::state.

Referenced by TIFFInitLERC().

Here is the caller graph for this function:

◆ LERCVGetField()

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

Retrieve cached LERC controls or delegate another tag query.

MAXZERROR consumes non-NULL double*; VERSION, ADD_COMPRESSION, ZSTD_LEVEL and ZIPQUALITY consume non-NULL int*. ZSTD_LEVEL returns the cached level even in builds without ZSTD_SUPPORT, where the setter delegates it. LERC_PARAMETERS and other tags follow parent variadic contracts, including borrowed custom-array lifetime. No output allocation or ownership transfer for scalar pseudo-tags.

Parameters
[in,out]tifNon-NULL live LERC handle with valid current geometry/state; serialise access.
[in]tagCodec pseudo-tag/custom tag or delegated identifier.
[in,out]apLive tag-specific va_list consumed synchronously; not retained.
Returns
One for scalar retrieval, otherwise parent getter status.

Definition at line 1836 of file tif_lerc.c.

References LERCState::additional_compression, GetLERCState, LERCState::lerc_version, LERCState::maxzerror, TIFFTAG_LERC_ADD_COMPRESSION, TIFFTAG_LERC_MAXZERROR, TIFFTAG_LERC_VERSION, TIFFTAG_ZIPQUALITY, TIFFTAG_ZSTD_LEVEL, LERCState::vgetparent, LERCState::zipquality, and LERCState::zstd_compress_level.

Referenced by TIFFInitLERC().

Here is the caller graph for this function:

◆ LERCVSetField()

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

Set LERC version error tolerance or secondary-compression controls.

LERC_PARAMETERS consumes int count then int*; a count below two is rejected, otherwise it caches version/backend and delegates custom-array storage; no validation of those array values is done here. MAXZERROR consumes double without range validation. VERSION and ADD_COMPRESSION consume int, validate supported values, cache and update the two-entry custom tag through the parent. ZSTD_LEVEL (ZSTD_SUPPORT builds only; otherwise delegated to the parent setter) consumes int and stores out-of-range values with a warning. ZIPQUALITY consumes int and stores it before range rejection; on every accepted assignment it frees any cached libdeflate compressor. Other tags delegate. State/custom-tag allocation changes can survive failure; borrowed input arrays are consumed/copied through the parent contract.

Parameters
[in,out]tifNon-NULL live LERC handle with valid current geometry/state; serialise access.
[in]tagCodec pseudo-tag/custom tag or delegated identifier.
[in,out]apLive tag-specific va_list consumed synchronously; not retained.
Returns
One on accepted pseudo-tag assignment, zero on explicit validation or parent storage failure, otherwise delegated status.

Definition at line 1709 of file tif_lerc.c.

References GetLERCState, LERC_ADD_COMPRESSION_DEFLATE, LERC_ADD_COMPRESSION_NONE, LERC_ADD_COMPRESSION_ZSTD, LERC_VERSION_2_4, LERCVSetFieldBase(), LIBDEFLATE_MAX_COMPRESSION_LEVEL, TIFFErrorExtR(), TIFFTAG_LERC_ADD_COMPRESSION, TIFFTAG_LERC_MAXZERROR, TIFFTAG_LERC_PARAMETERS, TIFFTAG_LERC_VERSION, TIFFTAG_ZIPQUALITY, TIFFTAG_ZSTD_LEVEL, and TIFFWarningExtR().

Referenced by TIFFInitLERC().

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

◆ LERCVSetFieldBase()

static int LERCVSetFieldBase ( TIFF *  tif,
uint32_t  tag,
  ... 
)
static

Forward a variadic assignment directly to the saved parent setter.

Constructs a va_list and synchronously calls vsetparent, then ends the list. Used to store LERC_PARAMETERS without recursive codec dispatch. Tag-specific promotion, ownership and side effects follow the parent setter; see Tag arguments. No independent payload I/O.

Parameters
[in,out]tifNon-NULL live LERC handle with valid current geometry/state; serialise access.
[in]tagCodec pseudo-tag/custom tag or delegated identifier.
[in]...Promoted tag-specific values/pointers required by the saved parent setter; consumed synchronously.
Returns
Saved parent setter status.

Definition at line 1673 of file tif_lerc.c.

References GetLERCState, and LERCState::vsetparent.

Referenced by LERCVSetField().

Here is the caller graph for this function:

◆ SetupBuffers()

static int SetupBuffers ( TIFF *  tif,
LERCState *  sp,
const char *  module 
)
static

Size and reserve full-strile sample and validity-mask storage.

Computes tile/truncated-strip dimensions and row-interleaved sample bytes, resets staging offset and reserves margin for secondary compression. Rejects an uncompressed size above UINT_MAX before narrowing it. Mask-size products are checked and an overflow is diagnosed. Requires the intermediate uint64_t products/sums and dependency size casts to be representable; these checks are not comprehensive overflow validation. Replaces owned uncompressed storage when growing and optionally grows masks for alpha/NaN/per-band validity. Failure can release prior sample storage and leave capacities/state changed, with the old mask allocation retained after failed realloc. Diagnostics report detected extent/allocation errors; no payload I/O or ownership transfer.

Parameters
[in,out]tifNon-NULL live LERC handle with valid current geometry/state; serialise access.
[in,out]spBorrowed live LERC state owned by tif.
[in]moduleBorrowed diagnostic context string, used synchronously.
Returns
One after applicable reservations, zero on detected allocation/extent failure.

Definition at line 283 of file tif_lerc.c.

References _TIFFfreeExt(), _TIFFmallocExt(), _TIFFMultiply32(), _TIFFreallocExt(), EXTRASAMPLE_UNASSALPHA, GetLercDataType(), isTiled, LERCState::mask_buffer, LERCState::mask_size, PLANARCONFIG_CONTIG, SAMPLEFORMAT_IEEEFP, LERCState::segment_height, LERCState::segment_width, TIFFDirectory::td_bitspersample, TIFFDirectory::td_extrasamples, TIFFDirectory::td_imagelength, TIFFDirectory::td_imagewidth, TIFFDirectory::td_planarconfig, TIFFDirectory::td_row, TIFFDirectory::td_rowsperstrip, TIFFDirectory::td_sampleformat, TIFFDirectory::td_sampleinfo, TIFFDirectory::td_samplesperpixel, TIFFDirectory::td_tilelength, TIFFDirectory::td_tilewidth, tiff::tif_dir, TIFFErrorExtR(), LERCState::uncompressed_alloc, LERCState::uncompressed_buffer, LERCState::uncompressed_offset, and LERCState::uncompressed_size.

Referenced by LERCPreDecode(), and LERCPreEncode().

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

◆ TIFFInitLERC()

int TIFFInitLERC ( TIFF *  tif,
int  scheme 
)
extern

Allocate LERC staging state and install frame callbacks and pseudo-tags.

Requires cleaned-up previous codec state and COMPRESSION_LERC. Merges field metadata, allocates zeroed Ext state, chains tag methods and installs decode plus non-read-only encode callbacks. Sets version/additional-compression defaults through TIFFSetField without checking those statuses, then sets zero error tolerance, ZSTD level nine and default Deflate quality. Reusable buffers/dependency objects are created lazily. No predictor prefix or finite ratio heuristic is installed. Failures diagnose without general rollback; no pixel I/O.

Parameters
[in,out]tifNon-NULL handle whose previous codec state has been cleaned up; receives the new codec state. Serialise access.
[in]schemeCOMPRESSION_LERC, asserted in debug builds.
Returns
One after installation/default assignments, zero on field merge or outer allocation failure.

Definition at line 1863 of file tif_lerc.c.

References _TIFFcallocExt(), _TIFFMergeFields(), COMPRESSION_LERC, GetLERCState, LERC_ADD_COMPRESSION_NONE, LERC_VERSION_2_4, LERCCleanup(), LERCDecode(), LERCEncode(), LERCFields, LERCFixupTags(), LERCPostEncode(), LERCPreDecode(), LERCPreEncode(), LERCSetupDecode(), LERCSetupEncode(), LERCVGetField(), LERCVSetField(), 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_postencode, tiff::tif_predecode, tiff::tif_preencode, tiff::tif_setupdecode, tiff::tif_setupencode, tiff::tif_tagmethods, TIFFArrayCount, TIFFErrorExtR(), TIFFSetField(), TIFFTAG_LERC_ADD_COMPRESSION, TIFFTAG_LERC_VERSION, TIFFTagMethods::vgetfield, and TIFFTagMethods::vsetfield.

Here is the call graph for this function:

Variable Documentation

◆ LERCFields

const TIFFField LERCFields[]
static
Initial value:
= {
(char *)"LercParameters", NULL},
FIELD_PSEUDO, TRUE, FALSE, (char *)"LercMaximumError", NULL},
FALSE, FALSE, (char *)"LercVersion", NULL},
FIELD_PSEUDO, FALSE, FALSE, (char *)"LercAdditionalCompression", NULL},
FALSE, (char *)"ZSTD zstd_compress_level", NULL},
FALSE, (char *)"", NULL},
}
#define FIELD_PSEUDO
Share bit zero with FIELD_IGNORE for pseudo-tags.
Definition tif_dir.h:620
@ TIFF_SETGET_DOUBLE
Double scalar storage.
Definition tif_dir.h:758
@ TIFF_SETGET_INT
Promoted int scalar representation.
Definition tif_dir.h:762
@ TIFF_SETGET_C32_UINT32
Unsigned 32-bit array with 32-bit explicit count.
Definition tif_dir.h:824
@ TIFF_SETGET_UINT32
Unsigned 32-bit scalar storage.
Definition tif_dir.h:748
#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 FIELD_CUSTOM
Identify a field stored through the custom-metadata mechanism.
Definition tiffio.h:1316
#define TIFF_ANY
Match any data type when searching for a field descriptor.
Definition tiffio.h:1289
#define TIFF_VARIABLE2
Mark a variable-length field with a 32-bit count convention.
Definition tiffio.h:1310
#define TIFFTAG_LERC_MAXZERROR
Pseudo-tag: LERC maximum error.
Definition tiff.h:1655
#define TIFFTAG_LERC_ADD_COMPRESSION
Pseudo-tag: LERC additional compression.
Definition tiff.h:1647
#define TIFFTAG_ZSTD_LEVEL
Pseudo-tag: ZSTD compression level.
Definition tiff.h:1641
#define TIFFTAG_LERC_VERSION
Pseudo-tag: LERC version.
Definition tiff.h:1643
#define TIFFTAG_ZIPQUALITY
Pseudo-tag: Deflate compression level control.
Definition tiff.h:1610
#define TIFFTAG_LERC_PARAMETERS
TIFF tag: Stores LERC version and additional compression method.
Definition tiff.h:958
@ TIFF_LONG
Unsigned 32-bit integer.
Definition tiff.h:239

Define LERC parameters error tolerance version and secondary-compression tags.

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

Definition at line 1641 of file tif_lerc.c.

Referenced by TIFFInitLERC().