90 likes | 250 Views
LZW: Contribution of TERRY WELSH. Further improvement is to encode singles instead of pairs to transmit. We simply send an index, but first initialize the dictionary . UNIX compress, GIF , facsimile V.42 standard. LZW. wabba_wabba_wabba_wabba_woo_woo_woo.
E N D
LZW: Contribution of TERRY WELSH Further improvement is to encode singles instead of pairs to transmit We simply send an index, but first initialize the dictionary UNIX compress, GIF , facsimile V.42 standard
LZW wabba_wabba_wabba_wabba_woo_woo_woo Initialize the dictionary for all symbols in the alphabet Example: for the source A={ space ,a,b,o,w}, the initial dictionary
LZW • Each time you code the symbol/pattern that in the dictionary add a new pattern formed by concatenation of the existing symbol/pattern with the next symbol in the sequence.
wabba wabba wabba wabba woo woo woo Output:5 2 3 3 2 1 6 8 10 12 9 11 7 16 5 4 4 11 21 23 4
Decodehaving the initial table and adding new codewords following the same procedureas encoding
UNIX compress • LZW +adaptive dictionary size • The dictionary is progressively doubled as it fills up. • When the largest allowed dictionary fills up • If the compression ratio is less than threshold, delete the dictionary and start with a new dictionary • The dictionary always reflects the local characteristics of the source. • Otherwise, static-dictionary method.
UNIX- compress: Example • Start with 29=512 entries • The first 256 of them already filled up • When the dictionary is full, it is doubled 210 entries, then…. Up to 216 • If the compression ratio is less than threshold, delete the dictionary and start a new 512-entry dictionary
GIF (Graphics Interchange Format) • GIF is a graphics file format that uses a variant of LZW to compress the graphics data • The dictionary size is set initially to 2n+1 entries, where n is a number of bits per pixel in the original image. • If compression ratio is less than the threshold, the encoder sends the value 2n as the clear code to notify the decoder to discard the dictionary.
GIF • The dictionary is progressively doubled as it fills-up, until the maximum dictionary size of 212=4096 is reached • At this point the algorithm behaves as a static dictionary coding • The codewords stored in the blocks maximum 255 bits long. Each block has a header indicating the size of the block, and the terminator (eight zeros) afterwards.