6.9.3.4.3 Run Length Encoded (RLE) Format
8-bit index |
Initialization data compressed using run length encoding |
The data following the 8-bit index is compressed using Run Length Encoded (RLE) format. uses a simple run length encoding that can be decompressed using the following algorithm:
- Read the first byte, Delimiter (D).
- Read the next byte (B).
- If B != D, copy B to the output buffer and go to step 2.
- Read the next byte (L).
- If L == 0, then length is either a 16-bit, a 24-bit value, or we’ve reached the end of the data, read next byte (L).
- If L == 0, length is a 24-bit value or the end of the data is reached, read next byte (L).
- If L == 0, the end of the data is reached, go to step 7.
- Else L <<= 16, read next two bytes into lower 16 bits of L to complete 24-bit value for L.
- Else L <<= 8, read next byte into lower 8 bits of L to complete 16-bit value for L.
- Else if L > 0 and L < 4, copy D to the output buffer L times. Go to step 2.
- Else, length is 8-bit value (L).
- Read the next byte (C); C is the repeat character.
- Write C to the output buffer L times; go to step 2.
- End of processing.
The run-time support library has a routine __TI_decompress_rle24() to decompress data compressed using RLE. The first argument to this function is the address pointing to the byte after the 8-bit index. The second argument is the run address from the C auto initialization record.
NOTE
RLE Decompression Routine
The previous decompression routine, __TI_decompress_rle(), is included in the run-time-support library for decompressing RLE encodings generated by older versions of the linker.