[x265] [PATCH] rc: define default setting and validations for 2 pass states

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Tue Jun 17 16:38:29 CEST 2014


# HG changeset patch
# User Aarthi Thirumalai<aarthi at multicorewareinc.com>
# Date 1403005846 -19800
#      Tue Jun 17 17:20:46 2014 +0530
# Node ID 68023103bf2f9cbf23c5b3f8fd7f4f42b4d3bd4f
# Parent  eb3b6d39b83102dfc7c665e3055c1ffda3322e3e
rc: define default setting and validations for 2 pass states

diff -r eb3b6d39b831 -r 68023103bf2f source/common/param.cpp
--- a/source/common/param.cpp	Tue Jun 17 14:56:02 2014 +0530
+++ b/source/common/param.cpp	Tue Jun 17 17:20:46 2014 +0530
@@ -180,6 +180,10 @@
     param->rc.cuTree = 1;
     param->rc.rfConstantMax = 0;
     param->rc.rfConstantMin = 0;
+    param->rc.statInFileName = 0;
+    param->rc.statOutFileName = 0;
+    param->rc.complexityBlur = 20;
+    param->rc.qblur = 0.5;
 
     /* Quality Measurement Metrics */
     param->bEnablePsnr = 0;
@@ -411,7 +415,6 @@
         else
             return -1;
     }
-
     return 0;
 }
 
@@ -466,7 +469,6 @@
     bool bNameWasBool = false;
     bool bValueWasNull = !value;
     char nameBuf[64];
-
     if (!name)
         return X265_PARAM_BAD_NAME;
 
@@ -911,7 +913,8 @@
         if (s)
             x265_log(param, X265_LOG_WARNING, "--tune %s should be used if attempting to benchmark %s!\n", s, s);
     }
-
+    if (param->bOpenGOP && param->rc.statInFileName)
+        param->lookaheadDepth = 0;
     CHECK(param->rc.qp < -6 * (param->internalBitDepth - 8) || param->rc.qp > 51,
           "QP exceeds supported range (-QpBDOffsety to 51)");
     CHECK(param->fpsNum == 0 || param->fpsDenom == 0,
@@ -966,7 +969,7 @@
           "Rate control mode is out of range");
     CHECK(param->rdLevel < 0 || param->rdLevel > 6,
           "RD Level is out of range");
-    CHECK(param->bframes > param->lookaheadDepth,
+    CHECK(param->bframes > param->lookaheadDepth && !param->rc.statInFileName,
           "Lookahead depth must be greater than the max consecutive bframe count");
     CHECK(param->bframes < 0,
           "bframe count should be greater than zero");
@@ -1049,9 +1052,12 @@
           "Target bitrate can not be less than zero");
     if (param->noiseReduction)
         CHECK(100 > param->noiseReduction || param->noiseReduction > 1000, "Valid noise reduction range 100 - 1000");
+    CHECK(param->rc.rateControlMode == X265_RC_CRF && param->rc.statInFileName,
+          "Constant rate-factor is incompatible with 2pass");
+    CHECK(param->rc.rateControlMode == X265_RC_CQP && param->rc.statInFileName,
+          "Constant QP is incompatible with 2pass");
     return check_failed;
 }
-
 int x265_set_globals(x265_param *param)
 {
     uint32_t maxCUDepth = (uint32_t)g_convertToBit[param->maxCUSize];
diff -r eb3b6d39b831 -r 68023103bf2f source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Tue Jun 17 14:56:02 2014 +0530
+++ b/source/encoder/slicetype.cpp	Tue Jun 17 17:20:46 2014 +0530
@@ -494,7 +494,7 @@
         }
     }
 
-    bool isKeyFrameAnalyse = (m_param->rc.cuTree || (m_param->rc.vbvBufferSize && m_param->lookaheadDepth));
+    bool isKeyFrameAnalyse = (m_param->rc.cuTree || (m_param->rc.vbvBufferSize && m_param->lookaheadDepth)) && !m_param->rc.statInFileName;
     if (isKeyFrameAnalyse && IS_X265_TYPE_I(m_lastNonB->sliceType))
     {
         m_inputQueueLock.acquire();
diff -r eb3b6d39b831 -r 68023103bf2f source/x265.cpp
--- a/source/x265.cpp	Tue Jun 17 14:56:02 2014 +0530
+++ b/source/x265.cpp	Tue Jun 17 17:20:46 2014 +0530
@@ -590,7 +590,6 @@
         return true;
     }
 #endif // if HIGH_BIT_DEPTH
-
     InputFileInfo info;
     info.filename = inputfn;
     info.depth = inputBitDepth;


More information about the x265-devel mailing list