<div dir="ltr">Pushed to default.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 19, 2019 at 10:39 AM <<a href="mailto:pooja@multicorewareinc.com">pooja@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"># HG changeset patch<br>
# User Pooja Venkatesan <<a href="mailto:pooja@multicorewareinc.com" target="_blank">pooja@multicorewareinc.com</a>><br>
# Date 1568702243 -19800<br>
#      Tue Sep 17 12:07:23 2019 +0530<br>
# Node ID c172006cc4e7b5d6347652c8b391deb100503be5<br>
# Parent  c4b098f973e6b0ee4aee3bf0d7b54da4e2734d42<br>
Cleanup<br>
<br>
This patch does the following:<br>
1) Disable SAO by --no-sao option<br>
2) Resolve gcc-9.2 warnings related to MV refinement levels<br>
3) Update CLI docs<br>
4) Remove MV refinement level-0 and set default to 1.<br>
5) Fix spacing issues and indentations<br>
<br>
diff -r c4b098f973e6 -r c172006cc4e7 doc/reST/cli.rst<br>
--- a/doc/reST/cli.rst  Tue Aug 13 10:51:21 2019 +0530<br>
+++ b/doc/reST/cli.rst  Tue Sep 17 12:07:23 2019 +0530<br>
@@ -997,13 +997,15 @@<br>
        the encoder settings. It is recommended to use :option:`--refine-intra` 4 with dynamic <br>
        refinement. Default disabled.<br>
<br>
-.. option:: --refine-mv <0..3><br>
+.. option:: --refine-mv <1..3><br>
<br>
        Enables refinement of motion vector for scaled video. Evaluates the best <br>
-       motion vector based on the level selected. Default 0 - disabled.<br>
+       motion vector based on the level selected. Default 1.<br>
<br>
        Level 1 - Search around scaled MV.<br>
+       <br>
        Level 2 - Level 1 + Search around best AMVP cand.<br>
+       <br>
        Level 3 - Level 2 + Search around the other AMVP cand.<br>
<br>
 Options which affect the transform unit quad-tree, sometimes referred to<br>
@@ -1999,21 +2001,22 @@<br>
<br>
 .. option:: --selective-sao <0..4><br>
<br>
-       Toggles SAO at slice level. Default 4.<br>
-<br>
-       +--------------+---------------------------------------+<br>
-       |     Level    |              Description              |     <br>
-       +==============+=======================================+<br>
-       |      0       | Disable SAO for all slices            |<br>
-       +--------------+---------------------------------------+<br>
-       |      1       | Enable SAO only for I-slices          |<br>
-       +--------------+---------------------------------------+<br>
-       |      2       | Enable SAO for I-slices & P-slices    |                                  |<br>
-       +--------------+---------------------------------------+<br>
-       |      3       | Enable SAO for all reference slices   |<br>
-       +--------------+---------------------------------------+<br>
-       |      4       | Enable SAO for all slices             |<br>
-       +--------------+---------------------------------------+<br>
+       Toggles SAO at slice level. Default 0.<br>
+<br>
+       +--------------+------------------------------------------+<br>
+       | Level        | Description                              |<br>
+       +==============+==========================================+<br>
+       | 0            | Disable SAO for all slices               |<br>
+       +--------------+------------------------------------------+<br>
+       | 1            | Enable SAO only for I-slices             |<br>
+       +--------------+------------------------------------------+<br>
+       | 2            | Enable SAO for I-slices & P-slices       |<br>
+       +--------------+------------------------------------------+<br>
+       | 3            | Enable SAO for all reference slices      |<br>
+       +--------------+------------------------------------------+<br>
+       | 4            | Enable SAO for all slices                |<br>
+       +--------------+------------------------------------------+<br>
+<br>
<br>
 VUI (Video Usability Information) options<br>
 =========================================<br>
diff -r c4b098f973e6 -r c172006cc4e7 source/common/param.cpp<br>
--- a/source/common/param.cpp   Tue Aug 13 10:51:21 2019 +0530<br>
+++ b/source/common/param.cpp   Tue Sep 17 12:07:23 2019 +0530<br>
@@ -185,12 +185,12 @@<br>
     param->searchMethod = X265_HEX_SEARCH;<br>
     param->subpelRefine = 2;<br>
     param->searchRange = 57;<br>
