FFmpeg
|
LZW encoder. More...
Go to the source code of this file.
Data Structures | |
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 |
Functions | |
static int | hash (int head, const int add) |
Hash function adding character. | |
static int | hashNext (int head, const int offset) |
Hash function calculates next hash value. | |
static int | hashOffset (const int head) |
Hash function calculates hash offset. | |
static void | writeCode (LZWEncodeState *s, int c) |
Write one code to stream. | |
static int | findCode (LZWEncodeState *s, uint8_t c, int hash_prefix) |
Find LZW code for block. | |
static void | addCode (LZWEncodeState *s, uint8_t c, int hash_prefix, int hash_code) |
Add block to LZW code table. | |
static void | clearTable (LZWEncodeState *s) |
Clear LZW code table. | |
static int | writtenBytes (LZWEncodeState *s) |
Calculate number of bytes written. | |
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. | |
int | ff_lzw_encode (LZWEncodeState *s, const uint8_t *inbuf, int insize) |
LZW main compress function. | |
int | ff_lzw_encode_flush (LZWEncodeState *s, void(*lzw_flush_put_bits)(PutBitContext *)) |
Write end code and flush bitstream. | |
Variables | |
const int | ff_lzw_encode_state_size = sizeof(LZWEncodeState) |
LZW encoder.
Definition in file lzwenc.c.
#define LZW_MAXBITS 12 |
Definition at line 33 of file lzwenc.c.
Referenced by ff_lzw_encode_init().
#define LZW_SIZTABLE (1<<LZW_MAXBITS) |
#define LZW_HASH_SIZE 16411 |
Definition at line 35 of file lzwenc.c.
Referenced by clearTable(), hash(), hashNext(), and hashOffset().
#define LZW_PREFIX_EMPTY -1 |
Definition at line 38 of file lzwenc.c.
Referenced by clearTable(), ff_lzw_encode(), and ff_lzw_encode_init().
#define LZW_PREFIX_FREE -2 |
Definition at line 39 of file lzwenc.c.
Referenced by clearTable(), ff_lzw_encode(), and findCode().
|
inlinestatic |
Hash function adding character.
head | LZW code for prefix |
add | Character to add |
Definition at line 75 of file lzwenc.c.
Referenced by clearTable(), ff_lzw_encode(), and findCode().
|
inlinestatic |
Hash function calculates next hash value.
head | Actual hash code |
offset | Offset calculated by hashOffset |
Definition at line 90 of file lzwenc.c.
Referenced by findCode().
|
inlinestatic |
Hash function calculates hash offset.
head | Actual hash code |
Definition at line 103 of file lzwenc.c.
Referenced by findCode().
|
inlinestatic |
Write one code to stream.
s | LZW state |
c | code to write |
Definition at line 113 of file lzwenc.c.
Referenced by clearTable(), ff_lzw_encode(), and ff_lzw_encode_flush().
|
inlinestatic |
Find LZW code for block.
s | LZW state |
c | Last character in block |
hash_prefix | LZW code for prefix |
Definition at line 127 of file lzwenc.c.
Referenced by ff_lzw_encode().
|
inlinestatic |
Add block to LZW code table.
s | LZW state |
c | Last character in block |
hash_prefix | LZW code for prefix |
hash_code | LZW code for bytes block |
Definition at line 149 of file lzwenc.c.
Referenced by ff_lzw_encode().
|
static |
Clear LZW code table.
s | LZW state |
Definition at line 165 of file lzwenc.c.
Referenced by ff_lzw_encode().
|
static |
Calculate number of bytes written.
s | LZW encode state |
Definition at line 188 of file lzwenc.c.
Referenced by ff_lzw_encode(), and ff_lzw_encode_flush().
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 | ||
) |
int ff_lzw_encode | ( | LZWEncodeState * | s, |
const uint8_t * | inbuf, | ||
int | insize | ||
) |
LZW main compress function.
s | LZW state |
inbuf | Input buffer |
insize | Size of input buffer |
Definition at line 227 of file lzwenc.c.
Referenced by encode_strip(), and gif_image_write_image().
int ff_lzw_encode_flush | ( | LZWEncodeState * | s, |
void(*)(PutBitContext *) | lzw_flush_put_bits | ||
) |
const int ff_lzw_encode_state_size = sizeof(LZWEncodeState) |
Definition at line 67 of file lzwenc.c.
Referenced by encode_frame(), and gif_encode_init().