The command byte itself has three parts:
Control Bit
Offset Count
Replacement Count
Control Bit. Determines whether the replacement data is compressed, and also the bit boundaries of the command byte’s other two fields.
Offset Count. The left offset (number of bytes) the replacement data is offset from the current byte position in the seed row.
Replacement Count. The number of consecutive bytes to be replaced. One more byte than the replacement count is replaced (for example, 6 bytes are replaced by a replacement count of 5).
Like compression method 3, the “current” byte follows the last replacement byte; at the beginning of a row, the current byte immediately follows left raster margin. An offset of 0 indicates the current byte; an offset of 1 indicates the byte following the current byte.
The size of the offset count and replacement count fields depends on the value of the control bit.
CONTROL BIT = 0
7 | 6 | 3 | 2 | 0 |
Control Bit = 0 |
| Offset Count | Replacement Count |
If the control bit is 0, the replacement data is uncompressed. If the control bit is 0, bits
If the offset count is 15, an additional offset count byte follows and is added to the total offset count. If the offset count byte is 255, another offset count byte follows. The last offset count byte is indicated by a value less than 255.
If the replacement count is 7, an additional replacement count byte follows and is added to the total replacement