[x265] [PATCH] define new rdlevels, default presets changed accordingly

deepthidevaki at multicorewareinc.com deepthidevaki at multicorewareinc.com
Fri Nov 29 11:36:26 CET 2013


# HG changeset patch
# User Deepthi Devaki <deepthidevaki at multicorewareinc.com>
# Date 1385721107 -19800
# Node ID d1f5b2e88342c33229405649a3bf3f443d1ac354
# Parent  ac01f12310ed6ba732661bea7afa98f8f5f7816e
define new rdlevels, default presets changed accordingly.

levels 6,5 equivalent to current rd 2, 4 equivalent to current rd 1, and rest equivalent to rd 0. More parameters will be added to distinguish each levels.

diff -r ac01f12310ed -r d1f5b2e88342 source/Lib/TLibEncoder/TEncCfg.h
--- a/source/Lib/TLibEncoder/TEncCfg.h	Fri Nov 29 14:40:18 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncCfg.h	Fri Nov 29 16:01:47 2013 +0530
@@ -156,6 +156,10 @@
     /* copy of parameters used to create encoder */
     x265_param param;
 
+    int       bEnableRDO;
+    int       bEnableRDOQ;
+    int       bEnableRDOQTS;
+
     int       m_pad[2];
     Window    m_conformanceWindow;
 
