w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

tif_lzw.c File Reference
#include "tiffiop.h"
#include "tif_predict.h"
#include <assert.h>
#include <stdio.h>
Include dependency graph for tif_lzw.c:

Go to the source code of this file.

Classes

struct  LZWBaseState
 
struct  code_ent
 
struct  LZWDecodeState
 
struct  hash_t
 
struct  LZWEncodeState
 

Macros

#define LZW_COMPAT   /* include backwards compatibility code */
 
#define LZW_CHECKEOS   /* include checks for strips w/o EOI code */
 
#define MAXCODE(n)   ((1L<<(n))-1)
 
#define BITS_MIN   9 /* start with 9 bits */
 
#define BITS_MAX   12 /* max of 12 bit strings */
 
#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 */
 
#define CODE_MAX   MAXCODE(BITS_MAX)
 
#define HSIZE   9001L /* 91% occupancy */
 
#define HSHIFT   (13-8)
 
#define CSIZE   (MAXCODE(BITS_MAX)+1024L)
 
#define lzw_nbits   base.nbits
 
#define lzw_maxcode   base.maxcode
 
#define lzw_free_ent   base.free_ent
 
#define lzw_nextdata   base.nextdata
 
#define lzw_nextbits   base.nextbits
 
#define CHECK_GAP   10000 /* enc_ratio check interval */
 
#define LZWState(tif)   ((LZWBaseState*) (tif)->tif_data)
 
#define DecoderState(tif)   ((LZWDecodeState*) LZWState(tif))
 
#define EncoderState(tif)   ((LZWEncodeState*) LZWState(tif))
 
#define NextCode(_tif, _sp, _bp, _code, _get)
 
#define GetNextCode(sp, bp, code)
 
#define GetNextCodeCompat(sp, bp, code)
 

Typedefs

typedef struct code_ent code_t
 
typedef int(* decodeFunc) (TIFF *, tidata_t, tsize_t, tsample_t)
 
typedef uint16 hcode_t
 

Functions

static int LZWDecode (TIFF *, tidata_t, tsize_t, tsample_t)
 
static int LZWDecodeCompat (TIFF *, tidata_t, tsize_t, tsample_t)
 
static void cl_hash (LZWEncodeState *)
 
static int LZWSetupDecode (TIFF *tif)
 
static int LZWPreDecode (TIFF *tif, tsample_t s)
 
static void codeLoop (TIFF *tif)
 
static int _LZWtrue (TIFF *tif)
 
static void LZWCleanup (TIFF *tif)
 
int TIFFInitLZW (TIFF *tif, int scheme)
 

Macro Definition Documentation

◆ BITS_MAX

#define BITS_MAX   12 /* max of 12 bit strings */

Definition at line 72 of file tif_lzw.c.

◆ BITS_MIN

#define BITS_MIN   9 /* start with 9 bits */

Definition at line 71 of file tif_lzw.c.

◆ CHECK_GAP

#define CHECK_GAP   10000 /* enc_ratio check interval */

Definition at line 148 of file tif_lzw.c.

◆ CODE_CLEAR

#define CODE_CLEAR   256 /* code to clear string table */

Definition at line 74 of file tif_lzw.c.

◆ CODE_EOI

#define CODE_EOI   257 /* end-of-information code */

Definition at line 75 of file tif_lzw.c.

◆ CODE_FIRST

#define CODE_FIRST   258 /* first free code entry */

Definition at line 76 of file tif_lzw.c.

◆ CODE_MAX

#define CODE_MAX   MAXCODE(BITS_MAX)

Definition at line 77 of file tif_lzw.c.

◆ CSIZE

#define CSIZE   (MAXCODE(BITS_MAX)+1024L)

Definition at line 82 of file tif_lzw.c.

◆ DecoderState

#define DecoderState (   tif)    ((LZWDecodeState*) LZWState(tif))

Definition at line 157 of file tif_lzw.c.

◆ EncoderState

#define EncoderState (   tif)    ((LZWEncodeState*) LZWState(tif))

Definition at line 158 of file tif_lzw.c.

◆ GetNextCode

#define GetNextCode (   sp,
  bp,
  code 
)
Value:
{ \
nextdata = (nextdata<<8) | *(bp)++; \
nextbits += 8; \
if (nextbits < nbits) { \
nextdata = (nextdata<<8) | *(bp)++; \
nextbits += 8; \
} \
code = (hcode_t)((nextdata >> (nextbits-nbits)) & nbitsmask); \
nextbits -= nbits; \
}
bp
Definition: action.c:1035
register bit_buf_type register int int nbits
Definition: jdhuff.h:156
uint16 hcode_t
Definition: tif_lzw.c:138

