[XviD-devel] Rounding
Michael Militzer
xvid-devel@xvid.org
Tue, 29 Oct 2002 22:28:20 +0100
Hi,
> In general a shift + add seems ok using Skal's modified tables, so for
> example:
sorry, OR seems correct for the quarter->halfpel case, so it should be:
// Table 7-6 (K=4) (modified)
const int SKL_MB::Rnd_Tab_76[16] = { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
0, 1, 1 };
// Table 7-8 (K=2) (modified)
const int SKL_MB::Rnd_Tab_78[ 8] = { 0, 0, 1, 1, 0, 0, 0, 1 };
// Table 7-9 (K=1) (modified)
const int SKL_MB::Rnd_Tab_79[ 4] = { 0, 1, 1, 1 };
x = (x>>3) + Rnd_Tab_76[x & 0xF]; for rounding from 16th pel -> halfpel
x = (x>>2) + Rnd_Tab_78[x & 0x7]; for rounding from 8th pel -> halfpel
x = (x>>1) | Rnd_Tab_79[x & 0x3]; for rounding from quarterpel -> halfpel
bye,
Michael