Data Compression


Criteria

Survey Formats

Basics

Compression Methods

Data Formats


Run Length Encoding

General Principle

Control Characters

RLE for Image Data

Implementations

MS-Windows .bmp RLE8

MS-Windows .bmp RLE4

Example "B"

"B" uncompressed


Glossary

Index


Download


www.BinaryEssence.com

Example "B" compressed according to RLE4



Encoded data:


 14.  0F 11  00 00
 13.  02 11  09 00  04 11  00 00
 12.  04 11  03 00  03 11  02 00  03 11  00 00
 11.  04 11  03 00  04 11  02 00  02 11  00 00
 10.  04 11  03 00  04 11  02 00  02 11  00 00
  9.  04 11  03 00  04 11  02 00  02 11  00 00
  8.  04 11  03 00  03 11  02 00  03 11  00 00
  7.  04 11  03 00  01 11  03 00  04 11  00 00
  6.  04 11  03 00  01 11  03 00  04 11  00 00
  5.  04 11  03 00  03 11  02 00  03 11  00 00
  4.  04 11  03 00  04 11  02 00  02 11  00 00
  3.  04 11  03 00  04 11  02 00  02 11  00 00
  2.  04 11  03 00  03 11  03 00  02 11  00 00
  1.  02 11  0A 00  03 11  00 00
  0.  0F 11  00 00  00 01

This example also matches the Microsoft conventions for bitmap coding (e.g. line order, word alignment).


In comparison to RLE8 this example does not profit from 4 bit encoding and only demonstrates the principle. The reason is the special architecture collecting two 4 bit pixels together. A clearly better compression would be achieved, if data consist of alternating pairs of pixels. Such a type of contents is generated by certain dithering algorithms used for colour reduction.


To encode the example above 162 byte are required which is exactly the same data volume as for RLE8, only a smaller colour table is used. The size of the data part of an uncompressed version is 120 Byte.


 <   ^   > 

MS-Windows .bmp RLE4 MS-Windows .bmp RLE4 Example B uncompressed with 16 colours