-       param->maxNumMergeCand = 3;<br>
-       param->limitReferences = 1;<br>
+    param->maxNumMergeCand = 3;<br>
+    param->limitReferences = 1;<br>
     param->limitModes = 0;<br>
     param->bEnableWeightedPred = 1;<br>
     param->bEnableWeightedBiPred = 0;<br>
-       param->bEnableEarlySkip = 1;<br>
+    param->bEnableEarlySkip = 1;<br>
     param->bEnableRecursionSkip = 1;<br>
     param->bEnableAMP = 0;<br>
     param->bEnableRectInter = 0;<br>
@@ -215,7 +215,7 @@<br>
     param->bEnableSAO = 1;<br>
     param->bSaoNonDeblocked = 0;<br>
     param->bLimitSAO = 0;<br>
-    param->selectiveSAO = 4;<br>
+    param->selectiveSAO = 0;<br>
<br>
     /* Coding Quality */<br>
     param->cbQpOffset = 0;<br>
@@ -229,7 +229,7 @@<br>
     param->analysisReuseFileName = NULL;<br>
     param->analysisSave = NULL;<br>
     param->analysisLoad = NULL;<br>
-       param->bIntraInBFrames = 1;<br>
+    param->bIntraInBFrames = 1;<br>
     param->bLossless = 0;<br>
     param->bCULossless = 0;<br>
     param->bEnableTemporalSubLayers = 0;<br>
@@ -318,7 +318,7 @@<br>
     param->intraRefine = 0;<br>
     param->interRefine = 0;<br>
     param->bDynamicRefine = 0;<br>
-    param->mvRefine = 0;<br>
+    param->mvRefine = 1;<br>
     param->ctuDistortionRefine = 0;<br>
     param->bUseAnalysisFile = 1;<br>
     param->csvfpt = NULL;<br>
@@ -376,7 +376,6 @@<br>
             param->subpelRefine = 0;<br>
             param->searchMethod = X265_DIA_SEARCH;<br>
             param->bEnableSAO = 0;<br>
-            param->selectiveSAO = 0;<br>
             param->bEnableSignHiding = 0;<br>
             param->bEnableWeightedPred = 0;<br>
             param->rdLevel = 2;<br>
@@ -406,7 +405,6 @@<br>
             param->rc.hevcAq = 0;<br>
             param->rc.qgSize = 32;<br>
             param->bEnableSAO = 0;<br>
-            param->selectiveSAO = 0;<br>
             param->bEnableFastIntra = 1;<br>
         }<br>
         else if (!strcmp(preset, "veryfast"))<br>
@@ -554,7 +552,6 @@<br>
         {<br>
             param->bEnableLoopFilter = 0;<br>
             param->bEnableSAO = 0;<br>
-            param->selectiveSAO = 0;<br>
             param->bEnableWeightedPred = 0;<br>
             param->bEnableWeightedBiPred = 0;<br>
             param->bIntraInBFrames = 0;<br>
@@ -582,7 +579,6 @@<br>
             param->psyRd = 4.0;<br>
             param->psyRdoq = 10.0;<br>
             param->bEnableSAO = 0;<br>
-            param->selectiveSAO = 0;<br>
             param->rc.bEnableConstVbv = 1;<br>
         }<br>
         else if (!strcmp(tune, "animation"))<br>
@@ -1659,8 +1655,8 @@<br>
           "Strict-cbr cannot be applied without specifying target bitrate or vbv bufsize");<br>
     CHECK((param->analysisSave || param->analysisLoad) && (param->analysisReuseLevel < 1 || param->analysisReuseLevel > 10),<br>
         "Invalid analysis refine level. Value must be between 1 and 10 (inclusive)");<br>
-    CHECK(param->analysisLoad && (param->mvRefine < 0 || param->mvRefine > 3),<br>
-        "Invalid mv refinement level. Value must be between 0 and 3 (inclusive)");<br>
+    CHECK(param->analysisLoad && (param->mvRefine < 1 || param->mvRefine > 3),<br>
+        "Invalid mv refinement level. Value must be between 1 and 3 (inclusive)");<br>
     CHECK(param->scaleFactor > 2, "Invalid scale-factor. Supports factor <= 2");<br>
     CHECK(param->rc.qpMax < QP_MIN || param->rc.qpMax > QP_MAX_MAX,<br>
         "qpmax exceeds supported range (0 to 69)");<br>
@@ -1873,7 +1869,7 @@<br>
     }<br>
     TOOLOPT(param->bSaoNonDeblocked, "sao-non-deblock");<br>
     TOOLOPT(!param->bSaoNonDeblocked && param->bEnableSAO, "sao");<br>
