RLE90 is a run-length encoding data compression scheme used in several file formats, either by itself, or as part of a more sophisticated compression scheme. It is only occasionally called RLE90, but its other names, such as "Packed" and "RLE", are hopelessly vague.
The format is simple, but is more stateful than most RLE schemes, and has edge cases that can lead to problems. It uses byte value 0x90 (decimal 144) as an escape code.
Read the next byte(s). Follow the instructions in the first row of this table that matches. Repeat.
||Emit one byte of value 0x90|
||Emit N2−1 (additional) copies of the "previous byte"|
||Emit one byte of value N1|
The term "previous byte" needs clarification when the previous bytes were the
0x90 0x00 escape code, or at the beginning of data where there was no previous byte. Some RLE90 variants handle these cases differently than others, by accident or design.