Runtime Length Encoding (RLE)

Hi guys on this page we will be looking at Runtime Length Encoding. 


 Runtime Length Encoding is a basic form of data compression that converts consecutive identical values into a code consisting of the character and the number marking the length of the run. The more similar values there are, the more values can be compressed. RLE provides a very good compression ratio when working with long runs of a particular charater or value. For example a black and white image, where there are long runs of either black or white, would encode very well.


This is an example of RLE when being used with a random set of characters,  Runtitme length encoding is at its most useful when used with images and film.Image result for runtime length encodingHere we have an outcome of: 8 A's 6 B's and 2 C's, we have gone from using 16 bytes to 6 bytes when encoded. 

Don't use RLE with text!

 RLE does not work quite as well with normal text for example.

H E L L O  W O R L D 

becomes encoded as: H1 E1 L3 O2 R1 D1. So in this instance we have used 12 bytes as upposed to the original 10 bytes used.