[XviD-devel] Rounding

Christoph Lampert xvid-devel@xvid.org
Wed, 30 Oct 2002 15:41:24 +0100 (CET)


Hi to all,

Since rounding seems to work now, the rest this discussion
is only for "the fun of it":

On Wed, 30 Oct 2002, Michael Militzer wrote:
> In normal halfpel mode, the chroma vector is calculated buy rounding down
> the luma motion vector using table 7-9 (to match the lower resolution of the
> subsampled u,v planes). The standard says that table 7-9 should we used in
> qpel mode to round the qpel vectors -> halfpel resoultion and then one
> should be proceed as in halfpel mode So this would mean: step 1: use table
> 7-9 and round luma qpel vector to halfpel precision, step 2: use table 7-9
> again and round halfpel luma vector to halfpel chroma vector. FDAM does this
> in one step using table 7-8...




> 
> > Later, just before the Tables 7-6 to 7-9 is a remark about chroma with
> > inter4v (K=4):
> > "Motion vector MVD_CHR for both chrominance blocks is derived by
> > calculating the sum of the K luminance blocks ... divide by 2*K ...
> > The component values of the resultung 16th/12th/8th/4th sample resolution
> > vectors are modified towards the nearest half sample position as indicated
> > below"
> > (and then there are the tables).
> 
> that's exactly the problem I talked about: One should think that having only
> 1MV, the chrominance MV is calculated using table 7-9 (and following
> subclause 7.6.2.2 this should be true regardless if we're in half- or
> quarter sample mode...)

One vector means K=1. So in Halfpel mode you divide the halfpel lumi 
vector by 2 (=2*K) and round the result using table 7-9. 
If QPel mode, you start with 1 qpel lumi vector, divide by 2 (=2*K) and 
of course use table 7-8 to round the resulting 8th-pel vector to halfpel.

The alternative is K=4, then 2*K=8, so you round using 
(sum of halfpels)/8 => 16th-pel ----table 7-6---> halfpel

or in quarterpel mode 
(sum of quarterpels)/8 => 32th-pel  *ooops* ??? 

maybe like this: Qpel vectors are _still_ measure in (non-integer) halfpel
units, so: 
(sum of (non-int)halfpels/8) ==> non-int 16th-pel ---table???--> halfpel


The more I think about it, the less logical it gets...

gruel