Difference between revisions of "RLEp"

From MSX Game Library

 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
The RLEp format is a variant of the RLE compression (Run-length encoding) with the particularity of having 2 bits reserved to encode a pattern type and 6 bits for its length.
+
The '''RLEp''' format is a variant of the RLE compression ([https://en.wikipedia.org/wiki/Run-length_encoding Run-length encoding]) with the particularity of having 2 bits reserved to encode a pattern type and 6 bits for its length (max length is 64 bytes per pattern).
  
 
Pattern types:
 
Pattern types:
 
{| class="wikitable"
 
{| class="wikitable"
! Val !! Name !! Desc.
+
! Val !! Name !! Min len !! Desc.
 
|-
 
|-
| <tt>[00¦len]</tt> || Default value || Repeat default value <tt>len</tt> times. The default value is either 0 or the first byte of the RLEp code.
+
| <tt>[00¦len]</tt>                 || Default value || 2 || Repeat default value <tt>len</tt> times. The default value is either 0 or the first byte of the RLEp code.
 
|-
 
|-
| <tt>[01¦len][value]</tt> || 1 byte || Repeat the next character <tt>len</tt> times.
+
| <tt>[01¦len][value]</tt>           || 1 byte       || 2 || Repeat the next character <tt>len</tt> times.
 
|-
 
|-
| <tt>[10¦len][value][value]</tt> || 2 bytes || Repeat the next two characters <tt>len</tt> times.
+
| <tt>[10¦len][value][value]</tt>   || 2 bytes       || 2 || Repeat the next two characters <tt>len</tt> times.
 
|-
 
|-
| <tt>[11¦len][value][value]...</tt> || Uncompress || Followed by a list of non-compressed bytes of size <tt>len</tt>.
+
| <tt>[11¦len][value][value]...</tt> || Uncompress   || 0 || Followed by a list of non-compressed bytes of size <tt>len</tt>.
 
|}
 
|}
 +
 +
The efficiency of RLEp encoding is highly data-dependent. Data with "holes" or repetitions, such as sprites, can have a very good compression ratio, whereas a bitmap image teeming with detail will have a very poor (or even negative) compression ratio.
  
 
[[Category:Format]]
 
[[Category:Format]]

Latest revision as of 00:11, 16 December 2023

The RLEp format is a variant of the RLE compression (Run-length encoding) with the particularity of having 2 bits reserved to encode a pattern type and 6 bits for its length (max length is 64 bytes per pattern).

Pattern types:

Val Name Min len Desc.
[00¦len] Default value 2 Repeat default value len times. The default value is either 0 or the first byte of the RLEp code.
[01¦len][value] 1 byte 2 Repeat the next character len times.
[10¦len][value][value] 2 bytes 2 Repeat the next two characters len times.
[11¦len][value][value]... Uncompress 0 Followed by a list of non-compressed bytes of size len.

The efficiency of RLEp encoding is highly data-dependent. Data with "holes" or repetitions, such as sprites, can have a very good compression ratio, whereas a bitmap image teeming with detail will have a very poor (or even negative) compression ratio.