| Bsoft 1.9 Bernard's software package

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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.

## Classes
struct | LZWBaseState
struct | hash_t
struct | code_ent
struct | LZWCodecState

## 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

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

Definition at line 71 of file tif_lzw.c.

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

Definition at line 70 of file tif_lzw.c.

#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 791 of file tif_lzw.c.

#define CHECK_GAP 10000 /* enc_ratio check interval */

Definition at line 149 of file tif_lzw.c.

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

Definition at line 73 of file tif_lzw.c.

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

Definition at line 74 of file tif_lzw.c.

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

Definition at line 75 of file tif_lzw.c.

#define CODE_MAX MAXCODE(BITS_MAX)

Definition at line 76 of file tif_lzw.c.

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

Definition at line 81 of file tif_lzw.c.

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

Definition at line 158 of file tif_lzw.c.

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

Definition at line 159 of file tif_lzw.c.

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

Definition at line 330 of file tif_lzw.c.

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

Definition at line 548 of file tif_lzw.c.

#define HSHIFT (13-8)

Definition at line 78 of file tif_lzw.c.

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

Definition at line 77 of file tif_lzw.c.

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

Definition at line 63 of file tif_lzw.c.

#define LZW_COMPAT /* include backwards compatibility code */

Definition at line 56 of file tif_lzw.c.

#define lzw_free_ent base.free_ent

Definition at line 105 of file tif_lzw.c.

#define lzw_maxcode base.maxcode

Definition at line 104 of file tif_lzw.c.

#define lzw_nbits base.nbits

Definition at line 103 of file tif_lzw.c.

#define lzw_nextbits base.nextbits

Definition at line 107 of file tif_lzw.c.

#define lzw_nextdata base.nextdata

Definition at line 106 of file tif_lzw.c.

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

Definition at line 157 of file tif_lzw.c.

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

Definition at line 65 of file tif_lzw.c.

#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; \
} \
}
TIFFWarningExt
void TIFFWarningExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_warning.c:63
CODE_EOI
#define CODE_EOI
Definition: tif_lzw.c:74
nbits
register bit_buf_type register int int nbits
Definition: jdhuff.h:155

Definition at line 176 of file tif_lzw.c.

#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; \
}
nbits
register bit_buf_type register int int nbits
Definition: jdhuff.h:155

Definition at line 798 of file tif_lzw.c.

## Typedef Documentation

typedef struct code_ent code_t

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

Definition at line 128 of file tif_lzw.c.

typedef uint16 hcode_t

Definition at line 112 of file tif_lzw.c.

## Function Documentation

int TIFFInitLZW | ( | TIFF * | tif,
|  | int | scheme
| ) |  |

Definition at line 1060 of file tif_lzw.c.