32 #include "libavutil/mem.h"
34 #define LZW_MAXBITS 12
35 #define LZW_SIZTABLE (1<<LZW_MAXBITS)
37 static const uint16_t
mask[17] =
39 0x0000, 0x0001, 0x0003, 0x0007,
40 0x000F, 0x001F, 0x003F, 0x007F,
41 0x00FF, 0x01FF, 0x03FF, 0x07FF,
42 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF
171 int l,
c, code,
oc,
fc;
184 while (sp > s->
stack) {
204 if (code == s->
slot && fc>=0) {
207 }
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...
void ff_lzw_decode_tail(LZWState *p)
int cursize
The current code size.
uint16_t prefix[LZW_SIZTABLE]
av_cold void ff_lzw_decode_close(LZWState **p)
av_cold void ff_lzw_decode_open(LZWState **p)
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
uint8_t suffix[LZW_SIZTABLE]
int top_slot
Highest code for current size.
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
uint8_t stack[LZW_SIZTABLE]
int newcodes
First available code.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const uint16_t mask[17]
Libavcodec external API header.
int bs
current buffer size for GIF
static int lzw_get_code(struct LZWState *s)
int ff_lzw_decode_init(LZWState *p, int csize, const uint8_t *buf, int buf_size, int mode)
Initialize LZW decoder.
void * av_mallocz(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...