# [vorbis-dev] Tarkin at last

Lourens Veen jsr at dds.nl
Fri Jan 5 00:35:49 PST 2001

```
> Don't know about the Haar wavelet transform (though education would be
> very much appreciated), but tip is to check each calculation, and what
> the compiler could possibly do to mangle it. You will get errors if
> you exceed the float range on even one operation, even if you
> immediately bring it back down to within normalized range. You could
> try casting each number to a double within the calculation and casting
> the result back to float (though this is terribly
> inefficient). Multiplying by 9^(9^9) is generally not a good idea in
>
> --
> Kenneth Arnold <ken at arnoldnet.net> / kcarnold / Linux user #180115

Time for some auditing I guess, with a simple test file and a pocket
calculator :)

About Haar wavelets, they are very simple (in fact just about as simple
as wavelets get). In the 1D discrete case, let's say we have an array of
floats sized 2^n (my implementation can do any sized images btw, but
that's another story).

A Haar wavelet transform of this data is calculated in the following
manner:
for each two values in the array, replace the first with their average,
and the second with half their difference (ie a[0] = (a[0] + a[1]) / 2,
a[1] = (a[0] - a[1]) / 2, you obviously need some temp vars). You get
this: a1 d1 a2 d2 a3 d3 a4 d4. Then, move all the averages to the front
and the half differences to the back. Your array looks like this: a1 a2
a3 a4 d1 d2 d3 d4. Now repeat the process on the first half of the
array, and keep doing that until you only have one average left, in the
beginning.

If you know a bit more about wavelets, it's a DWT with filter kernel
[ 1  1 ]
[ 1 -1 ]

Lourens

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.

```