changeset 12558:5f18017a2a08 stable

Merge with default
author Aruna Matheswaran <aruna@multicorewareinc.com>
date Thu, 19 Sep 2019 14:14:08 +0530
parents f5d756344566 (current diff) 913823aa15cd (diff)
children 20c9994e8bfb 82a66ce12955
files
diffstat 6 files changed, 47 insertions(+-), 65 deletions(-) [+]
line wrap: on
line diff
--- a/doc/reST/cli.rst	Thu Sep 12 16:34:00 2019 +0530
+++ b/doc/reST/cli.rst	Thu Sep 19 14:14:08 2019 +0530
@@ -997,13 +997,15 @@ will not reuse analysis if slice type pa
 	the encoder settings. It is recommended to use :option:`--refine-intra` 4 with dynamic 
 	refinement. Default disabled.
 
-.. option:: --refine-mv <0..3>
+.. option:: --refine-mv <1..3>
 
 	Enables refinement of motion vector for scaled video. Evaluates the best 
-	motion vector based on the level selected. Default 0 - disabled.
+	motion vector based on the level selected. Default 1.
 
 	Level 1 - Search around scaled MV.
+	
 	Level 2 - Level 1 + Search around best AMVP cand.
+	
 	Level 3 - Level 2 + Search around the other AMVP cand.
 
 Options which affect the transform unit quad-tree, sometimes referred to
@@ -1999,21 +2001,22 @@ Loop filters
 	
 .. option:: --selective-sao <0..4>
 
-	Toggles SAO at slice level. Default 4.
-
-	+--------------+---------------------------------------+
-	|     Level    |              Description              |     
-	+==============+=======================================+
-	|      0       | Disable SAO for all slices            |
-	+--------------+---------------------------------------+
-	|      1       | Enable SAO only for I-slices          |
-	+--------------+---------------------------------------+
-	|      2       | Enable SAO for I-slices & P-slices    |                                  |
-	+--------------+---------------------------------------+
-	|      3       | Enable SAO for all reference slices   |
-	+--------------+---------------------------------------+
-	|      4       | Enable SAO for all slices             |
-	+--------------+---------------------------------------+
+	Toggles SAO at slice level. Default 0.
+
+	+--------------+------------------------------------------+
+	| Level        | Description                              |
+	+==============+==========================================+
+	| 0            | Disable SAO for all slices               |
+	+--------------+------------------------------------------+
+	| 1            | Enable SAO only for I-slices             |
+	+--------------+------------------------------------------+
+	| 2            | Enable SAO for I-slices & P-slices       |
+	+--------------+------------------------------------------+
+	| 3            | Enable SAO for all reference slices      |
+	+--------------+------------------------------------------+
+	| 4            | Enable SAO for all slices                |
+	+--------------+------------------------------------------+
+
 
 VUI (Video Usability Information) options
 =========================================
