SECTION 3.3
73
Filters
TABLE 3.6 Typical LZW encoding sequence
INPUT
SEQUENCE
OUTPUT
CODE
CODE ADDED
TO TABLE
SEQUENCE REPRESENTED
BY NEW CODE
45
45 45
45 45
65
45 45 45
66
256 (clear-table)
45
258
258
65
259
66
257 (EOD)
258
259
260
261
262
45 45
45 45 45
45 45 65
65 45
45 45 45 66
Codes are packed into a continuous bit stream, high-order bit first. This stream is
then divided into 8-bit bytes, high-order bit first. Thus, codes can straddle byte
boundaries arbitrarily. After the EOD marker (code value 257), any leftover bits
in the final byte are set to 0.
In the example above, all the output codes are 9 bits long; they would pack into
bytes as follows (represented in hexadecimal):
80 0B 60 50 22 0C 0C 85 01
To adapt to changing input sequences, the encoder may at any point issue a clear-
table code, which causes both the encoder and the decoder to restart with initial
tables and a 9-bit code length. By convention, the encoder begins by issuing a
clear-table code. It must issue a clear-table code when the table becomes full; it
may do so sooner.
LZWDecode and FlateDecode Parameters
The
LZWDecode
and
FlateDecode
filters accept optional parameters to control
the decoding process. Most of these parameters are related to techniques that
reduce the size of compressed sampled images (rectangular arrays of color values,
described in Section 4.8, “Images”). For example, image data typically changes
very little from sample to sample. Therefore, subtracting the values of adjacent
Index Bookmark Pages Text
Previous Next
Pages: Index All Pages
This HTML file was created by VeryPDF PDF to HTML Converter product.