2006/05/31
CHAPTER 2 "PCL" - 82
•
# = 3 indicates that delta row compression is to be used. In this method byte sequences identify how each
raster row differs from the last row that was transmitted. The first byte identifies the number of consecutive
bytes (the value of the most significant 3 bits plus 1) to be changed and the position in the line at which to
start substituting the replacement bytes (the least significant 5 bits plus 1). Hence, if the command byte has a
3 in the top three bits and 10 in the bottom five bits, the 11th, 12th, 13th and 14th bytes of the last row will
be replaced by the four data bytes that follow.
If the least significant 5 bits are all 1, the next byte is treated as a further offset value and its value is added to
32 to calculate the offset. If this byte in turn is all ones the next byte is also treated as a continuation byte and
its value is added to the offset and so on until a byte whose value is not 255 is encountered.
This combination of command bytes and replacement bytes is used to specify all the differences between the
last raster row sent (the seed row) and the new row to be transmitted. When the new row has been sent it
becomes the new seed row.
• # = 5 indicates that adaptive compression is to be used.
This compression compresses multiple rows (a block) into one transfer graphics command.
Most other compression methods compress only one row to one transfer graphics command.
One transfer graphic command (ESC *b##W) can contain only up to 32,767 bytes.
As mode 5 compression compresses multiple rows, the amount of transferred data may become large.
If compressed data exceeds this limit, reduce the number of rows in the block.
We can use mode 0 to mode 3 compression to compress each row. We can even compress empty (white)
rows and duplicate rows with these compression methods.
•
Command byte
Mode 5 compressed data consists of multiple elements. Each element contains 3 header bytes at the
beginning.
The first byte of the header bytes is a command byte.
First byte Second, third byte
0 Unencoded
1 Run-length Encoding Number of bytes of data
2 TIFF
3 Delta Row compression
4 Empty Row Number of empty row or repetition
5 Duplicate Row
Command byte
0 - This element is an uncompressed row. The next two bytes contain the byte count of the uncompressed
data. Uncompressed data follows the header.
1 - This element identifies a compressed row. Compression method is mode 1. The next two bytes
(upper byte first) contain the byte count of the compressed data. Compressed data follows the header.
2 - This element identifies a compressed row. Compression method is mode 2. The next two bytes
(upper byte first) contain the byte count of the compressed data. Compressed data follows the header
3 - This element identifies a compressed row. Compression method is mode 3. The next two bytes
(upper byte first) contain the byte count of the compressed data. Compressed data follows the header
4 - This element identifies multiple empty rows. The next two bytes (upper byte first) contain the empty
row count.
5 - This element identifies duplicate rows. The next two bytes (upper byte first) contain the duplicate
row count.