[x264-devel] Re: x264_me_search_ref

Johannes Ballé johannes.balle at rwth-aachen.de
Tue Aug 8 09:29:48 CEST 2006


Am Dienstag, 8. August 2006 05:56 schrieb Loren Merritt:
> Pixels outside the frame are defined to be equal to the nearest pixel in
> the frame. x264 initializes a padding region of 32 pixels in each
> direction. If the search ends up in that border, then the SAD residual
> won't change any more, so the only factor that can cause the search to
> continue moving beyond the edge of the frame is if mvp points out there
> and thus creates a cost gradient in that direction.

True, I didn't consider that yesterday.

> mv_min_spel is in the padding region. So if the mv does end up near the
> clipped mvp, then we can set the mv equal to the non-clipped mvp and it
> will be just as good an mv, and the clipped cost will be correct. The only
> inaccuracy is if the final mv is far enough from mvp to be inside the
> frame (so we can't just change it), but close enough that the mv_cost
> gradient is non-negligible.
>
> Yes I tried it, and the difference in quality is too small to measure.

OK, but how much is the speed improvement?

I admit that this solution to avoid limit checking is somewhat appealing, but 
it's technically a hack ... that sort of thing usually gets you into trouble 
when you don't expect it. There must be a more elegant way? --

At least you ought to put some of your explanations from above into the source 
code, so it's more obvious to see what the assumptions are. As you might have 
noticed, it was slightly irritating for me to read ;)

> Because the difference in cost between mv-mvp=(N,N) and mv-mvp=(N+.5,N+.5)
> is up to 8 bits if N=0, but is small for other N.

OK, that makes sense, but it also merits a comment, I think ...

Hm, another thing, assigning the clipped mvp in quartel pel resolution to 
bm{x,y} in line 183f is somewhat misleading. It took me a while to figure out 
that it unconditionally gets overwritten by a full-pel mv before the actual 
searching takes place. For the sake of readability, you might want to change 
that.

-- 
Johannes Ballé
RWTH Aachen University
johannes.balle at rwth-aachen.de

-- 
This is the x264-devel mailing-list
To unsubscribe, go to: http://developers.videolan.org/lists.html



More information about the x264-devel mailing list