How to Use This Site

Quick Navigation

Start Compressing

Input & Options

Annotated animation page

Enter your data on the input page and choose which compression algorithm to animate.

Adjust parameters as needed:

Algorithm selection buttons
  • Wordsize: The size of the compression chunks. (For BBC, it's always 8.)
  • Segments: The size of sections being compressed, only changeable for VAL (it divides the word into multiple parts).

Terms to Know

Run

A sequence of identical bits

1111 or 0000

Literal

A word that directly stores bits without compression

Dirty Bit

Bits that stop a run from happening

00100000 (1 is the dirty bit)

Stepping Through Animations

Animation demonstration
  • Next Step: Jumps from the start of a run to its final compressed word
  • Micro Step: Moves through each word in the run
  • Back Step: Takes one step back, or steps back to the first run of the current word
  • Reset: Goes back to the beginning of the compression

Using the Diff Checker

The Diff Checker helps you verify if your compression implementation is working correctly by comparing your output with the expected results.

Diff Checker demonstration

How it works:

  • Preform Compression: Toggle this depending on if you want the program to only compare an expected compression, or to also compress.
  • Your Compression: Paste the compressed bitstring from your program's output.
  • Uncompressed Data: This is where your uncompressed bitmap goes. (Or Expected Compression, if you don't have preform compression selected.)
  • Comparison Process:
    1. Click "Compare" to see a line-by-line diff below the input boxes
    2. Click any different line to highlight specific word differences
    3. View detailed word-by-word differences in a scrollable comparison box
    4. Click individual words to see a bit-by-bit breakdown of differences

Other Features

  • Transpose: This button will transpose the uncompressed data.
  • Choose File: Select custom input files
  • Download Compressed file: This will preform the selected compression and immediatly download the compressed result.

Compression Algorithms

Word-Aligned Hybrid (WAH)

WAH compression works by encoding sequences of bits in two ways:

  • As runs of identical bits (compressed words).
  • As literal values (uncompressed words).
Key Points:
  • For word size 8, encodes runs or literals of 7 bits (always one less than word size).
  • Uses 1-2 header bits to indicate word type.
  • For runs:
    • First bit 1 = run, second bit determines if run is 1's (1) or 0's (0).
    • The bits following the header indicate the number of runs.
    • If there are more runs than we can indicate, a new compression word is started.
  • For literals: First bit 0, remaining bits store actual data.

Example (WAH 8 Compression)

Uncompressed Data:
1010101 1111111 1111111 1111111 [65 runs of zeros] 1010101
Compressed Result:
01010101 11000011 10111111 10000011 01010101

This example demonstrates WAH compression with:

  • Literal values at the start and end
  • A run of ones (3 words)
  • A long run of zeros (65 words)

Byte-aligned Bitmap Compression (BBC)

BBC focuses on compressing runs of zero bits. It can store runs of various lengths and also handles “dirty bits” to indicate small interruptions in zero runs. If more runs or literals need encoding, additional header bytes are used. BBC is only avalible in wordsize 8, where it compresses runs and literals of 8 bits, in compression words which are also 8 bits.

Key Points:
  • Only runs of zeroes are compressed.
  • Up to 7 runs stored via an initial 3-bit field (e.g., 111 for run header).
  • A 4th bit determines if the next 4 bits track a dirty bit or the number of literal bytes following the run.
  • Long runs may span multiple compressed words if they exceed capacity (e.g., over 128 runs).
    • 1 to 6 runs: Encoded directly in the first 3 bits.
    • 7 to 126 runs: First 3 bits "111", the next bytes first bit is "0", followed by 7 bits for run length.
    • 127 to 32767 runs: First 3 bits "111", the next bytes first bit is "1", followed by 15 bits for run length.

Example (BBC 8 Compression)

Uncompressed Data:
00000000 00000000 01000000 [4 runs of zeros] 10000000 10101010 [13 runs of zeros] 10101010 [130 runs of zeros] 10101010 10101010
Compressed Result:
01010001 10000010 10000000 10101010 11100001 00001101 10101010 11100010 10000000 10000010 10101010 10101010

This example demonstrates BBC compression with:

  • A 2-byte run with a dirty bit
  • Multiple zero runs of varying lengths (4, 13, and 130 runs)
  • Literal values between runs

Position List Word-Aligned Hybrid (PLWAH)

PLWAH works very similarly to WAH, but reserves bits to encode dirty bit positions. For runs of identical bits, the first two bits behave like WAH’s run indicators, while the next 5 bits track the dirty bit location. The following bits state the number of runs.

Example (PLWAH 16 Compression)

Uncompressed Data:
101000000000000 000000000000000 000000000000000 000000000000000 100000000000000
Compressed Result:
0101000000000000 1000010000000011

This demonstration shows a literal word, followed by runs ending on a dirty bit.

Variable Aligned Length (VAL)

VAL builds on WAH but breaks each word into multiple segments. For a 16-bit word with 2 segments, compression is done in 7-bit chunks. The first bit indicates whether each segment is a run or a literal. If a segment is a run, its first bit shows whether it’s a run of ones or zeros, with the remainder tracking the count.

Example (VAL 16, 2 Segments)

Uncompressed Data:
1010101 1111111 1111111 0000000 0000000 1010101
Compressed Result:
0110101011000010 1000000101010101

This sequence presents a literal segment followed by a run, then another run ending in a literal.

Ready to Start?

Head over to the Animation page to try it yourself! Experiment with different inputs, test various algorithms, and see how bitmap compression works in real-time. The best way to learn is by doing - try entering your own bit patterns and watch how they get compressed.