[XviD-devel] Rounding

Christoph Lampert xvid-devel@xvid.org
Tue, 29 Oct 2002 17:32:42 +0100 (CET)


On Tue, 29 Oct 2002, Christoph Lampert wrote:
> round_16th_to_half(int pos)
> {
>   int fullpel = pos & 0xFFFFFFF0;   // might be negative (-3 -> -16)
>   int pure_16th_pel = pos & 0x0000000F;  // always positive (-3 -> +13) 
> 
>   fullpel_to_halfpel = fullpel*2;

This line is of course bullsh*t... it should have been 

fullpel_to_halfpel = fullpel/8;  // no rounding needed 

because fullpel _is_ a fullpel position, but measured in 16th-pel units. 

gruel