<div dir="ltr">Hello, i'm trying to use LZW compression / decompression methods from libavcodec. I think i kinda have it working, but not 100%. For example, my input buffer contains 5 values {212, 231, 10, 11, 55}, after i encode it with ff_lzw_encode_init, ff_lzw_encode and ff_lzw_encode_flush, and decode it with ff_lzw_decode_open, ff_lzw_decode_init, ff_lzw_decode and ff_lzw_decode_tail, i only get first 2 values decoded correctly (212 and 231) and i have no idea why is that happening.<div><br></div><div>I have general idea how LZW compression is working in the given code, though some functions i can't figure out, like put_bits and so. Basicly you get hash code depending on the input value which makes it unique, after that if hash_prefix of that hash value is LZW_PREFIX_FREE you writeCode and addCode to the hash table, and you repeat that for size of the input buffer. </div><div><br></div><div>I was also wondering, when you do the decoding routines, through which parameter will decoder get previously filled hash table? It is somehow complicated since i have no general idea what put_bits function is doing and there is little or no explanation about it.</div></div>