Image Compression

In the evenings he would feast on ancient books to the lazy enchanting lap of wavelets ...

from Vladimir Nabakov's Invitation to a Beheading

Heavily updated in May and June of 1998.




Finished Sept. 1999, finally released October, 2004 !! (300k zip). Full source + exe + crblib so it stands alone. Compile with MSVC6. Uses DirectDraw 4.

The highlight of WaveVideo is a very fast full-frame Wavelet image decoder. See also this article - Wavelet Video notes

NOTEZ : the compiled version uses the D97/C22 transform ; for speed, make sure you use the C22/Haar transform set.

Also, I do silly things like ftoi() that are not needed and can be way faster with SSE2. The true speed of the algorithm is probably well beyond the experimental numbers.

excerpt from the readme :

Basically WaveVideo works in-place on an image.  It is a full-image wavelet transform,
it is not block-based at all.  It is also a true Wavelet transform (CDF22 and Daubechies 9/7
are supported), not just a trivial Haar wavelet.

The decode works with a few circular row buffers.  The size of the buffers needed depends on
the span of the transform; eg. Haar needs 2 row, CDF22 needs 3 rows, D97 needs 7 rows.

Very good speed can be acheived with a horizontal CDF22 transform and a vertical Haar transform.

I've got some nice hand-written diagrams of the memory flow, but nothing digitial.

Basically you first decode the wavelet coefficients for the needed rows into the temp LH,HL,HH
bands.  You have the previous LL band already.  You never actually decode the full image, you
decode rows as you need them.  Then you do the horizontal inverse transform on the LL+LH and
the HL+HH to make a L and H temp vertical rows; you build these into temp circular row buffers
until you have enough to do inverse vertical transforms, and then you do that into the output

Each level of wavelet inverse transform works like this :

[coded stream] -> Coefficient decoder -> [wavelet coefficients for LH,HL,HH bands in temp buffers]
	[previously decoded LL band] + [wavelet coefficients for LH,HL,HH bands] ->
		horizontal inverse transform -> [temp L and H vertical rows] ->
		vertical inverse transform -> [decoded image rows]

the decoded rows are thus streamed out in order.  So, we are streaming in the coded bits and
the previous LL band, and streaming out a decoded image.

On the final level, we also do a YUV->RGB transform (the coded stream is in YUV).


DCT Based

We've got a nice family of DCT coders for you. All use a DCT Transform shamelessly stolen from the Independent JPEG Group (and simplified, and consolidated). We beat JPEG in a measure of MSE (mean-squared-error) or PSNR (= 20*log(256/rmse)) but that's no surprise since jpeg is meant for *visual* quality, not MSE quality; in fact Arith-Coded JPEG with flat quantizers is quite competitive with the state of the art wavelet coders.