FFmpeg
Typedefs | Enumerations | Functions | Variables
lzw.h File Reference

LZW decoding routines. More...

#include <stdint.h>

Go to the source code of this file.

Typedefs

typedef void LZWState
 

Enumerations

enum  FF_LZW_MODES { FF_LZW_GIF, FF_LZW_TIFF }
 

Functions

void ff_lzw_decode_open (LZWState **p)
 
void ff_lzw_decode_close (LZWState **p)
 
int ff_lzw_decode_init (LZWState *s, int csize, const uint8_t *buf, int buf_size, int mode)
 Initialize LZW decoder. More...
 
int ff_lzw_decode (LZWState *s, uint8_t *buf, int len)
 Decode given number of bytes NOTE: the algorithm here is inspired from the LZW GIF decoder written by Steven A. More...
 
int ff_lzw_decode_tail (LZWState *lzw)
 
void ff_lzw_encode_init (struct LZWEncodeState *s, uint8_t *outbuf, int outsize, int maxbits, enum FF_LZW_MODES mode, int little_endian)
 Initialize LZW encoder. More...
 
int ff_lzw_encode (struct LZWEncodeState *s, const uint8_t *inbuf, int insize)
 LZW main compress function. More...
 
int ff_lzw_encode_flush (struct LZWEncodeState *s)
 Write end code and flush bitstream. More...
 

Variables

const int ff_lzw_encode_state_size
 

Detailed Description

LZW decoding routines.

Author
Fabrice Bellard
modified for use in TIFF by Konstantin Shishkov

Definition in file lzw.h.

Typedef Documentation

◆ LZWState

typedef void LZWState

Definition at line 43 of file lzw.h.

Enumeration Type Documentation

◆ FF_LZW_MODES

Enumerator
FF_LZW_GIF 
FF_LZW_TIFF 

Definition at line 37 of file lzw.h.

Function Documentation

◆ ff_lzw_decode_open()

void ff_lzw_decode_open ( LZWState **  p)

Definition at line 113 of file lzw.c.

Referenced by gif_decode_init(), and tiff_init().

◆ ff_lzw_decode_close()

void ff_lzw_decode_close ( LZWState **  p)

Definition at line 118 of file lzw.c.

Referenced by gif_decode_close(), and tiff_end().

◆ ff_lzw_decode_init()

int ff_lzw_decode_init ( LZWState p,
int  csize,
const uint8_t *  buf,
int  buf_size,
int  mode 
)

Initialize LZW decoder.

Parameters
pLZW context
csizeinitial code size in bits
bufinput data
buf_sizeinput data size
modedecoder working mode - either GIF or TIFF

Definition at line 131 of file lzw.c.

Referenced by gif_read_image(), and tiff_unpack_strip().

◆ ff_lzw_decode()

int ff_lzw_decode ( LZWState p,
uint8_t *  buf,
int  len 
)

Decode given number of bytes NOTE: the algorithm here is inspired from the LZW GIF decoder written by Steven A.

Bennett in 1987.

Parameters
pLZW context
bufoutput buffer
lennumber of bytes to decode
Returns
number of bytes decoded

Definition at line 169 of file lzw.c.

Referenced by gif_read_image(), and tiff_unpack_strip().

◆ ff_lzw_decode_tail()

int ff_lzw_decode_tail ( LZWState lzw)

Definition at line 99 of file lzw.c.

Referenced by gif_read_image().

◆ ff_lzw_encode_init()

void ff_lzw_encode_init ( LZWEncodeState s,
uint8_t *  outbuf,
int  outsize,
int  maxbits,
enum FF_LZW_MODES  mode,
int  little_endian 
)

Initialize LZW encoder.

Please set s->clear_code, s->end_code and s->maxbits before run.

Parameters
sLZW state
outbufOutput buffer
outsizeSize of output buffer
maxbitsMaximum length of code

Definition at line 206 of file lzwenc.c.

Referenced by encode_frame().

◆ ff_lzw_encode()

int ff_lzw_encode ( LZWEncodeState s,
const uint8_t *  inbuf,
int  insize 
)

LZW main compress function.

Parameters
sLZW state
inbufInput buffer
insizeSize of input buffer
Returns
Number of bytes written or -1 on error

Definition at line 230 of file lzwenc.c.

Referenced by encode_strip().

◆ ff_lzw_encode_flush()

int ff_lzw_encode_flush ( LZWEncodeState s)

Write end code and flush bitstream.

Parameters
sLZW state
Returns
Number of bytes written or -1 on error

Definition at line 263 of file lzwenc.c.

Referenced by encode_frame().

Variable Documentation

◆ ff_lzw_encode_state_size

const int ff_lzw_encode_state_size

Definition at line 68 of file lzwenc.c.

Referenced by encode_frame(), and gif_encode_init().