
Another advantage of LZW its simplicity, allowing fast execution. LZW can compress the input stream in one single pass. After a reasonable string table is built, compression improves dramatically. Advantages of LZW over Huffman: LZW requires no prior information about the input data stream. LZW: Some Notes This algorithm compresses repetitive sequences of data well. Since the codewords are 12 bits, any single encoded character will expand the data size rather than reduce it. In this example, 72 bits are represented with 72 bits of data. Įxample 2: LZW Decompression Step 1 Old = 65 S = A New = 66 C = A ENCODER OUTPUT STRING TABLE string codeword stringBA 256 BAĮxample 2: LZW Decompression Step 2 Old = 256 S = BA New = 256 C = B ENCODER OUTPUT STRING TABLE string codeword stringBA 256 BA 257 ABBAĮxample 2: LZW Decompression Step 3 Old = 257 S = AB New = 257 C = A ENCODER OUTPUT STRING TABLE string codeword stringBA 256 BABA 257 AB 258 BAAABĮxample 2: LZW Decompression Step 4 Old = 65 S = A New = 65 C = A ENCODER OUTPUT STRING TABLE string codeword stringBA 256 BABA 257 AB 258 BAAAB 259 ABAAĮxample 2: LZW Decompression Step 5 Old = 260 S = AA New = 260 C = A ENCODER OUTPUT STRING TABLE string codeword stringBA 256 BABA 257 ABAB 258 BAAA 259 ABAAA 260 AA C to the string table14 OLD = NEW15 END WHILEĮxample 2: LZW Decompression 1Example 2: Use LZW to decompress the output sequence of Example 1.