diff -r ac01f12310ed -r d1f5b2e88342 source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp	Fri Nov 29 14:40:18 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncCu.cpp	Fri Nov 29 16:01:47 2013 +0530
@@ -361,7 +361,7 @@
         xCompressIntraCU(m_bestCU[0], m_tempCU[0], 0);
     else
     {
-        if (!m_cfg->param.bEnableRDO)
+        if (!m_cfg->bEnableRDO)
         {
             TComDataCU* outBestCU = NULL;
 
diff -r ac01f12310ed -r d1f5b2e88342 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Fri Nov 29 14:40:18 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Fri Nov 29 16:01:47 2013 +0530
@@ -465,7 +465,7 @@
 
     //===== transform and quantization =====
     //--- init rate estimation arrays for RDOQ ---
-    if (useTransformSkip ? m_cfg->param.bEnableRDOQTS : m_cfg->param.bEnableRDOQ)
+    if (useTransformSkip ? m_cfg->bEnableRDOQTS : m_cfg->bEnableRDOQ)
     {
         m_entropyCoder->estimateBit(m_trQuant->m_estBitsSbac, width, width, TEXT_LUMA);
     }
@@ -595,7 +595,7 @@
     //===== transform and quantization =====
     {
         //--- init rate estimation arrays for RDOQ ---
-        if (useTransformSkipChroma ? m_cfg->param.bEnableRDOQTS : m_cfg->param.bEnableRDOQ)
+        if (useTransformSkipChroma ? m_cfg->bEnableRDOQTS : m_cfg->bEnableRDOQ)
         {
             m_entropyCoder->estimateBit(m_trQuant->m_estBitsSbac, width, width, ttype);
         }
@@ -3107,7 +3107,7 @@
             cu->setTransformSkipSubParts(0, TEXT_CHROMA_V, absPartIdx, cu->getDepth(0) + trModeC);
         }
 
-        if (m_cfg->param.bEnableRDOQ && curuseRDOQ)
+        if (m_cfg->bEnableRDOQ && curuseRDOQ)
         {
             m_entropyCoder->estimateBit(m_trQuant->m_estBitsSbac, trWidth, trHeight, TEXT_LUMA);
         }
@@ -3122,7 +3122,7 @@
 
         if (bCodeChroma)
         {
-            if (m_cfg->param.bEnableRDOQ && curuseRDOQ)
+            if (m_cfg->bEnableRDOQ && curuseRDOQ)
             {
                 m_entropyCoder->estimateBit(m_trQuant->m_estBitsSbac, trWidthC, trHeightC, TEXT_CHROMA);
             }
@@ -3404,7 +3404,7 @@
 
             cu->setTransformSkipSubParts(1, TEXT_LUMA, absPartIdx, depth);
 
-            if (m_cfg->param.bEnableRDOQTS)
+            if (m_cfg->bEnableRDOQTS)
             {
                 m_entropyCoder->estimateBit(m_trQuant->m_estBitsSbac, trWidth, trHeight, TEXT_LUMA);
             }
@@ -3484,7 +3484,7 @@
             cu->setTransformSkipSubParts(1, TEXT_CHROMA_U, absPartIdx, cu->getDepth(0) + trModeC);
             cu->setTransformSkipSubParts(1, TEXT_CHROMA_V, absPartIdx, cu->getDepth(0) + trModeC);
 
-            if (m_cfg->param.bEnableRDOQTS)
+            if (m_cfg->bEnableRDOQTS)
             {
                 m_entropyCoder->estimateBit(m_trQuant->m_estBitsSbac, trWidthC, trHeightC, TEXT_CHROMA);
             }
diff -r ac01f12310ed -r d1f5b2e88342 source/common/common.cpp
--- a/source/common/common.cpp	Fri Nov 29 14:40:18 2013 +0530
+++ b/source/common/common.cpp	Fri Nov 29 16:01:47 2013 +0530
@@ -182,10 +182,7 @@
     param->bEnableCbfFastMode = 0;
     param->bEnableAMP = 1;
     param->bEnableRectInter = 1;
-    param->rdLevel = X265_NO_RDO_NO_RDOQ;
-    param->bEnableRDO = 0;
-    param->bEnableRDOQ = 0;
-    param->bEnableRDOQTS = 0;
+    param->rdLevel = 3;
     param->bEnableSignHiding = 1;
     param->bEnableTransformSkip = 0;
     param->bEnableTSkipFast = 0;
@@ -347,7 +344,7 @@
             param->lookaheadDepth = 25;
             param->bframes = 8;
             param->bpyramid = 1;
-            param->rdLevel = 1;
+            param->rdLevel = 4;
             param->subpelRefine = 3;
             param->maxNumMergeCand = 3;
             param->searchMethod = X265_STAR_SEARCH;
@@ -358,7 +355,7 @@
             param->bframes = 8;
             param->tuQTMaxInterDepth = 2;
             param->tuQTMaxIntraDepth = 2;
-            param->rdLevel = 2;
+            param->rdLevel = 5;
             param->subpelRefine = 3;
             param->maxNumMergeCand = 3;
             param->searchMethod = X265_STAR_SEARCH;
@@ -369,7 +366,7 @@
             param->bframes = 8;
             param->tuQTMaxInterDepth = 3;
             param->tuQTMaxIntraDepth = 3;			
-            param->rdLevel = 2;
+            param->rdLevel = 6;
             param->subpelRefine = 4;
             param->maxNumMergeCand = 4;
             param->searchMethod = X265_STAR_SEARCH;
@@ -382,12 +379,11 @@
             param->bframes = 8;
             param->tuQTMaxInterDepth = 4;
             param->tuQTMaxIntraDepth = 4;
-            param->rdLevel = 2;
+            param->rdLevel = 6;
             param->subpelRefine = 5;
             param->maxNumMergeCand = 5;
             param->searchMethod = X265_STAR_SEARCH;
             param->bEnableTransformSkip = 1;
-            param->bEnableRDOQTS = 1;
             param->maxNumReferences = 5;
             // TODO: optimized esa
         }
@@ -492,7 +488,7 @@
 
     CHECK(param->rc.rateControlMode<X265_RC_ABR || param->rc.rateControlMode> X265_RC_CRF,
           "Rate control mode is out of range");
-    CHECK(param->rdLevel<X265_NO_RDO_NO_RDOQ || param->rdLevel> X265_FULL_RDO,
+    CHECK(param->rdLevel < 0 || param->rdLevel > 6,
           "RD Level is out of range");
     CHECK(param->bframes > param->lookaheadDepth,
           "Lookahead depth must be greater than the max consecutive bframe count");
@@ -634,12 +630,8 @@
     TOOLOPT(param->bEnableSignHiding, "sign-hide");
     if (param->bEnableTransformSkip)
     {
-        if (param->bEnableTSkipFast && param->bEnableRDOQTS)
-            fprintf(stderr, "tskip(fast+rdo) ");
-        else if (param->bEnableTSkipFast)
+        if (param->bEnableTSkipFast)
             fprintf(stderr, "tskip(fast) ");
-        else if (param->bEnableRDOQTS)
-            fprintf(stderr, "tskip(rdo) ");
         else
             fprintf(stderr, "tskip ");
     }
diff -r ac01f12310ed -r d1f5b2e88342 source/encoder/cturow.cpp
--- a/source/encoder/cturow.cpp	Fri Nov 29 14:40:18 2013 +0530
+++ b/source/encoder/cturow.cpp	Fri Nov 29 16:01:47 2013 +0530
@@ -33,7 +33,7 @@
 {
     m_rdGoOnSbacCoder.init(&m_rdGoOnBinCodersCABAC);
     m_sbacCoder.init(&m_binCoderCABAC);
-    m_trQuant.init(1 << top->getQuadtreeTULog2MaxSize(), top->param.bEnableRDOQ, top->param.bEnableRDOQTS, top->param.bEnableTSkipFast);
+    m_trQuant.init(1 << top->getQuadtreeTULog2MaxSize(), top->bEnableRDOQ, top->bEnableRDOQTS, top->param.bEnableTSkipFast);
 
     m_rdSbacCoders = new TEncSbac * *[g_maxCUDepth + 1];
     m_binCodersCABAC = new TEncBinCABAC * *[g_maxCUDepth + 1];
diff -r ac01f12310ed -r d1f5b2e88342 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Fri Nov 29 14:40:18 2013 +0530
+++ b/source/encoder/encoder.cpp	Fri Nov 29 16:01:47 2013 +0530
@@ -1209,11 +1209,6 @@
     {
         _param->bEnableAMP = false;
     }
-
-    if (!(_param->bEnableRDOQ && _param->bEnableTransformSkip))
-    {
-        _param->bEnableRDOQTS = 0;
-    }
     if (_param->bpyramid && !_param->bframes)
     {
         _param->bpyramid = 0;
@@ -1221,18 +1216,31 @@
     /* Set flags according to RDLevel specified - check_params has verified that RDLevel is within range */
     switch (_param->rdLevel)
     {
-    case X265_NO_RDO_NO_RDOQ:
-        _param->bEnableRDO = _param->bEnableRDOQ = 0;
+    case 6:
+    case 5:
+        bEnableRDO = bEnableRDOQ = bEnableRDOQTS = 1;
         break;
-    case X265_NO_RDO:
-        _param->bEnableRDO = 0;
-        _param->bEnableRDOQ = 1;
+    case 4:
+        bEnableRDO = 0;
+        bEnableRDOQ = 1;
+        bEnableRDOQTS = 1;
         break;
-    case X265_FULL_RDO:
-        _param->bEnableRDO = _param->bEnableRDOQ = 1;
+    case 3:
+        bEnableRDO = 0;
+        bEnableRDOQ = 0;
+        bEnableRDOQTS = 0;
+        break;
+    case 2:
+    case 1:
+    case 0:
+        bEnableRDO = bEnableRDOQ = bEnableRDOQTS = 0;
         break;
     }
 
+    if (!(bEnableRDOQ && _param->bEnableTransformSkip))
+    {
+        bEnableRDOQTS = 0;
+    }
     //====== Coding Tools ========
 
     uint32_t tuQTMaxLog2Size = g_convertToBit[_param->maxCUSize] + 2 - 1;
diff -r ac01f12310ed -r d1f5b2e88342 source/x265.cpp
--- a/source/x265.cpp	Fri Nov 29 14:40:18 2013 +0530
+++ b/source/x265.cpp	Fri Nov 29 16:01:47 2013 +0530
@@ -316,7 +316,7 @@
     H0("   --aq-strength                 Reduces blocking and blurring in flat and textured areas.(0 to 3.0)<double> . Default %f\n", param->rc.aqStrength);
     H0("   --cbqpoffs                    Chroma Cb QP Offset. Default %d\n", param->cbQpOffset);
     H0("   --crqpoffs                    Chroma Cr QP Offset. Default %d\n", param->crQpOffset);
-    H0("   --rd                          Level of RD in mode decision 0:least....2:full RDO. Default %d\n", param->rdLevel);
+    H0("   --rd                          Level of RD in mode decision 0:least....6:full RDO. Default %d\n", param->rdLevel);
     H0("   --[no-]signhide               Hide sign bit of one coeff per TU (rdo). Default %s\n", OPT(param->bEnableSignHiding));
     H0("\nLoop filter:\n");
     H0("   --[no-]lft                    Enable Loop Filter. Default %s\n", OPT(param->bEnableLoopFilter));
diff -r ac01f12310ed -r d1f5b2e88342 source/x265.h
--- a/source/x265.h	Fri Nov 29 14:40:18 2013 +0530
+++ b/source/x265.h	Fri Nov 29 16:01:47 2013 +0530
@@ -509,11 +509,6 @@
      * efficiency at a major cost of performance. Default is no RDO (0) */
     int       rdLevel;
 
-    int       bEnableRDO;    // obsolete
-    int       bEnableRDOQ;   // obsolete
-    int       bEnableRDOQTS; // obsolete
-
-
     /*== Coding tools ==*/
 
     /* Enable the implicit signaling of the sign bit of the last coefficient of


More information about the x265-devel mailing list