<div dir="ltr">Thanks, need to increment X265_BUILD version number as well.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 30, 2014 at 2:51 PM, <span dir="ltr"><<a href="mailto:aarthi@multicorewareinc.com" target="_blank">aarthi@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Aarthi Thirumalai<br>
# Date 1419332550 -19800<br>
# Tue Dec 23 16:32:30 2014 +0530<br>
# Node ID 98dfd6e0c72122e8613208d5927a4c81da6a8e7a<br>
# Parent 32ed3f21039a5b93a54da8961442825e4db69d88<br>
cli: remove tune cbr and introduce strict-cbr as a param option instead<br>
<br>
strict-cbr can be enabled in CBR mode, enforces stricter checks for bitrate adhearance and<br>
lesser tolerance for bitrate deviance from the target.<br>
<br>
diff -r 32ed3f21039a -r 98dfd6e0c721 doc/reST/cli.rst<br>
--- a/doc/reST/cli.rst Mon Dec 29 13:49:02 2014 +0530<br>
+++ b/doc/reST/cli.rst Tue Dec 23 16:32:30 2014 +0530<br>
@@ -209,7 +209,7 @@<br>
be applied after :option:`--preset` but before all other parameters. Default none.<br>
See :ref:`tunings <tunings>` for more detail.<br>
<br>
- **Values:** psnr, ssim, grain, zero-latency, fast-decode, cbr.<br>
+ **Values:** psnr, ssim, grain, zero-latency, fast-decode.<br>
<br>
Input/Output File Options<br>
=========================<br>
@@ -992,6 +992,12 @@<br>
* :option:`--subme` = MIN(2, :option:`--subme`)<br>
* :option:`--rd` = MIN(2, :option:`--rd`)<br>
<br>
+.. option:: --strict-cbr, --no-strict-cbr<br>
+<br>
+ Enables stricter conditions to control bitrate<br>
+ deviance from the target in CBR mode. Bitrate adhearance is prioritised<br>
+ over quality. Rate tolerance is set to 50%. Default disabled<br>
+<br>
.. option:: --cbqpoffs <integer><br>
<br>
Offset of Cb chroma QP from the luma QP selected by rate control.<br>
diff -r 32ed3f21039a -r 98dfd6e0c721 source/common/param.cpp<br>
--- a/source/common/param.cpp Mon Dec 29 13:49:02 2014 +0530<br>
+++ b/source/common/param.cpp Tue Dec 23 16:32:30 2014 +0530<br>
@@ -206,6 +206,7 @@<br>
param->rc.complexityBlur = 20;<br>
param->rc.qblur = 0.5;<br>
param->rc.bEnableSlowFirstPass = 0;<br>
+ param->rc.bStrictCbr = 0;<br>
<br>
/* Video Usability Information (VUI) */<br>
param->vui.aspectRatioIdc = 0;<br>
@@ -421,11 +422,6 @@<br>
param->rc.aqStrength = 0.3;<br>
param->rc.qCompress = 0.8;<br>
}<br>
- else if (!strcmp(tune, "cbr"))<br>
- {<br>
- param->rc.pbFactor = 1.0;<br>
- param->rc.rateTolerance = 0.5;<br>
- }<br>
else<br>
return -1;<br>
}<br>
@@ -699,6 +695,12 @@<br>
OPT("me") p->searchMethod = parseName(value, x265_motion_est_names, bError);<br>
OPT("cutree") p->rc.cuTree = atobool(value);<br>
OPT("slow-firstpass") p->rc.bEnableSlowFirstPass = atobool(value);<br>
+ OPT("strict-cbr")<br>
+ {<br>
+ p->rc.bStrictCbr = atobool(value);<br>
+ p->rc.pbFactor = 1.0;<br>
+ p->rc.rateTolerance = 0.5;<br>
+ }<br>
OPT("analysis-mode") p->analysisMode = parseName(value, x265_analysis_names, bError);<br>
OPT("sar")<br>
{<br>
@@ -1087,6 +1089,8 @@<br>
"Constant rate-factor is incompatible with 2pass");<br>
CHECK(param->rc.rateControlMode == X265_RC_CQP && param->rc.bStatRead,<br>
"Constant QP is incompatible with 2pass");<br>
+ CHECK(param->rc.bStrictCbr && (param->rc.bitrate <= 0 || param->rc.vbvBufferSize <=0),<br>
+ "Strict-cbr cannot be applied without specifying target bitrate or vbv bufsize");<br>
return check_failed;<br>
}<br>
<br>
diff -r 32ed3f21039a -r 98dfd6e0c721 source/encoder/ratecontrol.cpp<br>
--- a/source/encoder/ratecontrol.cpp Mon Dec 29 13:49:02 2014 +0530<br>
+++ b/source/encoder/ratecontrol.cpp Tue Dec 23 16:32:30 2014 +0530<br>
@@ -324,10 +324,6 @@<br>
m_numEntries = 0;<br>
m_amortizeFraction = 0.85;<br>
m_amortizeFrames = 75;<br>
- if (m_param->totalFrames <= 2 * m_fps)<br>
- {<br>
- m_amortizeFraction = m_amortizeFrames = 0;<br>
- }<br>
if (m_param->rc.rateControlMode == X265_RC_CRF)<br>
{<br>
m_param->rc.qp = (int)m_param->rc.rfConstant;<br>
@@ -396,6 +392,11 @@<br>
x265_log(m_param, X265_LOG_WARNING, "max bitrate less than average bitrate, assuming CBR\n");<br>
m_param->rc.bitrate = m_param->rc.vbvMaxBitrate;<br>
}<br>
+ if (m_param->rc.bStrictCbr && m_param->rc.vbvMaxBitrate != m_param->rc.bitrate)<br>
+ {<br>
+ x265_log(m_param, X265_LOG_WARNING, "strict CBR set without CBR mode, ignored\n");<br>
+ m_param->rc.bStrictCbr = 0;<br>
+ }<br>
}<br>
else if (m_param->rc.vbvMaxBitrate)<br>
{<br>
@@ -408,7 +409,11 @@<br>
x265_log(m_param, X265_LOG_WARNING, "NAL HRD parameters require VBV parameters, ignored\n");<br>
m_param->bEmitHRDSEI = 0;<br>
}<br>
-<br>
+ if (m_param->totalFrames <= 2 * m_fps && m_param->rc.bStrictCbr)<br>
+ {<br>
+ m_amortizeFraction = 0;<br>
+ m_amortizeFrames = 0;<br>
+ }<br>
m_isCbr = m_param->rc.rateControlMode == X265_RC_ABR && m_isVbv && !m_2pass && m_param->rc.vbvMaxBitrate <= m_param->rc.bitrate;<br>
m_leadingBframes = m_param->bframes;<br>
m_bframeBits = 0;<br>
diff -r 32ed3f21039a -r 98dfd6e0c721 source/x265.cpp<br>
--- a/source/x265.cpp Mon Dec 29 13:49:02 2014 +0530<br>
+++ b/source/x265.cpp Tue Dec 23 16:32:30 2014 +0530<br>
@@ -217,6 +217,7 @@<br>
{ "no-slow-firstpass", no_argument, NULL, 0 },<br>
{ "analysis-mode", required_argument, NULL, 0 },<br>
{ "analysis-file", required_argument, NULL, 0 },<br>
+ { "strict-cbr", no_argument, NULL, 0 },<br>
{ 0, 0, 0, 0 }<br>
};<br>
<br>
@@ -457,6 +458,7 @@<br>
" - 3 : Nth pass, overwrites stats file\n");<br>
H0(" --stats Filename for stats file in multipass pass rate control. Default x265_2pass.log\n");<br>
H0(" --[no-]slow-firstpass Enable a slow first pass in a multipass rate control mode. Default %s\n", OPT(param->rc.bEnableSlowFirstPass));<br>
+ H0(" --[no-]strict-cbr Enable stricter conditions and tolerance for bitrate deviations in CBR mode. Default %s\n", OPT(param->rc.bStrictCbr));<br>
H0(" --analysis-mode <string|int> save - Dump analysis info into file, load - Load analysis buffers from the file. Default %d\n", param->analysisMode);<br>
H0(" --analysis-file <filename> Specify file name used for either dumping or reading analysis data.\n");<br>
H0(" --aq-mode <integer> Mode for Adaptive Quantization - 0:none 1:uniform AQ 2:auto variance. Default %d\n", param->rc.aqMode);<br>
diff -r 32ed3f21039a -r 98dfd6e0c721 source/x265.h<br>
--- a/source/x265.h Mon Dec 29 13:49:02 2014 +0530<br>
+++ b/source/x265.h Tue Dec 23 16:32:30 2014 +0530<br>
@@ -875,6 +875,10 @@<br>
* ignored. The lambda tables are process-global, so these new lambda<br>
* values will affect all encoders in the same process */<br>
const char* lambdaFileName;<br>
+<br>
+ /* Enable stricter conditions to check bitrate deviations in CBR mode. May compromise<br>
+ quality to maintain bitrate adhearance */<br>
+ int bStrictCbr;<br>
} rc;<br>
<br>
/*== Video Usability Information ==*/<br>
@@ -1032,7 +1036,7 @@<br>
* 100 times faster than placebo!<br>
*<br>
* Currently available tunings are: */<br>
-static const char * const x265_tune_names[] = { "psnr", "ssim", "grain", "zerolatency", "fastdecode", "cbr", 0 };<br>
+static const char * const x265_tune_names[] = { "psnr", "ssim", "grain", "zerolatency", "fastdecode", 0 };<br>
<br>
/* returns 0 on success, negative on failure (e.g. invalid preset/tune name). */<br>
int x265_param_default_preset(x265_param *, const char *preset, const char *tune);<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br></div>