<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 12, 2015 at 8:47 PM, Steve Borho <span dir="ltr"><<a href="mailto:steve@borho.org" target="_blank">steve@borho.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 06/12, <a href="mailto:gopu@multicorewareinc.com">gopu@multicorewareinc.com</a> wrote:<br>
> # HG changeset patch<br>
> # User Gopu Govindaswamy <<a href="mailto:gopu@multicorewareinc.com">gopu@multicorewareinc.com</a>><br>
> # Date 1434098206 -19800<br>
> #      Fri Jun 12 14:06:46 2015 +0530<br>
> # Node ID e0327556bbcda705af8689ec0a77206599f5de61<br>
> # Parent  2cd9183df03edff0b148bab6e133dfe1ae4f69a1<br>
> analysis: Fix blocking artifacts while sharing best merge candidates<br>
><br>
> While ecoding with --analysis-mode=load mode noticed there will blocking<br>
> artifacts, this issue is while sharing best merge candidate,<br>
><br>
> when sharing the merge candidate before selecting the best mode (SKIP MODE),<br>
> first encode merge with residual (no skip) and if this mode hasCbf then try<br>
> merge without residual(skip) then select the best mode (SKIP MODE) from this two<br>
><br>
> diff -r 2cd9183df03e -r e0327556bbcd source/encoder/analysis.cpp<br>
> --- a/source/encoder/analysis.cpp     Thu Jun 11 17:06:46 2015 +0530<br>
> +++ b/source/encoder/analysis.cpp     Fri Jun 12 14:06:46 2015 +0530<br>
> @@ -1455,19 +1455,50 @@<br>
>      bool foundCbf0Merge = false;<br>
>      bool triedPZero = false, triedBZero = false;<br>
>      bestPred->rdCost = MAX_INT64;<br>
> +    uint8_t hasCbf = true;<br>
> +    bool swapped = false;<br>
><br>
>      if (isSkipMode)<br>
<br>
</span>this ends up being a lot of duplicate code.<br>
<br>
How about something like this instead?<br>
<br>
  uint32_t first = 0, last = numMergeCand - 1;<br>
  if (isSkipMode)<br>
      first = last = *m_reuseBestMergeCand;<br>
<br>
  for (uint32_t i = first; i <= last; i++)<br>
  {<br>
    ...<br>
  }<br>
<br>
also, isSkipMode should probably be renamed<br></blockquote><div> </div><div>yes  This is looks fine, i will resend the patch with the modifications <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5"><br>
>      {<br>
>          uint32_t i = *m_reuseBestMergeCand;<br>
> -        bestPred->cu.m_mvpIdx[0][0] = (uint8_t)i;<br>
> -        bestPred->cu.m_interDir[0] = candDir[i];<br>
> -        bestPred->cu.m_mv[0][0] = candMvField[i][0].mv;<br>
> -        bestPred->cu.m_mv[1][0] = candMvField[i][1].mv;<br>
> -        bestPred->cu.m_refIdx[0][0] = (int8_t)candMvField[i][0].refIdx;<br>
> -        bestPred->cu.m_refIdx[1][0] = (int8_t)candMvField[i][1].refIdx;<br>
> +        tempPred->cu.m_mvpIdx[0][0] = (uint8_t)i;    /* merge candidate ID is stored in L0 MVP idx */<br>
> +        tempPred->cu.m_interDir[0] = candDir[i];<br>
> +        tempPred->cu.m_mv[0][0] = candMvField[i][0].mv;<br>
> +        tempPred->cu.m_mv[1][0] = candMvField[i][1].mv;<br>
> +        tempPred->cu.m_refIdx[0][0] = (int8_t)candMvField[i][0].refIdx;<br>
> +        tempPred->cu.m_refIdx[1][0] = (int8_t)candMvField[i][1].refIdx;<br>
> +        tempPred->cu.setPredModeSubParts(MODE_INTER); /* must be cleared between encode iterations */<br>
><br>
> -        motionCompensation(bestPred->cu, pu, bestPred->predYuv, true, true);<br>
> -        encodeResAndCalcRdSkipCU(*bestPred);<br>
> +        motionCompensation(tempPred->cu, pu, tempPred->predYuv, true, true);<br>
> +<br>
> +        /* if the best prediction has CBF (not a skip) then try merge with residual */<br>
> +        encodeResAndCalcRdInterCU(*tempPred, cuGeom);<br>
> +        if (tempPred->rdCost < bestPred->rdCost)<br>
> +        {<br>
> +            hasCbf = tempPred->cu.getQtRootCbf(0);<br>
> +            std::swap(tempPred, bestPred);<br>
> +            swapped = true;<br>
> +        }<br>
> +<br>
> +        if (!m_param->bLossless && hasCbf)<br>
> +        {<br>
> +            if (swapped)<br>
> +            {<br>
> +                tempPred->cu.m_mvpIdx[0][0] = (uint8_t)i;<br>
> +                tempPred->cu.m_interDir[0] = candDir[i];<br>
> +                tempPred->cu.m_mv[0][0] = candMvField[i][0].mv;<br>
> +                tempPred->cu.m_mv[1][0] = candMvField[i][1].mv;<br>
> +                tempPred->cu.m_refIdx[0][0] = (int8_t)candMvField[i][0].refIdx;<br>
> +                tempPred->cu.m_refIdx[1][0] = (int8_t)candMvField[i][1].refIdx;<br>
> +                tempPred->cu.setPredModeSubParts(MODE_INTER);<br>
> +                tempPred->predYuv.copyFromYuv(bestPred->predYuv);<br>
> +            }<br>
> +<br>
> +            /* try merge without residual (skip), if not lossless coding */<br>
> +            encodeResAndCalcRdSkipCU(*tempPred);<br>
> +            if (tempPred->rdCost < bestPred->rdCost)<br>
> +                std::swap(tempPred, bestPred);<br>
> +        }<br>
>      }<br>
>      else<br>
>      {<br>
> @@ -1504,8 +1535,6 @@<br>
><br>
>              motionCompensation(tempPred->cu, pu, tempPred->predYuv, true, true);<br>
><br>
> -            uint8_t hasCbf = true;<br>
> -            bool swapped = false;<br>
>              if (!foundCbf0Merge)<br>
>              {<br>
>                  /* if the best prediction has CBF (not a skip) then try merge with residual */<br>
</div></div>> _______________________________________________<br>
> x265-devel mailing list<br>
> <a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
> <a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Steve Borho<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Thanks & Regards<br>Gopu G<br>Multicoreware Inc <br><br></div>
</div></div>