Code Poetry
and Text Adventures

by catid posted (>30 days ago) 7:58pm Thu. Mar 21st 2013 PDT
BCIF initially does spatial filtering on each color plane, and then it does color filtering.

After that it uses a small number of static Huffman tables, each one selected per-pixel based on the pixel context.

There are a few things left out of BCIF that leave room for improvement.

(1) The Huffman decoder they implement is inefficient, leaving room for better compression at the same speed if it is improved...

(2) It doesn't use LZ codes.  LZ decoding is very fast.  It should possible to work a fast static Huffman codec into the fast LZ4 codec. ++compressionRatio;

(3) BCIF does not support alpha channel.  I don't need full 8-bit alpha intensity, just 1-bit alpha.  Furthermore since fully transparent pixels do not need color data, the corresponding RGB values do not need to be transmitted. ++compressionRatio;


I'm most of the way through implementing a demo that compresses and decompresses the 1-bit alpha channel only.  I found a decent set of prediction filters to model the data which outperforms the alpha channel compression of PNG about 5x over on average.  1024x1024 sprite sheet alpha data fits into 5435 bytes : 4.14% of the full data size.  This is with sprites with mainly square outlines, which compress better.  On character animation sprites, it tends to compress to about 15% of the original data size.  It seems somewhat decent and fast.

This is going to be an article series on http://gameclosure.com/blog/ when it gets demo-worthy.
last edit by catid edited (>30 days ago) 8:01pm Thu. Mar 21st 2013 PDT