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

wuffs_lzw_decode_20k/clang       124MB/s ± 0%  136MB/s ± 0%   +9.77%  (p=0.000 n=9+9)
wuffs_lzw_decode_100k/clang      164MB/s ± 1%  175MB/s ± 0%   +6.66%  (p=0.000 n=10+9)

wuffs_lzw_decode_20k/gcc         167MB/s ± 0%  168MB/s ± 0%   +0.38%  (p=0.000 n=8+9)
wuffs_lzw_decode_100k/gcc        247MB/s ± 0%  242MB/s ± 0%   -2.16%  (p=0.000 n=9+10)

wuffs_gif_decode_1k_bw/clang     266MB/s ± 1%  280MB/s ± 1%   +5.36%  (p=0.000 n=10+9)
wuffs_gif_decode_1k_color/clang  122MB/s ± 0%  158MB/s ± 0%  +29.46%  (p=0.000 n=10+8)
wuffs_gif_decode_10k/clang       115MB/s ± 1%  146MB/s ± 0%  +27.00%  (p=0.000 n=10+9)
wuffs_gif_decode_100k/clang      113MB/s ± 0%  125MB/s ± 0%  +10.46%  (p=0.000 n=9+9)
wuffs_gif_decode_1000k/clang     115MB/s ± 1%  128MB/s ± 0%  +11.24%  (p=0.000 n=9+8)

wuffs_gif_decode_1k_bw/gcc       298MB/s ± 1%  323MB/s ± 1%   +8.23%  (p=0.000 n=9+10)
wuffs_gif_decode_1k_color/gcc    163MB/s ± 1%  167MB/s ± 2%   +2.10%  (p=0.000 n=10+10)
wuffs_gif_decode_10k/gcc         152MB/s ± 0%  151MB/s ± 0%   -0.55%  (p=0.000 n=9+9)
wuffs_gif_decode_100k/gcc        134MB/s ± 0%  134MB/s ± 0%     ~     (p=0.606 n=8+9)
wuffs_gif_decode_1000k/gcc       138MB/s ± 1%  138MB/s ± 0%     ~     (p=0.422 n=9+9)
2018-06-30 08:40:24 +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.