FFmpeg
Classes | Macros | Typedefs | Functions | Variables
lzwenc.c File Reference

LZW encoder. More...

#include "avcodec.h"
#include "lzw.h"
#include "mathops.h"
#include "put_bits.h"

Classes

struct  Code
 One code in hash table. More...
 
struct  LZWEncodeState
 LZW encode state. More...
 

Macros

#define LZW_MAXBITS   12
 
#define LZW_SIZTABLE   (1<<LZW_MAXBITS)
 
#define LZW_HASH_SIZE   16411
 
#define LZW_HASH_SHIFT   6
 
#define LZW_PREFIX_EMPTY   -1
 
#define LZW_PREFIX_FREE   -2
 

Typedefs

typedef struct Code Code
 One code in hash table.
 
typedef struct LZWEncodeState LZWEncodeState
 LZW encode state.
 

Functions

void ff_lzw_encode_init (LZWEncodeState *s, uint8_t *outbuf, int outsize, int maxbits, enum FF_LZW_MODES mode, void(*lzw_put_bits)(PutBitContext *, int, unsigned))
 Initialize LZW encoder. More...
 
int ff_lzw_encode (LZWEncodeState *s, const uint8_t *inbuf, int insize)
 LZW main compress function. More...
 
int ff_lzw_encode_flush (LZWEncodeState *s, void(*lzw_flush_put_bits)(PutBitContext *))
 Write end code and flush bitstream. More...
 

Variables

const int ff_lzw_encode_state_size = sizeof(LZWEncodeState)
 

Detailed Description

LZW encoder.

Author
Bartlomiej Wolowiec

Function Documentation

§ 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

§ ff_lzw_encode_flush()

int ff_lzw_encode_flush ( LZWEncodeState s,
void(*)(PutBitContext *)  lzw_flush_put_bits 
)

Write end code and flush bitstream.

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

§ ff_lzw_encode_init()

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

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