2.1 Run Length Encoding (RLE)

Run-length Encoding, or RLE is a technique used to reduce the size of a repeating string of characters. This repeating string is called a run, typically RLE encodes a run of symbols into two bytes , a count and a symbol. RLE can compress any type of data regardless of its information content, but the content of data to be compressed affects the compression ratio. RLE cannot acheive high compression ratios compared to other compression methods, but it is easy to implement and is quick to execute. Run-length encoding is supported by most bitmap file formats such as TIFF, BMP and PCX.

Compression is normally measured with the compression ratio :

 Compression Ratio = original size / compressed size : 1

Consider a character run of 15 'A' characters which normally would require 15 bytes to store : 

 AAAAAAAAAAAAAAA

 15A

With RLE, this would only require two bytes to store, the count (15) is stored as the first byte and the symbol (A) as the second byte.

continue.......


 Previous Section

 Home

 Next Page