[x264-devel] Re: [MOD] [PATCH] Rate control

Loren Merritt lorenm at u.washington.edu
Wed Aug 11 21:47:25 CEST 2004


On Tue, 10 Aug 2004, [iso-8859-1] Måns Rullgård wrote:

> OK, so my rate control is working after all?  For bitrates I think
> traditionally 1k is considered to be equal to 1000, as your patch
> changes the output to.  I'll leave it to Laurent to decide what to do
> with the patch though.

Working? I didn't say that. The 1000->1024 was just the first bug I
find. Here is (hopefully) the rest of the patch. Then I can return to
2-pass rate control.

--Loren Merritt
-------------- next part --------------
Index: encoder/ratecontrol.c
===================================================================
--- encoder/ratecontrol.c	(revision 24)
+++ encoder/ratecontrol.c	(working copy)
@@ -83,7 +83,7 @@
     rc->qpa = rc->qp;
     rc->qpm = rc->qp;
 
-    rc->buffer_size = h->param.i_rc_buffer_size;
+    rc->buffer_size = h->param.i_rc_buffer_size * 1000;
     if(rc->buffer_size <= 0)
         rc->buffer_size = rc->bitrate / 2;
     rc->buffer_fullness = h->param.i_rc_init_buffer;
@@ -221,14 +221,14 @@
         rc->qp = rc->qpa + dqp;
     }
 
-    if(rc->fbits > 0.8 * maxbits)
+    if(rc->fbits > 0.9 * maxbits)
+        rc->qp += 2;
+    else if(rc->fbits > 0.8 * maxbits)
         rc->qp += 1;
-    else if(rc->fbits > 0.9 * maxbits)
-        rc->qp += 2;
+    else if(rc->fbits < 1.1 * minbits)
+        rc->qp -= 2;
     else if(rc->fbits < 1.2 * minbits)
         rc->qp -= 1;
-    else if(rc->fbits < 1.1 * minbits)
-        rc->qp -= 2;
 
     rc->qp = x264_clip3(rc->qp, h->param.i_qp_min, h->param.i_qp_max);
     rc->qpm = rc->qp;


More information about the x264-devel mailing list