Data Compression


Criteria

Survey Formats

Basics

Compression Methods

Data Formats


Run Length Encoding

General Principle

8 Bit RLE

Uncoded Data

Control Characters

RLE for Image Data

Implementations


Glossary

Index


Download


www.BinaryEssence.com

General Principle of RLE


Instead of the original data so-called runs will be stored. In the general form a run is a sequence of a certain length containing only one symbol. The length of the sequence is called run count and the symbol run value.


  original data: aaaabbc

  Run        "aaaa"  "bb"  "c"
  Run Count   4       2     1
  Run Value   a       b     c

  original data: aaaabbc
  RLE coded:     4a2b1c

In the ideal case this principle form of RLE could replace a sequence of 256 identical symbols by 2 Bytes presupposing a 1 Byte counter. In contrast this also applies for a single symbol so that the data volume would be doubled in the most unfavorable case.


Since a run count of 0 cannot occur with this form of coding, the counter can be decremented accordingly. Thus the maximum representable length of a run increases by 1.


 <   ^   > 

Run Length Encoding (RLE) Run Length Encoding (RLE) 8 Bit RLE