Re[2]: [XviD-devel] image interpolation question

Michael Militzer xvid-devel@xvid.org
Wed, 27 Nov 2002 16:45:14 +0100


Hi,

----- Original Message -----
From: "Radek 'sysKin' Czyz" <radoslaw@syskin.cjb.net>
To: <xvid-devel@xvid.org>
Sent: Wednesday, November 27, 2002 4:09 PM
Subject: Re[2]: [XviD-devel] image interpolation question


> > Our qpel lowpass filter accesses 6 pixels (-2, +3 around center iirc),
if
> > you interpolate the whole edged image, 2 pixels (left) and 3 pixels
(right)
> > are read from outside the allocated buffer (the same is true for top and
> > bottom), which makes XVID crash with an access violation. My fix for
this
> > problem was to double the edge size of our internal image buffer and
only
> > interpolate (and access) half the edged size. So when I commited this
fix,
> > encoding behaviour did not change at all (this was intended) and the
> > problems with crashes had been fixed (was also intended)...
>
> Sorry, maybe I didn't say it clear.
> I meant about the 'stride' value used to move from one block line
> (which is 8*edged_width) to another.
>
> You start at half of edge size. Then, you interpolate, in 8x8 blocks,
> until you stop at half of the other edge.
> Now, to move your pointer to another line of 8x8 blocks, you must:
> - move half edge to the real end of the line
> - move seven lines down (eighth line is already there)
> - move another half edge to your new start
>
> which sums to EDGE_SIZE + 7*edged_width
>
> but you do EDGE_SIZE2 + 7*edged_width
>
> and this is what I don't understand. In the first loop, it's ok.
>
> Please check, I really don't want to create buggy code (did too much
> of it already).

Ah sorry, now I understand: you mean that only the hv interpolation loop is
wrong? yes, it really looks like it. I don't know why there's +=
EDGE_SIZE2 - maybe one of those evil copy and paste mistakes - doh!

So it should be EDGE_SIZE of course, and it's also clear why this fix has an
impact on qpel filesize - sorry again, I should have looked closer at the
code before writing...

bye,
Michael