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

deepthidevaki at multicorewareinc.com deepthidevaki at multicorewareinc.com
Tue Dec 3 06:54:41 CET 2013


# HG changeset patch
# User Deepthi Devaki <deepthidevaki at multicorewareinc.com>
# Date 1386050055 -19800
# Node ID 63ade0be9d6c642c082b00b101554cba88b0f126
# Parent  e42e7ad909d33666a004413b28b77abe57c246d8
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 e42e7ad909d3 -r 63ade0be9d6c source/Lib/TLibEncoder/TEncCfg.h
--- a/source/Lib/TLibEncoder/TEncCfg.h	Tue Dec 03 11:08:12 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncCfg.h	Tue Dec 03 11:24:15 2013 +0530
@@ -156,6 +156,9 @@
     /* copy of parameters used to create encoder */
     x265_param param;
 
+    int       bEnableRDOQ;
+    int       bEnableRDOQTS;
+
     int       m_pad[2];
     Window    m_conformanceWindow;
 
diff -r e42e7ad909d3 -r 63ade0be9d6c source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp	Tue Dec 03 11:08:12 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncCu.cpp	Tue Dec 03 11:24:15 2013 +0530
@@ -361,7 +361,7 @@
         xCompressIntraCU(m_bestCU[0], m_tempCU[0], 0);
     else
     {
-        if (!m_cfg->param.bEnableRDO)
+        if (m_cfg->param.rdLevel < 5)
         {
             TComDataCU* outBestCU = NULL;
 
@@ -643,7 +643,6 @@
                 else
                     m_log->cntIntraNxN--;
             }
-
             m_log->cntIntra[depth + 1] += boundaryCu;
         }
         xCheckBestMode(outBestCU, outTempCU, depth); // RD compare current prediction with split prediction.
diff -r e42e7ad909d3 -r 63ade0be9d6c source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Tue Dec 03 11:08:12 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Tue Dec 03 11:24:15 2013 +0530
@@ -431,7 +431,6 @@
     TCoeff*  coeff          = m_qtTempCoeffY[qtLayer] + numCoeffPerInc * absPartIdx;
 
     int16_t* reconQt        = m_qtTempTComYuv[qtLayer].getLumaAddr(absPartIdx);
-
     assert(m_qtTempTComYuv[qtLayer].m_width == MAX_CU_SIZE);
 
     uint32_t zorder           = cu->getZorderIdxInCU() + absPartIdx;
@@ -466,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);
     }
@@ -596,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);
         }
@@ -3108,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);
         }
@@ -3123,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);
             }
@@ -3405,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);
             }
@@ -3485,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 e42e7ad909d3 -r 63ade0be9d6c source/common/common.cpp
--- a/source/common/common.cpp	Tue Dec 03 11:08:12 2013 +0530
+++ b/source/common/common.cpp	Tue Dec 03 11:24:15 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;
@@ -345,7 +342,7 @@
         {
             param->lookaheadDepth = 25;
             param->bframes = 4;
-            param->rdLevel = 1;
+            param->rdLevel = 4;
             param->subpelRefine = 3;
             param->maxNumMergeCand = 3;
             param->searchMethod = X265_STAR_SEARCH;
@@ -356,7 +353,7 @@
             param->bframes = 8;
             param->tuQTMaxInterDepth = 2;
             param->tuQTMaxIntraDepth = 2;
-            param->rdLevel = 2;
+            param->rdLevel = 6;
             param->subpelRefine = 3;
             param->maxNumMergeCand = 3;
             param->searchMethod = X265_STAR_SEARCH;
@@ -367,7 +364,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;
@@ -380,12 +377,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
         }
@@ -490,7 +486,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");
@@ -632,12 +628,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 e42e7ad909d3 -r 63ade0be9d6c source/encoder/cturow.cpp
--- a/source/encoder/cturow.cpp	Tue Dec 03 11:08:12 2013 +0530
+++ b/source/encoder/cturow.cpp	Tue Dec 03 11:24:15 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 e42e7ad909d3 -r 63ade0be9d6c source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Tue Dec 03 11:08:12 2013 +0530
+++ b/source/encoder/encoder.cpp	Tue Dec 03 11:24:15 2013 +0530
@@ -1241,21 +1241,32 @@
     /* 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:
+        bEnableRDOQ = bEnableRDOQTS = 1;
         break;
-    case X265_NO_RDO:
-        _param->bEnableRDO = 0;
-        _param->bEnableRDOQ = 1;
+    case 5:
+        bEnableRDOQ = bEnableRDOQTS = 1;
         break;
-    case X265_FULL_RDO:
-        _param->bEnableRDO = _param->bEnableRDOQ = 1;
+    case 4:
+        bEnableRDOQ = bEnableRDOQTS = 1;   
+        break;
+    case 3:
+        bEnableRDOQ = bEnableRDOQTS = 0;
+        break; 
+    case 2:
+        bEnableRDOQ = bEnableRDOQTS = 0;
+        break; 
+    case 1:
+        bEnableRDOQ = bEnableRDOQTS = 0;
+        break; 
+    case 0:
+        bEnableRDOQ = bEnableRDOQTS = 0;
         break;
     }
 
-    if (!(_param->bEnableRDOQ && _param->bEnableTransformSkip))
+    if (!(bEnableRDOQ && _param->bEnableTransformSkip))
     {
-        _param->bEnableRDOQTS = 0;
+        bEnableRDOQTS = 0;
     }
 
     //====== Coding Tools ========
diff -r e42e7ad909d3 -r 63ade0be9d6c source/x265.cpp
--- a/source/x265.cpp	Tue Dec 03 11:08:12 2013 +0530
+++ b/source/x265.cpp	Tue Dec 03 11:24:15 2013 +0530
@@ -323,7 +323,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 e42e7ad909d3 -r 63ade0be9d6c source/x265.h
--- a/source/x265.h	Tue Dec 03 11:08:12 2013 +0530
+++ b/source/x265.h	Tue Dec 03 11:24:15 2013 +0530
@@ -508,10 +508,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