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

Implement zlib and optional libdeflate compression. More...

#include "tiffiop.h"
#include "tif_predict.h"
#include "zlib.h"
#include <stdio.h>
Include dependency graph for tif_zip.c:

Go to the source code of this file.

Data Structures

struct  ZIPState
 Own Deflate dependency streams predictor prefix and backend selection. More...
 

Macros

#define LIBDEFLATE_MAX_COMPRESSION_LEVEL   12
 Highest accepted TIFFTAG_ZIPQUALITY value: 12.
 
#define SAFE_MSG(sp)   ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg)
 Borrow the zlib stream error text, or an empty string if none.
 
#define ZSTATE_INIT_DECODE   0x01
 Bit 0x01 of the codec state field: decoding has been set up.
 
#define ZSTATE_INIT_ENCODE   0x02
 Bit 0x02 of the codec state field: encoding has been set up.
 
#define GetZIPState(tif)   ((ZIPState *)(tif)->tif_data)
 Cast tif->tif_data to the ZIPState.
 
#define ZIPDecoderState(tif)   GetZIPState(tif)
 Alias of GetZIPState(), returning the ZIPState for decoding.
 
#define ZIPEncoderState(tif)   GetZIPState(tif)
 Alias of GetZIPState(), returning the ZIPState for encoding.
 

Functions

static int ZIPEncode (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
 Compress input with streaming zlib or eligible whole-strile libdeflate.
 
static int ZIPDecode (TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
 Expand zlib or eligible whole-strile libdeflate input.
 
static int ZIPFixupTags (TIFF *tif)
 Accept Deflate tag fixup without changes.
 
static int ZIPSetupDecode (TIFF *tif)
 Initialise zlib decode mode and end an active encoder.
 
static uint64_t TIFF_MIN_UINT64 (uint64_t a, uint64_t b)
 Select the smaller of two unsigned values.
 
static uInt TIFF_CLAMP_UINT64_TO_INT32_MAX (uint64_t v)
 Bound a zlib chunk to the signed 32-bit maximum.
 
static int ZIPPreDecode (TIFF *tif, uint16_t s)
 Reset zlib decoding and per-strile backend selection.
 
static int ZIPSetupEncode (TIFF *tif)
 Initialise zlib encoding at a capped compression quality.
 
static int ZIPPreEncode (TIFF *tif, uint16_t s)
 Reset zlib encoding and per-strile backend selection.
 
static int ZIPPostEncode (TIFF *tif)
 Finish zlib output or accept an already written libdeflate frame.
 
static void ZIPCleanup (TIFF *tif)
 End Deflate dependency objects and release codec state.
 
static int ZIPVSetField (TIFF *tif, uint32_t tag, va_list ap)
 Set Deflate quality or backend or delegate another tag.
 
static int ZIPVGetField (TIFF *tif, uint32_t tag, va_list ap)
 Retrieve Deflate quality or backend or delegate a tag query.
 
static void * TIFF_zalloc (void *opaque, unsigned int items, unsigned int size)
 Allocate zlib internal storage through handle Ext allocation.
 
static void TIFF_zfree (void *opaque, void *ptr)
 Release zlib storage through the matching handle Ext allocator.
 
static uint64_t ZIPGetMaxCompressionRatio (TIFF *tif)
 Report the Deflate expansion allocation heuristic.
 
int TIFFInitZIP (TIFF *tif, int scheme)
 Install predictor-aware Deflate codec and allocator hooks.
 

Variables

static const TIFFField zipFields []
 Define compression quality and backend pseudo-tags.
 

Detailed Description

Implement zlib and optional libdeflate compression.

Definition in file tif_zip.c.