[x265] [PATCH] dqp: add param --max-dqp-depth for maxCuDQPDepth

gopu at multicorewareinc.com gopu at multicorewareinc.com
Fri Mar 13 06:30:14 CET 2015


# HG changeset patch
# User Gopu Govindaswamy <gopu at multicorewareinc.com>
# Date 1426224600 -19800
#      Fri Mar 13 11:00:00 2015 +0530
# Node ID b0b5cd19b384d889094606326c07ad7bae24b18b
# Parent  3187844f4a7f86b1751eaddbb0f0ed926f767eeb
dqp: add param --max-dqp-depth for maxCuDQPDepth

make maxCuDQPDepth set through the param --max-dqp-depth, currently
the default maxCuDQPDepth is 0 then the CuDQP signaled once per CTU, this param
enable the CuDQP signaled for sub-LCU-level also, minimum maxCuDQPDepth is 0
and max maxCuDQPDepth equal to maxCUDepth, always the CuDQP signaled
if currentDepth is less than or equal to maxCuDQPDepth

diff -r 3187844f4a7f -r b0b5cd19b384 source/common/param.cpp
--- a/source/common/param.cpp	Mon Mar 09 14:35:20 2015 +0530
+++ b/source/common/param.cpp	Fri Mar 13 11:00:00 2015 +0530
@@ -210,6 +210,7 @@
     param->rc.zones = NULL;
     param->rc.bEnableSlowFirstPass = 0;
     param->rc.bStrictCbr = 0;
+    param->rc.maxCuDQPDepth = 0;
 
     /* Video Usability Information (VUI) */
     param->vui.aspectRatioIdc = 0;
@@ -838,6 +839,7 @@
     OPT2("pools", "numa-pools") p->numaPools = strdup(value);
     OPT("lambda-file") p->rc.lambdaFileName = strdup(value);
     OPT("analysis-file") p->analysisFileName = strdup(value);
+    OPT("max-dqp-depth") p->rc.maxCuDQPDepth = atoi(value);
     else
         return X265_PARAM_BAD_NAME;
 #undef OPT
diff -r 3187844f4a7f -r b0b5cd19b384 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Mon Mar 09 14:35:20 2015 +0530
+++ b/source/encoder/encoder.cpp	Fri Mar 13 11:00:00 2015 +0530
@@ -1546,15 +1546,11 @@
     bool bIsVbv = m_param->rc.vbvBufferSize > 0 && m_param->rc.vbvMaxBitrate > 0;
 
     if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv))
-    {
         pps->bUseDQP = true;
-        pps->maxCuDQPDepth = 0; /* TODO: make configurable? */
-    }
     else
-    {
         pps->bUseDQP = false;
-        pps->maxCuDQPDepth = 0;
-    }
+
+    pps->maxCuDQPDepth = m_param->rc.maxCuDQPDepth;
 
     pps->chromaQpOffset[0] = m_param->cbQpOffset;
     pps->chromaQpOffset[1] = m_param->crQpOffset;
@@ -1773,6 +1769,17 @@
         p->analysisMode = X265_ANALYSIS_OFF;
         x265_log(p, X265_LOG_WARNING, "Analysis save and load mode not supported for distributed mode analysis\n");
     }
+    bool bIsVbv = m_param->rc.vbvBufferSize > 0 && m_param->rc.vbvMaxBitrate > 0;
+    if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv))
+    {
+        if (p->rc.maxCuDQPDepth > (NUM_CU_DEPTH - 1))
+        {
+            p->rc.maxCuDQPDepth = 0;
+            x265_log(p, X265_LOG_WARNING, "The maxCUDQPDepth should be less than maxCUDepth setting maxCUDQPDepth = %d \n", 0);
+        }
+    }
+    else
+        p->rc.maxCuDQPDepth = 0;
 }
 
 void Encoder::allocAnalysis(x265_analysis_data* analysis)
diff -r 3187844f4a7f -r b0b5cd19b384 source/x265.h
--- a/source/x265.h	Mon Mar 09 14:35:20 2015 +0530
+++ b/source/x265.h	Fri Mar 13 11:00:00 2015 +0530
@@ -977,6 +977,13 @@
         /* Enable stricter conditions to check bitrate deviations in CBR mode. May compromise 
          * quality to maintain bitrate adherence */
         int bStrictCbr;
+
+        /* Max depth of a minimum CuDQP for sub-LCU-level delta QP
+         * the default maxCuDQPDepth is 0 then the CuDQP signaled once per CTU, this param
+         * enable the CuDQP signaled for sub-LCU-level also, minimum maxCuDQPDepth is 0
+         * and max maxCuDQPDepth is equal to maxCUDepth, always the CuDQP signaled
+         * if currentDepth is less than or equal to maxCuDQPDepth */
+        int maxCuDQPDepth;
     } rc;
 
     /*== Video Usability Information ==*/
diff -r 3187844f4a7f -r b0b5cd19b384 source/x265cli.h
--- a/source/x265cli.h	Mon Mar 09 14:35:20 2015 +0530
+++ b/source/x265cli.h	Fri Mar 13 11:00:00 2015 +0530
@@ -202,6 +202,7 @@
     { "strict-cbr",           no_argument, NULL, 0 },
     { "temporal-layers",      no_argument, NULL, 0 },
     { "no-temporal-layers",   no_argument, NULL, 0 },
+    { "max-dqp-depth",  required_argument, NULL, 0 },
     { 0, 0, 0, 0 },
     { 0, 0, 0, 0 },
     { 0, 0, 0, 0 },


More information about the x265-devel mailing list