3.1.9.2.2 Extra Long RUN Sequences
The lengths of RAW and RUN components are limited to 4-bit values and, as a result, encoding of run-lengths greater than 15 values requires special casing, as described in section 2.2.2.5.1.2.
Encoding of an extra long RUN sequence is best described with an example. Assume that there is a pattern consisting of the letter A repeated 100 times. The resulting RLE segments are the following:
-
RAW [A]; RUN [15] - Segment 1 RAW [<none>]; RUN [47] - Segment 2 RAW [<none>]; RUN [37] - Segment 3
Using the structure and rules in section 2.2.2.5.1.2, these segments are encoded as the following:
-
controlByte: (1, 15); rawValues: A controlByte: (15, 2); rawValues: <none> controlByte: (5, 2); rawValues: <none>
In hexadecimal, this becomes the following:
-
0x1F, 0x41, 0xF2, 0x52