Unit32_LZW - Lempel-Ziv-Welch )LZW( Compression Algorithm...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Lempel-Ziv-Welch )LZW( Compression Algorithm Introduction to the LZW Algorithm LZW Encoding Algorithm LZW Decoding Algorithm LZW Limitations
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
LZW Encoding Algorithm If the message to be encoded consists of only one character, LZW outputs the code for this character; otherwise it inserts two- or multi-character, overlapping *, distinct patterns of the message to be encoded in a Dictionary. *The last character of a pattern is the first character of the next pattern. The patterns are of the form: C 0 C 1 . . . C n-1 C n . The prefix of a pattern consists of all the pattern characters except the last: C 0 C 1 . . . C n-1 LZW output if the message consists of more than one character: If the pattern is not the last one; output: The code for its prefix. If the pattern is the last one: if the last pattern exists in the Dictionary; output: The code for the pattern. If the last pattern does not exist in the Dictionary; output: code)lastPrefix( then output: code)lastCharacter( Note: LZW outputs codewords that are 12-bits each. Since there are 2 12 = 4096 codeword possibilities, the minimum size of the Dictionary is 4096; however since the Dictionary is usually implemented as a hash table its size is larger than 4096.
Background image of page 2
)LZW Encoding Algorithm )cont‘d Initialize Dictionary with 256 single character strings and their corresponding ASCII codes; Prefix first input character; CodeWord 256; while(not end of character stream){ Char next input character; if(
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/03/2011 for the course CSE 473 taught by Professor Unknown during the Spring '11 term at Birla Institute of Technology & Science, Pilani - Hyderabad.

Page1 / 12

Unit32_LZW - Lempel-Ziv-Welch )LZW( Compression Algorithm...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online