-    if (param->selectiveSAO != 4)<br>
+    if (param->selectiveSAO && param->selectiveSAO != 4)<br>
         TOOLOPT(param->selectiveSAO, "selective-sao");<br>
     TOOLOPT(param->rc.bStatWrite, "stats-write");<br>
     TOOLOPT(param->rc.bStatRead,  "stats-read");<br>
@@ -1984,7 +1980,7 @@<br>
     BOOL(p->bEnableSAO, "sao");<br>
     BOOL(p->bSaoNonDeblocked, "sao-non-deblock");<br>
     s += sprintf(s, " rd=%d", p->rdLevel);<br>
-    s += sprintf(s, "selective-sao=%d", p->selectiveSAO);<br>
+    s += sprintf(s, " selective-sao=%d", p->selectiveSAO);<br>
     BOOL(p->bEnableEarlySkip, "early-skip");<br>
     BOOL(p->bEnableRecursionSkip, "rskip");<br>
     BOOL(p->bEnableFastIntra, "fast-intra");<br>
@@ -2078,7 +2074,7 @@<br>
     if (p->masteringDisplayColorVolume)<br>
         s += sprintf(s, " master-display=%s", p->masteringDisplayColorVolume);<br>
     if (p->bEmitCLL)<br>
-        s += sprintf(s, "cll=%hu,%hu", p->maxCLL, p->maxFALL);<br>
+        s += sprintf(s, " cll=%hu,%hu", p->maxCLL, p->maxFALL);<br>
     s += sprintf(s, " min-luma=%hu", p->minLuma);<br>
     s += sprintf(s, " max-luma=%hu", p->maxLuma);<br>
     s += sprintf(s, " log2-max-poc-lsb=%d", p->log2MaxPocLsb);<br>
diff -r c4b098f973e6 -r c172006cc4e7 source/encoder/analysis.cpp<br>
--- a/source/encoder/analysis.cpp       Tue Aug 13 10:51:21 2019 +0530<br>
+++ b/source/encoder/analysis.cpp       Tue Sep 17 12:07:23 2019 +0530<br>
@@ -2493,11 +2493,11 @@<br>
                             {<br>
                                 MV outmv, mvpSelect[3];<br>
                                 mvpSelect[0] = interDataCTU->mv[list][cuIdx + part].word;<br>
-                                switch (m_param->mvRefine)<br>
+                                if (m_param->mvRefine > 1)<br>
                                 {<br>
-                                case 3: mvpSelect[2] = mode.amvpCand[list][ref][!(mode.cu.m_mvpIdx[list][pu.puAbsPartIdx])];<br>
-                                case 2: mvpSelect[1] = mvp;<br>
-                                default: break;<br>
+                                    mvpSelect[1] = mvp;<br>
+                                    if(m_param->mvRefine > 2)<br>
+                                        mvpSelect[2] = mode.amvpCand[list][ref][!(mode.cu.m_mvpIdx[list][pu.puAbsPartIdx])];<br>
                                 }<br>
                                 searchMV(mode, list, ref, outmv, mvpSelect, numMvc, mvc);<br>
                                 mode.cu.setPUMv(list, outmv, pu.puAbsPartIdx, part);<br>
diff -r c4b098f973e6 -r c172006cc4e7 source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp        Tue Aug 13 10:51:21 2019 +0530<br>
+++ b/source/encoder/encoder.cpp        Tue Sep 17 12:07:23 2019 +0530<br>
@@ -3006,20 +3006,6 @@<br>
         p->limitTU = 0;<br>
     }<br>
