|
Thanks for the original image.
FWIW: Here's the comparison of the output of my test code of both images:
[ 128] Start decoding image 'gif_lzw_bug_original.gif'
[ 130] Found ClearCode ( 32), FreeCode = 34, fails = 0
[ 5769] Found ClearCode ( 32), FreeCode = 4096, fails = 1
[11408] Found ClearCode ( 32), FreeCode = 4096, fails = 2
[17047] Found ClearCode ( 32), FreeCode = 4096, fails = 3
[22685] Found ClearCode ( 32), FreeCode = 4096, fails = 4
[28324] Found ClearCode ( 32), FreeCode = 4096, fails = 5
[31531] Found EOFCode ( 33), FreeCode = 2481
[31531] EOF: tpmax = 552, Freecode = 4096 (max), fails = 5
[ 128] Start decoding image 'gif_lzw_bug.gif' (the "optimized" image)
[ 130] Found ClearCode ( 32), FreeCode = 34, fails = 0
[ 5765] Found ClearCode ( 32), FreeCode = 4093, fails = 0
[11399] Found ClearCode ( 32), FreeCode = 4093, fails = 0
[17033] Found ClearCode ( 32), FreeCode = 4093, fails = 0
[22667] Found ClearCode ( 32), FreeCode = 4093, fails = 0
[29510] Found ClearCode ( 32), FreeCode = 4096, fails = 801
[31098] Found EOFCode ( 33), FreeCode = 1348
[31098] EOF: tpmax = 518, Freecode = 4096 (max), fails = 801
- The first column
[...] shows the corresponding file offsets and final sizes which differ significantly.
tpmax is the maximal length of compressed items (552 vs 518).
FreeCode shows the contents of the buffer at each given point.
fails is a counter of items that couldn't be added to the buffer because it was full (FreeCode == 4096 , i.e. "uncompressed" data).
The compressor buffer of the original image was obviously always filled up and cleared as soon as the first "failed" code word was found (fails increases by one). In the optimized image we can see that up to 801 "failed" entries are stored "uncompressed" before the buffer is cleared at file offset 29510.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
[ Direct Link to Message ] | |