Imagine reading a book and keeping a notepad. Every time you meet a phrase you haven't seen before, you jot it down and assign it a number. The next time that phrase appears you write only the number. By the end of the book, your notepad might hold thousands of phrases â and your compressed copy is just a list of numbers pointing into it.
That is exactly how LZW (LempelâZivâWelch) works. Abraham Lempel and Jacob Ziv laid the foundations in their landmark 1977â78 papers on universal compression. Terry Welch refined the idea in 1984 into the practical scheme now named after all three. The trick: encoder and decoder build the same dictionary independently, so the dictionary never needs to be transmitted â only the codes.
LZW became famous as the algorithm inside the GIF image format (1987), TIFF files, and the Unix compress utility. It is lossless â the original data can be recovered bit-for-bit â and it is proven to be asymptotically optimal for any stationary ergodic source, meaning it squeezes as hard as the fundamental limits of information theory allow, given enough data.
Understanding LZW means understanding two beautiful ideas at once: how to exploit repetition without knowing anything about the data in advance, and why a dictionary that nobody transmits can still be shared perfectly between sender and receiver.
Comments
Loading comments...