[x265] [PATCH 2 of 2] fix output non-determination bug

Steve Borho steve at borho.org
Wed Jul 30 02:29:34 CEST 2014


On 07/29, Min Chen wrote:
> # HG changeset patch
> # User Min Chen <chenm003 at 163.com>
> # Date 1406685408 25200
> # Node ID 12447b84490ca4f5c3dd106599d535edd09a963c
> # Parent  9fbda07104f6e7c03c608320a6b88ed877074e25
> fix output non-determination bug
> 
> diff -r 9fbda07104f6 -r 12447b84490c source/Lib/TLibEncoder/TEncSearch.cpp
> --- a/source/Lib/TLibEncoder/TEncSearch.cpp	Tue Jul 29 18:55:33 2014 -0700
> +++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Tue Jul 29 18:56:48 2014 -0700
> @@ -1970,12 +1970,17 @@
>                  // Pick the best possible MVP from AMVP candidates based on least residual
>                  uint32_t bestCost = MAX_INT;
>                  int mvpIdx = 0;
> +                int merange = m_param->searchRange;
>  
>                  for (int i = 0; i < amvpInfo[l][ref].m_num; i++)
>                  {
>                      MV mvCand = amvpInfo[l][ref].m_mvCand[i];
>  
> -                    // TODO: skip mvCand if Y is > merange and -FN>1
> +                    // NOTE: skip mvCand if Y is > merange and -FN>1
> +                    if (m_bFrameParallel && (mvCand.y >= (merange + 1) * 4))
> +                    {
> +                        continue;
> +                    }

nit: our coding style is to leave off braces for single line expressions

I guess if both are out of range we will take mvpIdx=0 by default, which
should be ok since ME will respect the clipped mvmin/mvmax region and
return an MV within range.

This is what we get for leaving a TODO like that in such an important
function. Nice catch!

-- 
Steve Borho


More information about the x265-devel mailing list