35 #define LZW_MAXBITS 12
36 #define LZW_SIZTABLE (1<<LZW_MAXBITS)
38 static const uint16_t
mask[17] =
40 0x0000, 0x0001, 0x0003, 0x0007,
41 0x000F, 0x001F, 0x003F, 0x007F,
42 0x00FF, 0x01FF, 0x03FF, 0x07FF,
43 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF
77 s->
bs = bytestream2_get_byte(&s->
gb);
79 s->
bbuf |= bytestream2_get_byte(&s->
gb) << s->
bbits;
87 s->
bbuf = (s->
bbuf << 8) | bytestream2_get_byte(&s->
gb);
103 s->
bs = bytestream2_get_byte(&s->
gb);
167 int l,
c, code,
oc,
fc;
180 while (sp > s->
stack) {
196 if (code == s->
slot && fc>=0) {
199 }
else if(code >= s->
slot)
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...
int cursize
The current code size.
Memory handling functions.
uint16_t prefix[LZW_SIZTABLE]
av_cold void ff_lzw_decode_close(LZWState **p)
av_cold void ff_lzw_decode_open(LZWState **p)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
uint8_t suffix[LZW_SIZTABLE]
int top_slot
Highest code for current size.
int ff_lzw_decode_tail(LZWState *p)
uint8_t stack[LZW_SIZTABLE]
int newcodes
First available code.
static const uint16_t mask[17]
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
static const uint16_t fc[]
int bs
current buffer size for GIF
static int lzw_get_code(struct LZWState *s)
static av_always_inline int bytestream2_tell(GetByteContext *g)
Libavcodec external API header.
int ff_lzw_decode_init(LZWState *p, int csize, const uint8_t *buf, int buf_size, int mode)
Initialize LZW decoder.
mode
Use these values in ebur128_init (or'ed).