Note

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.

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.

Byte

#1

#2

#3

#4

#5

#6

#7

Number

 

 

 

 

 

 

 

Bits

01010101

01010101

01010101

01010101

01000001

01010100

01010100

ASCII

U

U

U

U

A

T

T

 

 

 

 

 

 

 

 

Unencoded

?*r1A

?*b0m7WUUUUATT ?*rC

EN

Raster Graphics 6-23

Page 143
Image 143
HP L 5 manual Examples Run-length and Tiff Compression, Unencoded