J schrieb:
I need to implement the simple integer 5/3 wavelet, but need a little
help
with code.
My understanding till now is that a 5/3 wavelet basically boils down to
following operations,
For even pixels, perform a prediction using a predictor based on average
of
left and right pixels. For odd pixels, add half of average of errors at
left
and right pixels. And then performing same operations in vertical
direction.
Is this correct?
Yes.
All the wavelet implementations I have found implement some kind of
generalised wavelet calculation method which makes it hard (for me) to
figure out how these operations are performed.
The above implementation is the "lifting" implementation of a wavelet.
You can also run a "convolution" implementation which computes the
output directly by convoluting the input with the wavelet filter. Both
methods are equivalent, the lifting method has, however, a higher
performance.
I am looking for clues which can either help me understand the available
wavelet code, or get me started on writing my own code.
Get Sweldens paper "Building your own wavelets at home", for example
from here:
http://www.math.tu-berlin.de/~thor/imco/
How can both the horizontal and vertical transforms be implemented in a
single pass, without 'looking ahead'? Is this even possible (or
required)?
Well, depends on what you call "a single pass". One can build an
"incremental" wavelet computation that requires only a minimal amount of
samples buffered. That's found for example in Taubman's book ("JPEG2000
w. CD-ROM: Image Compression Fundamentals, Standards and Practice
(Kluwer International Series in Engineering & Computer Science)").
While decompression we will only get decompressed pixels in raster-scan
order, so how will looking ahead work then?
By buffering enough samples. The idea is pretty simple: Obviously one
needs the neighbouring pixels for a single lifting step, thus you need
to have those pixels buffered to perform the step. Which means that for
each lifting step, the output has to be deferred by one sample: The
current, the next and the previous sample must be available to update
the current sample.
I only want to perform 1-level transform, but can multiple level
transforms
be done in a single pass?
In principle, yes. The relation between the output of a n-level
transform and its input is of course given by a convolution filter plus
suitable downsampling, so it can be done in principle. However, the
filters you get this way are pretty long, and a direct n-step
implementation is slower than lifting for n times.
Greetings,
Thomas