[x265] [PATCH 1 of 4] rc: log warnings if rfConstantMin is greater than rcConstant

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Thu May 8 20:28:24 CEST 2014


# HG changeset patch
# User Aarthi Thirumalai
# Date 1399572839 -19800
#      Thu May 08 23:43:59 2014 +0530
# Node ID 06c641032ed727f7160c3c6e412576b2f8935a19
# Parent  8e64aa56d6352a1a8cfb6fb57cb547607bcec9b1
rc: log warnings if rfConstantMin is greater than rcConstant.

diff -r 8e64aa56d635 -r 06c641032ed7 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Thu May 08 11:01:04 2014 +0530
+++ b/source/encoder/ratecontrol.cpp	Thu May 08 23:43:59 2014 +0530
@@ -218,6 +218,7 @@
         double mbtree_offset = param->rc.cuTree ? (1.0 - param->rc.qCompress) * 13.5 : 0;
         rateFactorConstant = pow(baseCplx, 1 - qCompress) /
             x265_qp2qScale(param->rc.rfConstant + mbtree_offset);
+
         if (param->rc.rfConstantMax)
         {
             rateFactorMaxIncrement = param->rc.rfConstantMax - param->rc.rfConstant;
@@ -228,7 +229,14 @@
             }
         }
         if (param->rc.rfConstantMin)
+        {
             rateFactorMaxDecrement = param->rc.rfConstant - param->rc.rfConstantMin;
+            if (rateFactorMaxDecrement <= 0)
+            {
+                x265_log(param, X265_LOG_WARNING, "CRF min must be lesser than CRF\n");
+                rateFactorMaxDecrement = 0;
+            }
+        }
     }
 
     isAbr = param->rc.rateControlMode != X265_RC_CQP; // later add 2pass option
@@ -304,7 +312,7 @@
             param->rc.vbvBufferInit = Clip3(0.0, 1.0, param->rc.vbvBufferInit / param->rc.vbvBufferSize);
         param->rc.vbvBufferInit = Clip3(0.0, 1.0, X265_MAX(param->rc.vbvBufferInit, bufferRate / bufferSize));
         bufferFillFinal = bufferSize * param->rc.vbvBufferInit;
-        vbvMinRate = /*!rc->b_2pass && */ param->rc.rateControlMode == X265_RC_ABR
+        vbvMinRate = param->rc.rateControlMode == X265_RC_ABR
             && param->rc.vbvMaxBitrate <= param->rc.bitrate;
     }
 


More information about the x265-devel mailing list