[XviD-devel] new GMC, GME refinement
skal
skal at planet-d.net
Mon Apr 14 12:56:08 CEST 2003
Hi All,
On Sat, 2003-04-12 at 10:18, Christoph Lampert wrote:
>
> Hi,
>
> I just added Skal's GMC code to my local source tree (I don't have CVS
> access from here). It's nice an clean, thank you, Skal.
> Btw. @skal: there was a tiny bug in the code you sent (which took me two
> days to find): If GMC points to an address outside the VOP (left or top),
> you set the offset to 0. That should be -1 or -stride, because everything
> outside must be the edge pixel, including the value at "Offset+1"
> This is not visible when decoding with the same code, but ffmpeg showed
> smearing errors.
oops, sorry about that bug :(
Actually, I had this pitfall in mind when I wrote the function
but the code is buggy: in fact the residual multipliers
'ri' and 'rj' are initialized by default to '16', whereas
it should be '16<<16', so that the leftmost sample (offset+0)
is weighted full (16) and the rightmost one (offset+1)
unweighted. I don't know how you corrected it exactly but the
fix should be 'ri=16<<16; rj=16<16' at lines 128,132,194 and 203
of the original code.
Now, thinking of it there's another bug in the 1warp-point
clipping interpolation. I forgot the case where the
block stands across the edge boundary, but not fully
inside the (replicated edges). The code for setting up
the clipping should be:
if ((uint32_t)vo<=(uint32_t)H) Offset = (vo>>4)*stride;
else if (vo>H) Offset = ( H>>4)*stride;
else if (vo<=-16) Offset =-16*stride;
else Offset = (vo>>4)*stride;
if ((uint32_t)uo<=(uint32_t)W) Offset += (uo>>4);
else if (uo>W) Offset += ( W>>4);
else if (uo<=-16) Offset -= 16;
else Offset += (uo>>4);
for the 16x16 luma pred, and:
int32_t Offset;
if ((uint32_t)vo<=(uint32_t)H) Offset = (vo>>4)*stride;
else if (vo>H) Offset = ( H>>4)*stride;
else if (vo<=-8) Offset =-8*stride;
else Offset = (vo>>4)*stride;
if ((uint32_t)uo<=(uint32_t)W) Offset += (uo>>4);
else if (uo>W) Offset += ( W>>4);
else if (uo<=-8) Offset -= 8;
else Offset += (uo>>4);
for the 8x8 chroma one.
Note that for the 2-3 warp-point interpolation
there's few FPS to be gained by branching to a
non-clipping inner loop whenever the whole
block lies inside the picture without crossing
the edges. Then for the clipped version, making
special cases for left/right/top/bottom clipping
grasps some more ticks here and there, but nothing
magical. I'll have a look when you commit your
GMC code...
For the 2-warp-pts constants setup problem, it seems
ok to me. I'll cross-check the calculation in the
ISO.
bye!
Skal
More information about the XviD-devel
mailing list