[FFmpeg-devel] [PATCH] MMX implementation of VC-1 inverse transforms

Christophe GISQUET christophe.gisquet
Sat Jan 19 13:38:52 CET 2008


Michael Niedermayer a ?crit :
> i think, the following is safe
>
>         t1 = src[0] + src[2];
>         t2 = src[0] - src[2];
>         t1= 8*t1 + (t1>>1);
>         t2= 8*t2 + (t2>>1);
>
>         t3 = 11 * src[1] + 5 * src[3];
>         t4 = 11 * src[3] - 5 * src[1];
>
>         dst[0] = (t1 + t3 + 2) >> 2;
>         dst[1] = (t2 - t4 + 2) >> 2;
>         dst[2] = (t2 + t4 + 2) >> 2;
>         dst[3] = (t1 - t3 + 2) >> 2;

Of course, the bias would be merged with the (t[1,2]>>1).

> the spec requires dst>>4 to be within -512 .. 510
> so the triplet sums are limited to -32768 .. 32703
> hence the value prior to the >>2 fits in 16bit
> the values before the >>1 are also limited to +-8192 per spec so they
> are fine as well

I don't have the specs, and if you didn't guess them, I'd be interested
in them, because the dst>>7 in the 2nd stage seemed to need to be in
-127..128.

Best regards,
-- 
Christophe GISQUET




More information about the ffmpeg-devel mailing list