[FFmpeg-devel] [PATCH] vp9: fix mvref finding to adhere to bug in libvpx

Jim Bankoski jimbankoski at google.com
Mon Nov 11 20:24:36 CET 2013

>  do { \
>    if ((CANDIDATE)->ref_frame[0] != ref_frame) \
>      ADD_MV_REF_LIST(scale_mv((CANDIDATE), 0, ref_frame, ref_sign_bias));
>    if ((CANDIDATE)->ref_frame[1] != ref_frame && \
>        has_second_ref(CANDIDATE) && \
>        (CANDIDATE)->mv[1].as_int != (CANDIDATE)->mv[0].as_int) \
>      ADD_MV_REF_LIST(scale_mv((CANDIDATE), 1, ref_frame, ref_sign_bias));
>  } while (0)

> Note that for the second ref, we do the MV compare _before_ scaling
(there's several other things > wrong here; it looks like a premature
optimization - the last condition shouldn't have been there at
> all). Thus this is a bug in libvpx, or at this point yet another
bitstream bug. Thanks for finding it.

The bitstream's not changing to change this agreeably odd behavior.   When
I rewrote this to the current code I tried to do what you did and eliminate
the second prescaled comparison as it seems the natural thing to do.  I
agree its unfortunate.

We tested the impact on the quality and it was so minimal a change we
didn't think it worth the pain on the hw side..

As a result I believe you should make the patch you proposed in ffvp9.

More information about the ffmpeg-devel mailing list