--- a/source/common/param.cpp	Thu Sep 12 16:34:00 2019 +0530
+++ b/source/common/param.cpp	Thu Sep 19 14:14:08 2019 +0530
@@ -185,12 +185,12 @@ void x265_param_default(x265_param* para
     param->searchMethod = X265_HEX_SEARCH;
     param->subpelRefine = 2;
     param->searchRange = 57;
-	param->maxNumMergeCand = 3;
-	param->limitReferences = 1;
+    param->maxNumMergeCand = 3;
+    param->limitReferences = 1;
     param->limitModes = 0;
     param->bEnableWeightedPred = 1;
     param->bEnableWeightedBiPred = 0;
-	param->bEnableEarlySkip = 1;
+    param->bEnableEarlySkip = 1;
     param->bEnableRecursionSkip = 1;
     param->bEnableAMP = 0;
     param->bEnableRectInter = 0;
@@ -215,7 +215,7 @@ void x265_param_default(x265_param* para
     param->bEnableSAO = 1;
     param->bSaoNonDeblocked = 0;
     param->bLimitSAO = 0;
-    param->selectiveSAO = 4;
+    param->selectiveSAO = 0;
 
     /* Coding Quality */
     param->cbQpOffset = 0;
@@ -229,7 +229,7 @@ void x265_param_default(x265_param* para
     param->analysisReuseFileName = NULL;
     param->analysisSave = NULL;
     param->analysisLoad = NULL;
-	param->bIntraInBFrames = 1;
+    param->bIntraInBFrames = 1;
     param->bLossless = 0;
     param->bCULossless = 0;
     param->bEnableTemporalSubLayers = 0;
@@ -318,7 +318,7 @@ void x265_param_default(x265_param* para
     param->intraRefine = 0;
     param->interRefine = 0;
     param->bDynamicRefine = 0;
-    param->mvRefine = 0;
+    param->mvRefine = 1;
     param->ctuDistortionRefine = 0;
     param->bUseAnalysisFile = 1;
     param->csvfpt = NULL;
@@ -376,7 +376,6 @@ int x265_param_default_preset(x265_param
             param->subpelRefine = 0;
             param->searchMethod = X265_DIA_SEARCH;
             param->bEnableSAO = 0;
-            param->selectiveSAO = 0;
             param->bEnableSignHiding = 0;
             param->bEnableWeightedPred = 0;
             param->rdLevel = 2;
@@ -406,7 +405,6 @@ int x265_param_default_preset(x265_param
             param->rc.hevcAq = 0;
             param->rc.qgSize = 32;
             param->bEnableSAO = 0;
-            param->selectiveSAO = 0;
             param->bEnableFastIntra = 1;
         }
         else if (!strcmp(preset, "veryfast"))
@@ -554,7 +552,6 @@ int x265_param_default_preset(x265_param
         {
             param->bEnableLoopFilter = 0;
             param->bEnableSAO = 0;
-            param->selectiveSAO = 0;
             param->bEnableWeightedPred = 0;
             param->bEnableWeightedBiPred = 0;
             param->bIntraInBFrames = 0;
@@ -582,7 +579,6 @@ int x265_param_default_preset(x265_param
             param->psyRd = 4.0;
             param->psyRdoq = 10.0;
             param->bEnableSAO = 0;
-            param->selectiveSAO = 0;
             param->rc.bEnableConstVbv = 1;
         }
         else if (!strcmp(tune, "animation"))
@@ -1659,8 +1655,8 @@ int x265_check_params(x265_param* param)
           "Strict-cbr cannot be applied without specifying target bitrate or vbv bufsize");
     CHECK((param->analysisSave || param->analysisLoad) && (param->analysisReuseLevel < 1 || param->analysisReuseLevel > 10),
         "Invalid analysis refine level. Value must be between 1 and 10 (inclusive)");
-    CHECK(param->analysisLoad && (param->mvRefine < 0 || param->mvRefine > 3),
-        "Invalid mv refinement level. Value must be between 0 and 3 (inclusive)");
+    CHECK(param->analysisLoad && (param->mvRefine < 1 || param->mvRefine > 3),
+        "Invalid mv refinement level. Value must be between 1 and 3 (inclusive)");
     CHECK(param->scaleFactor > 2, "Invalid scale-factor. Supports factor <= 2");
     CHECK(param->rc.qpMax < QP_MIN || param->rc.qpMax > QP_MAX_MAX,
         "qpmax exceeds supported range (0 to 69)");
@@ -1873,7 +1869,7 @@ void x265_print_params(x265_param* param
     }
     TOOLOPT(param->bSaoNonDeblocked, "sao-non-deblock");
     TOOLOPT(!param->bSaoNonDeblocked && param->bEnableSAO, "sao");
-    if (param->selectiveSAO != 4)
+    if (param->selectiveSAO && param->selectiveSAO != 4)
         TOOLOPT(param->selectiveSAO, "selective-sao");
     TOOLOPT(param->rc.bStatWrite, "stats-write");
     TOOLOPT(param->rc.bStatRead,  "stats-read");
@@ -1984,7 +1980,7 @@ char *x265_param2string(x265_param* p, i
     BOOL(p->bEnableSAO, "sao");
     BOOL(p->bSaoNonDeblocked, "sao-non-deblock");
     s += sprintf(s, " rd=%d", p->rdLevel);
-    s += sprintf(s, "selective-sao=%d", p->selectiveSAO);
+    s += sprintf(s, " selective-sao=%d", p->selectiveSAO);
     BOOL(p->bEnableEarlySkip, "early-skip");
     BOOL(p->bEnableRecursionSkip, "rskip");
     BOOL(p->bEnableFastIntra, "fast-intra");
@@ -2078,7 +2074,7 @@ char *x265_param2string(x265_param* p, i
     if (p->masteringDisplayColorVolume)
         s += sprintf(s, " master-display=%s", p->masteringDisplayColorVolume);
     if (p->bEmitCLL)
-        s += sprintf(s, "cll=%hu,%hu", p->maxCLL, p->maxFALL);
+        s += sprintf(s, " cll=%hu,%hu", p->maxCLL, p->maxFALL);
     s += sprintf(s, " min-luma=%hu", p->minLuma);
     s += sprintf(s, " max-luma=%hu", p->maxLuma);
     s += sprintf(s, " log2-max-poc-lsb=%d", p->log2MaxPocLsb);
--- a/source/encoder/analysis.cpp	Thu Sep 12 16:34:00 2019 +0530
+++ b/source/encoder/analysis.cpp	Thu Sep 19 14:14:08 2019 +0530
@@ -2493,11 +2493,11 @@ void Analysis::recodeCU(const CUData& pa
                             {
                                 MV outmv, mvpSelect[3];
                                 mvpSelect[0] = interDataCTU->mv[list][cuIdx + part].word;
-                                switch (m_param->mvRefine)
+                                if (m_param->mvRefine > 1)
                                 {
-                                case 3: mvpSelect[2] = mode.amvpCand[list][ref][!(mode.cu.m_mvpIdx[list][pu.puAbsPartIdx])];
-                                case 2: mvpSelect[1] = mvp;
-                                default: break;
+                                    mvpSelect[1] = mvp;
+                                    if(m_param->mvRefine > 2)
+                                        mvpSelect[2] = mode.amvpCand[list][ref][!(mode.cu.m_mvpIdx[list][pu.puAbsPartIdx])];
                                 }
                                 searchMV(mode, list, ref, outmv, mvpSelect, numMvc, mvc);
                                 mode.cu.setPUMv(list, outmv, pu.puAbsPartIdx, part);
--- a/source/encoder/encoder.cpp	Thu Sep 12 16:34:00 2019 +0530
+++ b/source/encoder/encoder.cpp	Thu Sep 19 14:14:08 2019 +0530
@@ -3006,20 +3006,6 @@ void Encoder::configure(x265_param *p)
         p->limitTU = 0;
     }
 
-    if (p->mvRefine)
-    {
-        if (!p->analysisLoad || p->analysisReuseLevel < 10)
-        {
-            x265_log(p, X265_LOG_WARNING, "MV refinement requires analysis load, analysis-reuse-level 10. Disabling MV refine.\n");
-            p->mvRefine = 0;
-        }
-    }
-    if (p->scaleFactor && p->analysisLoad && p->interRefine && p->analysisReuseLevel == 10 && !p->mvRefine)
-    {
-        x265_log(p, X265_LOG_WARNING, "Enabling MV refinement level 1 with scaling and analysis-reuse-level=10.\n");
-        p->mvRefine = 1;
-    }
-
     if (p->ctuDistortionRefine == CTU_DISTORTION_INTERNAL)
     {
         if (!p->analysisLoad && !p->analysisSave)
--- a/source/encoder/search.cpp	Thu Sep 12 16:34:00 2019 +0530
+++ b/source/encoder/search.cpp	Thu Sep 19 14:14:08 2019 +0530
@@ -2246,13 +2246,7 @@ void Search::predInterSearch(Mode& inter
                 const MV* amvp = interMode.amvpCand[list][ref];
                 int mvpIdx = selectMVP(cu, pu, amvp, list, ref);
                 MV mvmin, mvmax, outmv, mvp;
-                if (useAsMVP && !m_param->mvRefine)
-                {
-                    mvp = interDataCTU->mv[list][cuIdx + puIdx].word;
-                    mvpIdx = interDataCTU->mvpIdx[list][cuIdx + puIdx];
-                }
-                else
-                    mvp = amvp[mvpIdx];
+                mvp = amvp[mvpIdx];
                 if (m_param->searchMethod == X265_SEA)
                 {
                     int puX = puIdx & 1;
@@ -2265,19 +2259,22 @@ void Search::predInterSearch(Mode& inter
                 int satdCost;
                 if (m_param->analysisMultiPassRefine && m_param->rc.bStatRead && mvpIdx == bestME[list].mvpIdx)
                     mvpIn = bestME[list].mv;
-                if (useAsMVP && m_param->mvRefine)
+                if (useAsMVP)
                 {
                     MV bestmv, mvpSel[3];
                     int mvpIdxSel[3];
                     satdCost = m_me.COST_MAX;
-                    switch (m_param->mvRefine)
+                    mvpSel[0] = interDataCTU->mv[list][cuIdx + puIdx].word;
+                    mvpIdxSel[0] = interDataCTU->mvpIdx[list][cuIdx + puIdx];
+                    if (m_param->mvRefine > 1)
                     {
-                    case 3: mvpSel[2] = interMode.amvpCand[list][ref][!mvpIdx];
+                        mvpSel[1] = interMode.amvpCand[list][ref][mvpIdx];
+                        mvpIdxSel[1] = mvpIdx;
+                        if (m_param->mvRefine > 2)
+                        {
+                            mvpSel[2] = interMode.amvpCand[list][ref][!mvpIdx];
                             mvpIdxSel[2] = !mvpIdx;
-                    case 2: mvpSel[1] = interMode.amvpCand[list][ref][mvpIdx];
-                            mvpIdxSel[1] = mvpIdx;
-                    case 1: mvpSel[0] = interDataCTU->mv[list][cuIdx + puIdx].word;
-                            mvpIdxSel[0] = interDataCTU->mvpIdx[list][cuIdx + puIdx];
+                        }
                     }
                     for (int cand = 0; cand < m_param->mvRefine; cand++)
                     {
--- a/source/x265cli.h	Thu Sep 12 16:34:00 2019 +0530
+++ b/source/x265cli.h	Thu Sep 19 14:14:08 2019 +0530
@@ -549,7 +549,7 @@ static void showHelp(x265_param *param)
         "                                    - 3 : Functionality of (1) + irrespective of size evaluate all inter modes.\n"
         "                                Default:%d\n", param->interRefine);
     H0("   --[no-]dynamic-refine         Dynamically changes refine-inter level for each CU. Default %s\n", OPT(param->bDynamicRefine));
-    H0("   --refine-mv <0..3>            Enable mv refinement for load mode. Default %d\n", param->mvRefine);
+    H0("   --refine-mv <1..3>            Enable mv refinement for load mode. Default %d\n", param->mvRefine);
     H0("   --refine-ctu-distortion       Store/normalize ctu distortion in analysis-save/load.\n"
         "                                    - 0 : Disabled.\n"
         "                                    - 1 : Store/Load ctu distortion to/from the file specified in analysis-save/load.\n"