<div dir="ltr">Looks good. Pushed to default.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 22, 2020 at 12:44 PM <<a href="mailto:kirithika@multicorewareinc.com">kirithika@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"># HG changeset patch<br>
# User Kirithika <<a href="mailto:kirithika@multicorewareinc.com" target="_blank">kirithika@multicorewareinc.com</a>><br>
# Date 1571388480 -19800<br>
# Fri Oct 18 14:18:00 2019 +0530<br>
# Node ID 851a02eea935bacf74eb35655798f72892580880<br>
# Parent 6bb2d88029c2e13fa13b5b053aa725d4fa84a084<br>
Fix the RC Pass2 ABR<br>
<br>
This commit does the following changes:<br>
1. Fix the order of RC Pass 1 stats Analysis in Pass2<br>
2. Fix the aggressive Qp tuning for I/P frames in Pass2<br>
<br>
diff -r 6bb2d88029c2 -r 851a02eea935 source/encoder/ratecontrol.cpp<br>
--- a/source/encoder/ratecontrol.cpp Thu Apr 09 13:09:15 2020 +0530<br>
+++ b/source/encoder/ratecontrol.cpp Fri Oct 18 14:18:00 2019 +0530<br>
@@ -833,7 +833,7 @@<br>
/* weighted average of cplx of future frames */<br>
for (int j = 1; j < cplxBlur * 2 && j < m_numEntries - i; j++)<br>
{<br>
- int index = m_encOrder[i + j];<br>
+ int index = i+j;<br>
RateControlEntry *rcj = &m_rce2Pass[index];<br>
weight *= 1 - pow(rcj->iCuCount / m_ncu, 2);<br>
if (weight < 0.0001)<br>
@@ -846,7 +846,7 @@<br>
weight = 1.0;<br>
for (int j = 0; j <= cplxBlur * 2 && j <= i; j++)<br>
{<br>
- int index = m_encOrder[i - j];<br>
+ int index = i-j;<br>
RateControlEntry *rcj = &m_rce2Pass[index];<br>
gaussianWeight = weight * exp(-j * j / 200.0);<br>
weightSum += gaussianWeight;<br>
@@ -855,7 +855,7 @@<br>
if (weight < .0001)<br>
break;<br>
}<br>
- m_rce2Pass[m_encOrder[i]].blurredComplexity = cplxSum / weightSum;<br>
+ m_rce2Pass[i].blurredComplexity= cplxSum / weightSum;<br>
}<br>
CHECKED_MALLOC(qScale, double, m_numEntries);<br>
if (filterSize > 1)<br>
@@ -874,7 +874,7 @@<br>
expectedBits = 1;<br>
for (int i = 0; i < m_numEntries; i++)<br>
{<br>
- RateControlEntry* rce = &m_rce2Pass[m_encOrder[i]];<br>
+ RateControlEntry* rce = &m_rce2Pass[i];<br>
double q = getQScale(rce, 1.0);<br>
expectedBits += qScale2bits(rce, q);<br>
m_lastQScaleFor[rce->sliceType] = q;<br>
@@ -897,15 +897,15 @@<br>
/* find qscale */<br>
for (int i = 0; i < m_numEntries; i++)<br>
{<br>
- RateControlEntry *rce = &m_rce2Pass[m_encOrder[i]];<br>
+ RateControlEntry *rce = &m_rce2Pass[i];<br>
qScale[i] = getQScale(rce, rateFactor);<br>
m_lastQScaleFor[rce->sliceType] = qScale[i];<br>
}<br>
<br>
/* fixed I/B qscale relative to P */<br>
- for (int i = m_numEntries - 1; i >= 0; i--)<br>
+ for (int i = 0; i < m_numEntries; i++)<br>
{<br>
- qScale[i] = getDiffLimitedQScale(&m_rce2Pass[m_encOrder[i]], qScale[i]);<br>
+ qScale[i] = getDiffLimitedQScale(&m_rce2Pass[i], qScale[i]);<br>
X265_CHECK(qScale[i] >= 0, "qScale became negative\n");<br>
}<br>
<br>
@@ -916,7 +916,6 @@<br>
for (int i = 0; i < m_numEntries; i++)<br>
{<br>
double q = 0.0, sum = 0.0;<br>
-<br>
for (int j = 0; j < filterSize; j++)<br>
{<br>
int idx = i + j - filterSize / 2;<br>
@@ -924,7 +923,7 @@<br>
double coeff = qBlur == 0 ? 1.0 : exp(-d * d / (qBlur * qBlur));<br>
if (idx < 0 || idx >= m_numEntries)<br>
continue;<br>
- if (m_rce2Pass[m_encOrder[i]].sliceType != m_rce2Pass[m_encOrder[idx]].sliceType)<br>
+ if (m_rce2Pass[i].sliceType != m_rce2Pass[idx].sliceType)<br>
continue;<br>
q += qScale[idx] * coeff;<br>
sum += coeff;<br>
@@ -936,7 +935,7 @@<br>
/* find expected bits */<br>
for (int i = 0; i < m_numEntries; i++)<br>
{<br>
- RateControlEntry *rce = &m_rce2Pass[m_encOrder[i]];<br>
+ RateControlEntry *rce = &m_rce2Pass[i];<br>
rce->newQScale = clipQscale(NULL, rce, blurredQscale[i]); // check if needed<br>
X265_CHECK(rce->newQScale >= 0, "new Qscale is negative\n");<br>
expectedBits += qScale2bits(rce, rce->newQScale);<br>
@@ -1956,7 +1955,7 @@<br>
/* Adjust quant based on the difference between<br>
* achieved and expected bitrate so far */<br>
double curTime = (double)rce->encodeOrder / m_numEntries;<br>
- double w = x265_clip3(0.0, 1.0, curTime * 100);<br>
+ double w = x265_clip3(0.0, 1.0, curTime);<br>
q *= pow((double)m_totalBits / m_expectedBitsSum, w);<br>
}<br>
if (m_framesDone == 0 && m_param->rc.rateControlMode == X265_RC_ABR && m_isGrainEnabled)<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="georgia, serif">Regards,</font><div><b><font face="georgia, serif">Aruna Matheswaran,</font></b></div><div><font face="georgia, serif">Video Codec Engineer,</font></div><div><font face="georgia, serif">Media & AI analytics BU,</font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" width="96" height="36" style="margin-left: 0px; margin-top: 0px;"></span></span></span><font face="georgia, serif"><br></font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" style="margin-left: 0px; margin-top: 0px;"></span></span></span><font face="georgia, serif"><br></font></div><div><font face="georgia, serif"><br></font></div></div></div></div></div></div></div></div></div>