Definition at line 292 of file tif_lzw.c.

◆ GetNextCodeCompat

#define GetNextCodeCompat (   sp,
  bp,
  code 
)
Value:
{ \
nextdata |= (u_long) *(bp)++ << nextbits; \
nextbits += 8; \
if (nextbits < nbits) { \
nextdata |= (u_long) *(bp)++ << nextbits; \
nextbits += 8; \
} \
code = (hcode_t)(nextdata & nbitsmask); \
nextdata >>= nbits; \
nextbits -= nbits; \
}
unsigned long u_long
Definition: vmsdir.h:26

Definition at line 480 of file tif_lzw.c.

◆ HSHIFT

#define HSHIFT   (13-8)

Definition at line 79 of file tif_lzw.c.

◆ HSIZE

#define HSIZE   9001L /* 91% occupancy */

Definition at line 78 of file tif_lzw.c.

◆ LZW_CHECKEOS

#define LZW_CHECKEOS   /* include checks for strips w/o EOI code */

Definition at line 64 of file tif_lzw.c.

◆ LZW_COMPAT

#define LZW_COMPAT   /* include backwards compatibility code */

Definition at line 57 of file tif_lzw.c.

◆ lzw_free_ent

#define lzw_free_ent   base.free_ent

Definition at line 104 of file tif_lzw.c.

◆ lzw_maxcode

#define lzw_maxcode   base.maxcode

Definition at line 103 of file tif_lzw.c.

◆ lzw_nbits

#define lzw_nbits   base.nbits

Definition at line 102 of file tif_lzw.c.

◆ lzw_nextbits

#define lzw_nextbits   base.nextbits

Definition at line 106 of file tif_lzw.c.

◆ lzw_nextdata

#define lzw_nextdata   base.nextdata

Definition at line 105 of file tif_lzw.c.

◆ LZWState

#define LZWState (   tif)    ((LZWBaseState*) (tif)->tif_data)

Definition at line 156 of file tif_lzw.c.

◆ MAXCODE

#define MAXCODE (   n)    ((1L<<(n))-1)

Definition at line 66 of file tif_lzw.c.

◆ NextCode

#define NextCode (   _tif,
  _sp,
  _bp,
  _code,
  _get 
)
Value:
{ \
if ((_sp)->dec_bitsleft < nbits) { \
TIFFWarning(_tif->tif_name, \
"LZWDecode: Strip %d not terminated with EOI code", \
_tif->tif_curstrip); \
_code = CODE_EOI; \
} else { \
_get(_sp,_bp,_code); \
(_sp)->dec_bitsleft -= nbits; \
} \
}
#define CODE_EOI
Definition: tif_lzw.c:75

Definition at line 175 of file tif_lzw.c.

Typedef Documentation

◆ code_t

typedef struct code_ent code_t

◆ decodeFunc

typedef int(* decodeFunc) (TIFF *, tidata_t, tsize_t, tsample_t)

Definition at line 118 of file tif_lzw.c.

◆ hcode_t

typedef uint16 hcode_t

Definition at line 138 of file tif_lzw.c.

Function Documentation

◆ _LZWtrue()

static int _LZWtrue ( TIFF tif)
static

Definition at line 637 of file tif_lzw.c.

References void.

Referenced by TIFFInitLZW().

◆ cl_hash()

static void cl_hash ( LZWEncodeState )
static

◆ codeLoop()

static void codeLoop ( TIFF tif)
static

Definition at line 304 of file tif_lzw.c.

References tiff::tif_name, tiff::tif_row, and TIFFError().

Referenced by LZWDecode().

◆ LZWCleanup()

static void LZWCleanup ( TIFF tif)
static

Definition at line 649 of file tif_lzw.c.

References _TIFFfree, DecoderState, NULL, O_RDONLY, tiff::tif_data, and tiff::tif_mode.

Referenced by TIFFInitLZW().

◆ LZWDecode()

◆ LZWDecodeCompat()

◆ LZWPreDecode()

◆ LZWSetupDecode()

static int LZWSetupDecode ( TIFF tif)
static

Definition at line 191 of file tif_lzw.c.

References _TIFFmalloc, assert(), code, CSIZE, DecoderState, NULL, sp, and TIFFError().

Referenced by TIFFInitLZW().

◆ TIFFInitLZW()