Partager via


2.2.2.5.1.2 RDP 6.0 RLE Segment (RDP6_RLE_SEGMENT)

The RDP6_RLE_SEGMENT structure encodes an RLE segment that contains a RAW and RUN component (section 3.1.9.2).


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

controlByte

rawValues (variable)

...

controlByte (1 byte): An 8-bit, unsigned integer. Contains the RAW and RUN components of an RDP 6.0 RLE segment (section 3.1.9.2). The controlByte field MUST contain a nonzero value.

The format of the controlByte field is described by the following bitmask diagram.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

nRunLength

cRawBytes

nRunLength (4 bits): A 4-bit, unsigned integer field. The number of times the last RAW byte in the rawValues field is repeated (known as the run-length).

Because a RUN MUST be a sequence of at least three values (section 3.1.9.2), the values 1 and 2 are used in the nRunLength field to encode extra long RUN sequences of more than 16 values:

  • If the nRunLength field is set to 1, the actual run-length is 16 plus the value in cRawBytes. On decode, the number of RAW bytes in the rawValues field is assumed to be zero. This gives a maximum run-length of 31 values.

  • If the nRunLength field is set to 2, the actual run-length is 32 plus the value in cRawBytes. On decode, the number of RAW bytes in the rawValues field is assumed to be zero. This gives a maximum run-length of 47 values.

cRawBytes (4 bits): A 4-bit, unsigned integer field. The number of RAW bytes in the rawValues field.

rawValues (variable): A variable-length field that contains the actual RAW bytes representing a portion of the color plane being encoded. If the bytes belong to the first scan line, they represent absolute values. Otherwise, the bytes represent delta values (section 3.1.9.2).