Lempel-Ziv Welch compression

Lempel-Ziv Welch compression

(LZW) The algorithm used by the Unix compress command toreduce the size of files, e.g. for archival or transmission.LZW was designed by Terry Welch in 1984 for implementation inhardware for high-performance disk controllers. It is avariant of LZ78, one of the two Lempel-Ziv compressionschemes.

The LZW algorithm relies on reoccurrence of byte sequences(strings) in its input. It maintains a table mapping inputstrings to their associated output codes. The table initiallycontains mappings for all possible strings of length one.Input is taken one byte at a time to find the longest initialstring present in the table. The code for that string isoutput and then the string is extended with one more inputbyte, b. A new entry is added to the table mapping theextended string to the next unused code (obtained byincrementing a counter). The process repeats, starting frombyte b. The number of bits in an output code, and hence themaximum number of entries in the table is usually fixed andonce this limit is reached, no more entries are added.

LZW compression and decompression are licensed under UnisysCorporation's 1984 U.S. Patent 4,558,302 and equivalentforeign patents. This kind of patent isn't legal in mostcoutries of the world (including the UK) except the USA.Patents in the UK can't describe algorithms or mathematicalmethods.

[A Technique for High Performance Data Compression, Terry A.Welch, IEEE Computer, 17(6), June 1984, pp. 8-19]

[J. Ziv and A. Lempel, "A Universal Algorithm for SequentialData Compression," IEEE Transactions on Information Theory,Vol. IT-23, No. 3, May 1977, pp. 337-343].