Files
wuffs/std/lzw
Nigel Tao 92b566367d Optimize some more more std/gif if blocks
name                             old speed     new speed     delta

wuffs_lzw_decode_20k/clang       136MB/s ± 0%  134MB/s ± 1%  -1.27%  (p=0.000 n=9+9)
wuffs_lzw_decode_100k/clang      175MB/s ± 0%  175MB/s ± 0%    ~     (p=0.863 n=9+9)

wuffs_lzw_decode_20k/gcc         168MB/s ± 0%  177MB/s ± 1%  +5.79%  (p=0.000 n=9+8)
wuffs_lzw_decode_100k/gcc        242MB/s ± 0%  262MB/s ± 3%  +8.27%  (p=0.000 n=10+10)

wuffs_gif_decode_1k_bw/clang     280MB/s ± 1%  294MB/s ± 1%  +4.88%  (p=0.000 n=9+9)
wuffs_gif_decode_1k_color/clang  158MB/s ± 0%  158MB/s ± 0%    ~     (p=0.724 n=8+9)
wuffs_gif_decode_10k/clang       146MB/s ± 0%  146MB/s ± 0%    ~     (p=0.387 n=9+9)
wuffs_gif_decode_100k/clang      125MB/s ± 0%  125MB/s ± 1%  +0.18%  (p=0.040 n=9+9)
wuffs_gif_decode_1000k/clang     128MB/s ± 0%  128MB/s ± 1%  +0.38%  (p=0.008 n=8+9)

wuffs_gif_decode_1k_bw/gcc       323MB/s ± 1%  306MB/s ± 2%  -5.20%  (p=0.000 n=10+10)
wuffs_gif_decode_1k_color/gcc    167MB/s ± 2%  164MB/s ± 1%  -1.71%  (p=0.002 n=10+10)
wuffs_gif_decode_10k/gcc         151MB/s ± 0%  152MB/s ± 0%  +0.67%  (p=0.000 n=9+10)
wuffs_gif_decode_100k/gcc        134MB/s ± 0%  136MB/s ± 1%  +1.16%  (p=0.001 n=9+9)
wuffs_gif_decode_1000k/gcc       138MB/s ± 0%  140MB/s ± 1%  +1.18%  (p=0.000 n=9+9)
2018-06-30 08:49:23 +10:00
..
2018-06-02 14:15:09 +10:00

LZW (Lempel Ziv Welch) Compression

LZW is a general purpose compression algorithm, not specific to GIF, PDF, TIFF or even to graphics. In practice, there are two incompatible implementations, LSB (Least Significant Bits) and MSB (Most Significant Bits) first.

The GIF format uses LSB first. The literal width can vary between 2 and 8 bits, inclusive. There is no EarlyChange option.

The PDF and TIFF formats use MSB first. The literal width is fixed at 8 bits. There is an EarlyChange option that PDF sometimes uses (see Table 3.7 in the PDF 1.4 spec) and TIFF always uses.

TODO: refactor this README.md file and std/gif's one.