<br>
-    if (p->mvRefine)<br>
-    {<br>
-        if (!p->analysisLoad || p->analysisReuseLevel < 10)<br>
-        {<br>
-            x265_log(p, X265_LOG_WARNING, "MV refinement requires analysis load, analysis-reuse-level 10. Disabling MV refine.\n");<br>
-            p->mvRefine = 0;<br>
-        }<br>
-    }<br>
-    if (p->scaleFactor && p->analysisLoad && p->interRefine && p->analysisReuseLevel == 10 && !p->mvRefine)<br>
-    {<br>
-        x265_log(p, X265_LOG_WARNING, "Enabling MV refinement level 1 with scaling and analysis-reuse-level=10.\n");<br>
-        p->mvRefine = 1;<br>
-    }<br>
-<br>
     if (p->ctuDistortionRefine == CTU_DISTORTION_INTERNAL)<br>
     {<br>
         if (!p->analysisLoad && !p->analysisSave)<br>
diff -r c4b098f973e6 -r c172006cc4e7 source/encoder/search.cpp<br>
--- a/source/encoder/search.cpp Tue Aug 13 10:51:21 2019 +0530<br>
+++ b/source/encoder/search.cpp Tue Sep 17 12:07:23 2019 +0530<br>
@@ -2246,13 +2246,7 @@<br>
                 const MV* amvp = interMode.amvpCand[list][ref];<br>
                 int mvpIdx = selectMVP(cu, pu, amvp, list, ref);<br>
                 MV mvmin, mvmax, outmv, mvp;<br>
-                if (useAsMVP && !m_param->mvRefine)<br>
-                {<br>
-                    mvp = interDataCTU->mv[list][cuIdx + puIdx].word;<br>
-                    mvpIdx = interDataCTU->mvpIdx[list][cuIdx + puIdx];<br>
-                }<br>
-                else<br>
-                    mvp = amvp[mvpIdx];<br>
+                mvp = amvp[mvpIdx];<br>
                 if (m_param->searchMethod == X265_SEA)<br>
                 {<br>
                     int puX = puIdx & 1;<br>
@@ -2265,19 +2259,22 @@<br>
                 int satdCost;<br>
                 if (m_param->analysisMultiPassRefine && m_param->rc.bStatRead && mvpIdx == bestME[list].mvpIdx)<br>
                     mvpIn = bestME[list].mv;<br>
-                if (useAsMVP && m_param->mvRefine)<br>
+                if (useAsMVP)<br>
                 {<br>
                     MV bestmv, mvpSel[3];<br>
                     int mvpIdxSel[3];<br>
                     satdCost = m_me.COST_MAX;<br>
-                    switch (m_param->mvRefine)<br>
+                    mvpSel[0] = interDataCTU->mv[list][cuIdx + puIdx].word;<br>
+                    mvpIdxSel[0] = interDataCTU->mvpIdx[list][cuIdx + puIdx];<br>
+                    if (m_param->mvRefine > 1)<br>
                     {<br>
-                    case 3: mvpSel[2] = interMode.amvpCand[list][ref][!mvpIdx];<br>
+                        mvpSel[1] = interMode.amvpCand[list][ref][mvpIdx];<br>
+                        mvpIdxSel[1] = mvpIdx;<br>
+                        if (m_param->mvRefine > 2)<br>
+                        {<br>
+                            mvpSel[2] = interMode.amvpCand[list][ref][!mvpIdx];<br>
                             mvpIdxSel[2] = !mvpIdx;<br>
-                    case 2: mvpSel[1] = interMode.amvpCand[list][ref][mvpIdx];<br>
-                            mvpIdxSel[1] = mvpIdx;<br>
-                    case 1: mvpSel[0] = interDataCTU->mv[list][cuIdx + puIdx].word;<br>
-                            mvpIdxSel[0] = interDataCTU->mvpIdx[list][cuIdx + puIdx];<br>
+                        }<br>
                     }<br>
                     for (int cand = 0; cand < m_param->mvRefine; cand++)<br>
                     {<br>
diff -r c4b098f973e6 -r c172006cc4e7 source/x265cli.h<br>
--- a/source/x265cli.h  Tue Aug 13 10:51:21 2019 +0530<br>
+++ b/source/x265cli.h  Tue Sep 17 12:07:23 2019 +0530<br>
@@ -549,7 +549,7 @@<br>
         "                                    - 3 : Functionality of (1) + irrespective of size evaluate all inter modes.\n"<br>
         "                                Default:%d\n", param->interRefine);<br>
     H0("   --[no-]dynamic-refine         Dynamically changes refine-inter level for each CU. Default %s\n", OPT(param->bDynamicRefine));<br>
-    H0("   --refine-mv <0..3>            Enable mv refinement for load mode. Default %d\n", param->mvRefine);<br>
+    H0("   --refine-mv <1..3>            Enable mv refinement for load mode. Default %d\n", param->mvRefine);<br>
     H0("   --refine-ctu-distortion       Store/normalize ctu distortion in analysis-save/load.\n"<br>
         "                                    - 0 : Disabled.\n"<br>
         "                                    - 1 : Store/Load ctu distortion to/from the file specified in analysis-save/load.\n"<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">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>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><font face="georgia, serif">Regards,</font><div><font face="georgia, serif">Aruna</font></div></div></div>