Oriented Run-Length Compression

Requires a Wolfram Notebook System
Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.
Run-length encoding splits data into runs of identical elements and stores just the length of each run with its first element. For run-length encoding of square arrays of binary data, it is sufficent to store the value repeated in the first run. In this Demonstration our data matrices are generated by evolutions of elementary cellular automata. The compressed run lengths are stored by a self-delimited ternary representation that stores each ternary digit as a pair of bits and ends each run specification by a pair of ones. The number of bits required to store generated data and compressed data are given as plot labels. Observe that some matrices compress better if they are transposed first. Note that the distinction between transposition or non-transposition of input requires one additional bit.
Contributed by: Michael Schreiber (March 2011)
Open content licensed under CC BY-NC-SA
Snapshots
Details
detailSectionParagraphPermanent Citation
"Oriented Run-Length Compression"
http://demonstrations.wolfram.com/OrientedRunLengthCompression/
Wolfram Demonstrations Project
Published: March 7 2011