[XviD-devel] Hadamard Transform

Christoph Lampert xvid-devel@xvid.org
Fri, 6 Sep 2002 14:42:42 +0200 (CEST)


On 6 Sep 2002, skal wrote:
> > But here, since you calculate b+a anyway, and a-b, too, you need several
> > extra bits anyway if you want to keep precision. Not? 
> >
> 
> 	Take an example: a=1, b=126, on 8bit signed precision. [...]

Of _course_ there are lots of cases when it fails to calculate 2*b 
when trying to keep precision. But "mathematically" the risk to overflow
at 2*b isn't higher than at a+b. 
Since the task is to calculate a+b+c+d+e+f+g+h, which might be 
8*max(a,...,f) you need extra bits anyway, if you want to keep the result
exact. That's what I meant... And since you calc a-b, values might get
negative, too: again one more bit... 

That's why I meant, that 16bit has to be used. Put 8bit into it, do
calculations, get back 16bit representation of 2D Hadamard 
(actually 15 bit... 8+3+3+1signbit). 

Exact representation of results is not too important either, because we
will just need SAD/SSD between two hadamard transforms.

gruel