Visualization Library 2.0.0-b5

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Macros | Typedefs | Functions
tif_lzw.c File Reference
#include "tiffiop.h"
#include "tif_predict.h"
#include <stdio.h>

Go to the source code of this file.

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)   ((LZWCodecState*) LZWState(tif))
 
#define EncoderState(tif)   ((LZWCodecState*) LZWState(tif))
 
#define NextCode(_tif, _sp, _bp, _code, _get)
 
#define GetNextCode(sp, bp, code)
 
#define GetNextCodeCompat(sp, bp, code)
 
#define CALCRATIO(sp, rat)
 
#define PutNextCode(op, c)
 

Typedefs

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

Functions

int TIFFInitLZW (TIFF *tif, int scheme)
 

Macro Definition Documentation

◆ BITS_MAX

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

Definition at line 71 of file tif_lzw.c.

◆ BITS_MIN

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

Definition at line 70 of file tif_lzw.c.

◆ CALCRATIO

#define CALCRATIO (   sp,
  rat 
)
Value:
{ \
if (incount > 0x007fffff) { /* NB: shift will overflow */\
rat = outcount >> 8; \
rat = (rat == 0 ? 0x7fffffff : incount/rat); \
} else \
rat = (incount<<8) / outcount; \
}

Definition at line 756 of file tif_lzw.c.

◆ CHECK_GAP

#define CHECK_GAP   10000 /* enc_ratio check interval */

Definition at line 149 of file tif_lzw.c.

◆ CODE_CLEAR

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

Definition at line 73 of file tif_lzw.c.

◆ CODE_EOI

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

Definition at line 74 of file tif_lzw.c.

◆ CODE_FIRST

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

Definition at line 75 of file tif_lzw.c.

◆ CODE_MAX

#define CODE_MAX   MAXCODE(BITS_MAX)

Definition at line 76 of file tif_lzw.c.

◆ CSIZE

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

Definition at line 81 of file tif_lzw.c.

◆ DecoderState

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

Definition at line 158 of file tif_lzw.c.

Referenced by TIFFInitLZW().

◆ EncoderState

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

Definition at line 159 of file tif_lzw.c.

Referenced by TIFFInitLZW().

◆ 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; \
}
uint16 hcode_t
Definition: tif_lzw.c:112
register bit_buf_type register int int nbits
Definition: jdhuff.h:155

Definition at line 319 of file tif_lzw.c.

◆ GetNextCodeCompat

#define GetNextCodeCompat (   sp,
  bp,
  code 
)
Value:
{ \
nextdata |= (unsigned long) *(bp)++ << nextbits; \
nextbits += 8; \
if (nextbits < nbits) { \
nextdata |= (unsigned long) *(bp)++ << nextbits;\
nextbits += 8; \
} \
code = (hcode_t)(nextdata & nbitsmask); \
nextdata >>= nbits; \
nextbits -= nbits; \
}
uint16 hcode_t
Definition: tif_lzw.c:112
typedef long(ZCALLBACK *tell_file_func) OF((voidpf opaque
register bit_buf_type register int int nbits
Definition: jdhuff.h:155

Definition at line 528 of file tif_lzw.c.

◆ HSHIFT

#define HSHIFT   (13-8)

Definition at line 78 of file tif_lzw.c.

◆ HSIZE

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

Definition at line 77 of file tif_lzw.c.

◆ LZW_CHECKEOS

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

Definition at line 63 of file tif_lzw.c.

◆ LZW_COMPAT

#define LZW_COMPAT   /* include backwards compatibility code */

Definition at line 56 of file tif_lzw.c.

◆ lzw_free_ent

#define lzw_free_ent   base.free_ent

Definition at line 105 of file tif_lzw.c.

◆ lzw_maxcode

#define lzw_maxcode   base.maxcode

Definition at line 104 of file tif_lzw.c.

◆ lzw_nbits

#define lzw_nbits   base.nbits

Definition at line 103 of file tif_lzw.c.

◆ lzw_nextbits

#define lzw_nextbits   base.nextbits

Definition at line 107 of file tif_lzw.c.

◆ lzw_nextdata

#define lzw_nextdata   base.nextdata

Definition at line 106 of file tif_lzw.c.

◆ LZWState

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

Definition at line 157 of file tif_lzw.c.

Referenced by TIFFInitLZW().

◆ MAXCODE

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

Definition at line 65 of file tif_lzw.c.

◆ NextCode

#define NextCode (   _tif,
  _sp,
  _bp,
  _code,
  _get 
)
Value:
{ \
if ((_sp)->dec_bitsleft < nbits) { \
TIFFWarningExt(_tif->tif_clientdata, _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:74
register bit_buf_type register int int nbits
Definition: jdhuff.h:155

Definition at line 176 of file tif_lzw.c.

◆ PutNextCode

#define PutNextCode (   op,
  c 
)
Value:
{ \
nextdata = (nextdata << nbits) | c; \
nextbits += nbits; \
*op++ = (unsigned char)(nextdata >> (nextbits-8)); \
nextbits -= 8; \
if (nextbits >= 8) { \
*op++ = (unsigned char)(nextdata >> (nextbits-8)); \
nextbits -= 8; \
} \
outcount += nbits; \
}
register bit_buf_type register int int nbits
Definition: jdhuff.h:155
const GLubyte * c

Definition at line 763 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 128 of file tif_lzw.c.

◆ hcode_t

typedef uint16 hcode_t

Definition at line 112 of file tif_lzw.c.

Function Documentation

◆ TIFFInitLZW()

int TIFFInitLZW ( TIFF tif,
int  scheme 
)