changeset 5442:86d23688b017

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.
author Deepthi Devaki <deepthidevaki@multicorewareinc.com>
date Tue, 03 Dec 2013 11:24:15 +0530
parents 9f96817c8894
children 660ec2c02798 04350bfb3147
files source/Lib/TLibEncoder/TEncCfg.h source/Lib/TLibEncoder/TEncCu.cpp source/Lib/TLibEncoder/TEncSearch.cpp source/common/common.cpp source/encoder/cturow.cpp source/encoder/encoder.cpp source/x265.cpp source/x265.h
diffstat 8 files changed, 39 insertions(+-), 39 deletions(-) [+]
line wrap: on
line diff
--- 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 @@ public:
     /* copy of parameters used to create encoder */
     x265_param param;
 
+    int       bEnableRDOQ;
+    int       bEnableRDOQTS;
+
     int       m_pad[2];
     Window    m_conformanceWindow;
 
--- 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 @@ void TEncCu::compressCU(TComDataCU* cu)
         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 @@ void TEncCu::xCompressIntraCU(TComDataCU
                 else
                     m_log->cntIntraNxN--;
             }
-
             m_log->cntIntra[depth + 1] += boundaryCu;
         }
         xCheckBestMode(outBestCU, outTempCU, depth); // RD compare current prediction with split prediction.
--- 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 @@ void TEncSearch::xIntraCodingLumaBlk(TCo
     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 @@ void TEncSearch::xIntraCodingLumaBlk(TCo
 
     //===== 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 @@ void TEncSearch::xIntraCodingChromaBlk(T
     //===== 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 @@ void TEncSearch::xEstimateResidualQT(TCo
             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 @@ void TEncSearch::xEstimateResidualQT(TCo
 
         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 @@ void TEncSearch::xEstimateResidualQT(TCo
 
             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 @@ void TEncSearch::xEstimateResidualQT(TCo
             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);
             }
--- 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 @@ void x265_param_default(x265_param *para
     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 @@ int x265_param_default_preset(x265_param
         {
             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 @@ int x265_param_default_preset(x265_param
             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 @@ int x265_param_default_preset(x265_param
             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 @@ int x265_param_default_preset(x265_param
             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
         }
@@ -491,7 +487,7 @@ int x265_check_params(x265_param *param)
 
     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");
@@ -633,12 +629,8 @@ void x265_print_params(x265_param *param
     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 ");
     }
--- 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 @@ void CTURow::create(Encoder* top)
 {
     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];
--- 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 @@ void Encoder::configure(x265_param *_par
     /* 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 ========
--- 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 @@ void CLIOptions::showHelp(x265_param *pa
     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));
--- 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 @@ typedef struct x265_param
      * 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