[x265] [PATCH] search: remove the merge candidates from the motion candidate list

Steve Borho steve at borho.org
Wed Apr 29 20:43:03 CEST 2015


On 04/29, gopu at multicorewareinc.com wrote:
> # HG changeset patch
> # User Gopu Govindaswamy <gopu at multicorewareinc.com>
> # Date 1430306233 -19800
> #      Wed Apr 29 16:47:13 2015 +0530
> # Node ID 89fc8d7c42673ceab56c06052f3e3f3e814930a0
> # Parent  cc6da5218a188ded2d239bb8dbf6c3399978c93f
> search: remove the merge candidates from the motion candidate list

these are AMVP candidates, not merge candidates

> diff -r cc6da5218a18 -r 89fc8d7c4267 source/common/cudata.cpp
> --- a/source/common/cudata.cpp	Wed Apr 29 13:13:30 2015 +0530
> +++ b/source/common/cudata.cpp	Wed Apr 29 16:47:13 2015 +0530
> @@ -1691,10 +1691,26 @@
>      for (int dir = MD_LEFT; dir <= MD_ABOVE_LEFT; dir++)
>      {
>          if (validDirect[dir] && directMV[dir].notZero())
> -            pmv[numMvc++] = directMV[dir];
> +        {
> +            if (num)
> +            {
> +                if (amvpCand[0] != directMV[dir] && amvpCand[1] != directMV[dir])
> +                    pmv[numMvc++] = directMV[dir];
> +            }
> +            else
> +                pmv[numMvc++] = directMV[dir];
> +        }
>  
>          if (validIndirect[dir] && indirectMV[dir].notZero())
> -            pmv[numMvc++] = indirectMV[dir];
> +        {
> +            if (num)
> +            {
> +                if (amvpCand[0] != indirectMV[dir] && amvpCand[1] != indirectMV[dir])
> +                    pmv[numMvc++] = indirectMV[dir];
> +            }
> +            else
> +                pmv[numMvc++] = indirectMV[dir];
> +        }

this looks like it might be effective, but it's an aweful lot of
conditional logic for something that is trying to save work.

this could be done more efficiently in the conditional expressions just
above this for-loop. For instance:

if (validDirect[MD_BELOW_LEFT])
{
    amvpCand[num++] = directMV[MD_BELOW_LEFT];
    pmv[numMvc] = directMV[MD_LEFT];         numMvc += validDirect[MD_LEFT];
    pmv[numMvc] = indirectMV[MD_BELOW_LEFT]; numMvc += validIndirect[MD_BELOW_LEFT];
    pmv[numMvc] = indirectMV[MD_LEFT];       numMvc += validIndirect[MD_LEFT];
}
else if (validDirect[MD_LEFT])
    ...

-- 
Steve Borho


More information about the x265-devel mailing list