<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Sep 24, 2013 at 1:33 AM,  <span dir="ltr"><<a href="mailto:sumalatha@multicorewareinc.com" target="_blank">sumalatha@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 sumalatha polureddy<br>
# Date 1380004245 -19800<br>
# Node ID 759460e7afeeb7d97ea427a702ac08eb9d8a3293<br>
# Parent  6fa50183e0098f9e94b677ef8dc00c416f28c0f3<br>
RateControl : Bug fix when previous estimated frame cost is zero<br></blockquote><div><br></div><div>queued for stable after some white-space cleanups</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

diff -r 6fa50183e009 -r 759460e7afee source/encoder/ratecontrol.cpp<br>
--- a/source/encoder/ratecontrol.cpp    Tue Sep 24 11:56:43 2013 +0530<br>
+++ b/source/encoder/ratecontrol.cpp    Tue Sep 24 12:00:45 2013 +0530<br>
@@ -62,7 +62,7 @@<br>
     lastNonBPictType = -1;<br>
     baseQp = param->rc.qp;<br>
     qp = baseQp;<br>
-<br>
+    lastRceq = 1; // handles the cmplxrsum when the previous frame cost is zero<br>
     // heuristics- encoder specific<br>
     qCompress = param->rc.qCompress; // tweak and test for x265.<br>
     ipFactor = param->rc.ipFactor;<br>
@@ -255,15 +255,20 @@<br>
                 lqmax = lastQScaleFor[pictType] * lstep;<br>
             }<br>
             /* Rate control needs to be more aggressive based on actual costs obtained for  previous encoded frame */<br>
-            if (overflow > 1.1 && framesDone > 3)<br>
-            {<br>
-                lqmax *= lstep;<br>
-                lqmin*= pow(lstep,1/frameThreads);<br>
-            }<br>
-            else if (overflow < 0.9)<br>
-            {<br>
-                lqmin /= lstep;<br>
-                lqmax /= pow(lstep,1/frameThreads);<br>
+            int rfAdapt = 1;<br>
+            if (overflow > 1.1 && framesDone > 3)<br>
+            {<br>
+                //Control propagation of excessive overflow / underfow<br>
+                if(overflow > 1.5)<br>
+                    rfAdapt = 2;<br>
+                lqmax *= pow(lstep, rfAdapt);<br>
+            }<br>
+            else if (overflow < 0.9)<br>
+            {<br>
+                if(overflow < 0.6)<br>
+                    rfAdapt = 2;<br>
+                lqmin /= pow(lstep, rfAdapt);<br>
+                lqmax /= pow(lstep, rfAdapt / frameThreads);<br>
             }<br>
             q = Clip3(lqmin, lqmax, q);<br>
         }<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><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>