Professional Documents
Culture Documents
LZ77
LZ78
LZW
Applications include:
Unix “compress”
V. 42 bis
Graphics Interchange Format (GIF)
Tape/ disc drives
ARC, PKARC, PKZIP, LHArc, ARJ
Digram coding
The dictionary consists of all letters of the source alphabet
followed by as many pairs of letters, called digrams, as can
be accommodated by the dictionary
Example
Assume the alphabet A {a, b, c, d , r}. Code the
sequence abracadabra based on the dictionary:
pointer o 7
c a b r a c a d a brarr arrad
l 4
abracad
Search buffer Look-ahead
buffer
...cabracadabrarrarrad ...
size of search buffer = 7 letters
size of look-ahead buffer = 6 letters
assume that the 7 leading letters have been encoded
0,0, c( d )
7,4, c( r )
3,5, c( d )
END
Example (continued)
0,0,c ( d )
cabraca abracad
7,4,c ( r )
abracad ad abrar
3,5,c ( d )
ad abrar
Variations of the LZ77scheme
a b c d e f g hi a b c d e f g hi a b c d e f g hi
search buffer look-ahead buffer
For arbitrary j ,
LZ ( X ) log 2 log 2 n
H j (X ) cj ,
n log 2 n
The coder:
- sends code for Kw
- inserts KwK in the dictionary
- Sends the code for KwK and …
The decoder:
- On receiving the code for KwK will not yet
have added that code to the dictionary since it
does not yet know the last character to add to the
previously received string
Applications of LZW coding
Unix “compress”
9 16
- Adaptive dictionary size; 2 2 entries
- Codewords increase in length as dictionary size
increases
- When dictionary reaches maximum size:
o It performs static coding
o It monitors the compression ratio and
flashes dictionary if compression ratio
drops below a threshold
Graphics Interchange Format _GIF_
- Developed by Compuserve Information Service
- An implementation of LZW similar to “compress “
- “Unclear” future due to patent hold by Unisys for
LZW
- Works well with computer generated images
- It is an unfortunate choice for continuous tone
images
Compression over modems; V.42 bis
- Consultative Committee on International
Telephone and Telegraph CCITT
Recommendation V.42
- Operates in two modes:
Transparent mode
No compression; used when sequence does
not contain repeating patterns (usually
previously compressed files)
Compressed mode
LZW algorithm; forbids the transmission of
an entry immediately after its insertion into the dictionary
- Recommends periodic testing to detect if data
expansion takes place; does not specify the test