<div dir="ltr">Yes, I removed directly because of the following reason.<div>mergeSaoParam array is declared in <b>rdoSaoUnitRow()</b> function. It is getting initialized inside <b>saoComponentParamDist()</b><div>and <b>sao2ChromaParamDist() </b>function when merge up/left available. And again in rdoSaoUnitRow() function we are calculating the best merge candidate using this array</div><div>only if the merge up/left available. So it is not required to initialize. Beacuse we are double checking if up/left merge block is available. For your conformance I ran valgrind,</div><div>there is no issue. It is not affecting the output. I was just trying to remove the duplicate code like resetSaoUnit(), because we are using the same code with different name reset().</div><div><br></div><div>Below are the two functions:</div><div><div>void SAO::resetSaoUnit(SaoCtuParam* saoUnit)</div><div>{</div><div>    saoUnit->mergeMode  = SAO_MERGE_NONE;</div><div>    saoUnit->typeIdx    = -1;</div><div>    saoUnit->bandPos    = 0;</div><div><br></div><div>    for (int i = 0; i < SAO_NUM_OFFSET; i++)</div><div>        saoUnit->offset[i] = 0;</div><div>}</div></div><div><br></div><div><div>void reset()</div><div>{</div><div>    mergeMode = SAO_MERGE_NONE;</div><div>    typeIdx = -1;</div><div>    bandPos = 0;</div><div>    offset[0] = 0;</div><div>    offset[1] = 0;</div><div>    offset[2] = 0;</div><div>    offset[3] = 0;</div><div>}</div></div><div><br></div><div>Really do we need two functions which serve same purpose ?</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 20, 2015 at 9:12 PM, chen <span dir="ltr"><<a href="mailto:chenm003@163.com" target="_blank">chenm003@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><div><div class="h5"><div><br></div><pre><br>At 2015-11-20 19:58:21,<a href="mailto:ashok@multicorewareinc.com" target="_blank">ashok@multicorewareinc.com</a> wrote:
># HG changeset patch
># User Ashok Kumar Mishra<<a href="mailto:ashok@multicorewareinc.com" target="_blank">ashok@multicorewareinc.com</a>>
># Date 1445505834 -19800
>#      Thu Oct 22 14:53:54 2015 +0530
># Node ID 5d320d99e14fed8e64505d73f01505cdf0d94861
># Parent  c1575815b250fb02c1fdae803aead10a4997c835
>SAO: remove resetSaoUnit()
>
>diff -r c1575815b250 -r 5d320d99e14f source/encoder/sao.cpp
>--- a/source/encoder/sao.cpp       Thu Oct 29 17:15:15 2015 +0530
>+++ b/source/encoder/sao.cpp       Thu Oct 22 14:53:54 2015 +0530
>@@ -704,16 +704,6 @@
>     std::swap(m_tmpU1[plane], m_tmpU2[plane]);
> }

>-void SAO::resetSaoUnit(SaoCtuParam* saoUnit)
>-{
>-    saoUnit->mergeMode  = SAO_MERGE_NONE;
>-    saoUnit->typeIdx    = -1;
>-    saoUnit->bandPos    = 0;
>-
>-    for (int i = 0; i < SAO_NUM_OFFSET; i++)
>-        saoUnit->offset[i] = 0;
>-}
>-
> void SAO::copySaoUnit(SaoCtuParam* saoUnitDst, const SaoCtuParam* saoUnitSrc)
> {
>     saoUnitDst->mergeMode   = saoUnitSrc->mergeMode;
>@@ -1172,9 +1162,7 @@
>                 }
>             }

>-            saoParam->ctuParam[plane][addr].mergeMode = SAO_MERGE_NONE;
>-            saoParam->ctuParam[plane][addr].typeIdx   = -1;
>-            saoParam->ctuParam[plane][addr].bandPos   = 0;
>+            saoParam->ctuParam[plane][addr].reset();
>             if (saoParam->bSaoFlag[plane > 0])
>                 calcSaoStatsCu(addr, plane);
>         }
>@@ -1326,7 +1314,6 @@
>     int    currentDistortionTableBo[MAX_NUM_SAO_CLASS];
>     double currentRdCostTableBo[MAX_NUM_SAO_CLASS];

>-    resetSaoUnit(lclCtuParam);
>     m_entropyCoder.load(m_rdContexts.temp);
>     m_entropyCoder.resetBits();
>     m_entropyCoder.codeSaoOffset(*lclCtuParam, 0);
>@@ -1386,7 +1373,6 @@
>     m_entropyCoder.store(m_rdContexts.temp);

>     // merge left or merge up
>-
>     for (int mergeIdx = 0; mergeIdx < 2; mergeIdx++)
>     {
>         SaoCtuParam* mergeSrcParam = NULL;
>@@ -1413,8 +1399,6 @@

>             mergeDist[mergeIdx + 1] = ((double)estDist / m_lumaLambda);
>         }
>-        else
>-            resetSaoUnit(&mergeSaoParam[mergeIdx]);</pre></div></div><pre>remove directly? mergeSaoParam declare in rdoSaoUnitRow() and never initialize before.</pre><pre></pre></div><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>
<br></blockquote></div><br></div>