[x265] [PATCH 6 of 6] rc: introduce cli option to tune for cbr

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Wed Nov 26 19:41:52 CET 2014


# HG changeset patch
# User Aarthi Thirumalai
# Date 1417027125 -19800
#      Thu Nov 27 00:08:45 2014 +0530
# Node ID f8900bdec0ae488441e33b8b9127351ce9981f7e
# Parent  e9170b02106e06feed757eeba1e771ca14c64f27
rc: introduce cli option to tune for cbr.

diff -r e9170b02106e -r f8900bdec0ae source/CMakeLists.txt
--- a/source/CMakeLists.txt	Tue Nov 25 18:05:57 2014 +0530
+++ b/source/CMakeLists.txt	Thu Nov 27 00:08:45 2014 +0530
@@ -21,7 +21,7 @@
 include(CheckCXXCompilerFlag)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 37)
+set(X265_BUILD 38)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r e9170b02106e -r f8900bdec0ae source/common/param.cpp
--- a/source/common/param.cpp	Tue Nov 25 18:05:57 2014 +0530
+++ b/source/common/param.cpp	Thu Nov 27 00:08:45 2014 +0530
@@ -420,6 +420,11 @@
             param->rc.aqStrength = 0.3;
             param->rc.qCompress = 0.8;
         }
+        else if (!strcmp(tune, "cbr"))
+        {
+            param->rc.pbFactor = 1.0;
+            param->rc.rateTolerance = 0.5;
+        }
         else
             return -1;
     }
diff -r e9170b02106e -r f8900bdec0ae source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Tue Nov 25 18:05:57 2014 +0530
+++ b/source/encoder/ratecontrol.cpp	Thu Nov 27 00:08:45 2014 +0530
@@ -410,8 +410,6 @@
     }
 
     m_isCbr = m_param->rc.rateControlMode == X265_RC_ABR && m_isVbv && !m_2pass && m_param->rc.vbvMaxBitrate <= m_param->rc.bitrate;
-    if (m_isCbr)
-        m_param->rc.pbFactor = 1.0;
     m_leadingBframes = m_param->bframes;
     m_bframeBits = 0;
     m_leadingNoBSatd = 0;
diff -r e9170b02106e -r f8900bdec0ae source/x265.cpp
--- a/source/x265.cpp	Tue Nov 25 18:05:57 2014 +0530
+++ b/source/x265.cpp	Thu Nov 27 00:08:45 2014 +0530
@@ -389,7 +389,7 @@
     H0("-p/--preset <string>             Trade off performance for compression efficiency. Default medium\n");
     H0("                                 ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, or placebo\n");
     H0("-t/--tune <string>               Tune the settings for a particular type of source or situation:\n");
-    H0("                                 psnr, ssim, grain, zerolatency, or fastdecode\n");
+    H0("                                 psnr, ssim, grain, zerolatency, fastdecode or cbr\n");
     H0("\nQuad-Tree size and depth:\n");
     H0("-s/--ctu <64|32|16>              Maximum CU size (WxH). Default %d\n", param->maxCUSize);
     H0("   --tu-intra-depth <integer>    Max TU recursive depth for intra CUs. Default %d\n", param->tuQTMaxIntraDepth);
diff -r e9170b02106e -r f8900bdec0ae source/x265.h
--- a/source/x265.h	Tue Nov 25 18:05:57 2014 +0530
+++ b/source/x265.h	Thu Nov 27 00:08:45 2014 +0530
@@ -1025,7 +1025,7 @@
  *      100 times faster than placebo!
  *
  *      Currently available tunings are: */
-static const char * const x265_tune_names[] = { "psnr", "ssim", "zerolatency", "fastdecode", 0 };
+static const char * const x265_tune_names[] = { "psnr", "ssim", "zerolatency", "fastdecode", "cbr", 0 };
 
 /*      returns 0 on success, negative on failure (e.g. invalid preset/tune name). */
 int x265_param_default_preset(x265_param *, const char *preset, const char *tune);


More information about the x265-devel mailing list