LZW Filter

From GNUpdf

Maybe we could use the lzw decoder from ffmpeg: http://www.irisa.fr/texmex/people/dufouil/ffmpegdoxy/lzw_8c-source.html

It seems that the software patent covering lzw encryption passed out. In that case, we would be able to include an encoder into the library.

PDF Reference 3.3.3 LZWDecode Filter:

LZW (Lempel-Ziv-Welch) is a variable-length, adaptive compression method that has been adopted as one of the 
standard compression methods in the Tag ImageFile Format (TIFF) standard.

For LZW encoding, the best case (all zeros) provides a compression approaching 1365:1 for long files, but the 
worst-case expansion is at least a factor of 1.125, which can increase to nearly 1.5 in some implementations, plus the 
effects of PNG tags as with Flate encoding.
 

Specific parameters for LWZ in the filter dictionary:

  • EarlyChange

An indication of when to increase the code length. If the value of this entry is 0, code length increases are postponed as long as possible. If the value is 1, code length increases occur one code early. This parameter is included because LZW sample code distributed by some vendors increases the code length one code earlier than necessary.

Default value: 1