The Blues Brothers RLE compression

From ModdingWiki
Jump to navigation Jump to search

The Blues Brothers RLE compression is a variant of RLE Compression. If the control byte is non-negative (0-127), it loads the same number of bytes + 1 (no compression). If the control byte is negative (128-255) / ((-128)-(-1)), it repeats the next byte as many times as the negative number + 1.

Pseudocode:

1.) Stop if output size is 0x7D00
2.) Get a byte
3.) Is the value of this byte larger than 127? (0x80-0xFF - signed byte)
    -> If yes, then:
       -> Output the next byte [256 - Value + 1] times
       -> Move forward a byte and go to 1
    -> If no then:
       -> Output the next [Value + 1] bytes
       -> Move forward a byte and go to 1