[XviD-devel] Hadamard Transform
skal
xvid-devel@xvid.org
06 Sep 2002 12:55:22 +0200
Gruel,
On Fri, 2002-09-06 at 13:09, Christoph Lampert wrote:
> On 6 Sep 2002, pascal massimino wrote:
> > Arg.. you shouldn't be teasing me. I failed miserably in
> > the trap :)
> > Here are some Hadamard stuff. I let you imagine what
> > the ASM version (or 8bits) would look like :)
>
> #define BUTF(a, b, tmp) \
> (tmp) = (a)+(b); \
> (a) = (a)-(b); \
> (b) = (tmp)
>
>
> If I'm not wrong, you can do (a,b) -> (a-b,a+b) operation (and
> every permutation, sign change etc.) without temp storage
> doing:
>
> 1 -= 2 2 += 2 2 += 1
> (a, b) -----> (a-b ,b) -----> (a-b, 2*b) -----> (a-b, b+a)
>
> I don't know if this is faster (extra operation?), but it
> might help not needing a 9th register.
Indeed, it could apply here, but that's not a good
trick when precision is at stake. The *2 operation
will spoil (precious) 1bit of precision. Ok, for
Hadamard, it's useless, but for DCT, e.g, where room
for fractional bits is very tight, it can ruin
the scheme. It should not be tried first, actually.
Only on the late late stage of optimization, if it
leads to better re-ordering...
bye,
Skal
>