HP PCL/PJL reference (PCL 5 Color) - Technical Reference Manual

EN Raster Graphics 6-23
Note Another method to calculate the number needed in the control byte
for some number of repetitions is to subtract the number of desired
repetitions from 256. For example, the control value for 3 repetitions
(4 occurrences) of a byte is 256 minus 3 = 253.
A zero or positive value in the control byte means that the subsequent
byte or bytes are non-replicated bytes of data. The value of the
control byte plus one indicates the number of data bytes that follow.
For example, a control byte of 0 means the following 1 byte is literal
raster data. A control byte of 6 indicates that the following 7 bytes are
literal raster data bytes.
TIFF encoding also allows you to include a non-operative (NOP)
control byte, represented by the value -128. This byte is ignored, and
the subsequent byte is treated as the new control byte.
Note It is more efficient to code two consecutive identical bytes as a
repeated byte. If these bytes are preceded and followed by literal
bytes, however, it is more efficient to code the entire group as literal
bytes.
Examples: Run-length and TIFF Compression
The following examples show how a raster row can be coded using
run-length and TIFF compression methods. Note that the
compression examples use characters to represent the binary data
stream.
Unencoded
?*r1A
?*b0m7WUUUUATT
?*rC
Byte
Number
#1 #2 #3 #4 #5 #6 #7
Bits 01010101 01010101 01010101 01010101 01000001 01010100 01010100
ASCIIUUUUATT