[x264-devel] commit: Fix bug in 2pass if the first P-frames are all skip ( Anton Mitrofanov )

git at videolan.org git at videolan.org
Sat Sep 4 01:24:49 CEST 2010


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Sun Aug 29 16:35:32 2010 +0400| [5978cbc53dec1e7023b2ba9c9f9ce6ed24ffc68b] | committer: Jason Garrett-Glaser 

Fix bug in 2pass if the first P-frames are all skip
last_qscale_for was read before being initialized in this case, resulting
in the value from the previous iteration being used instead.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=5978cbc53dec1e7023b2ba9c9f9ce6ed24ffc68b
---

 encoder/ratecontrol.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index d9d118a..cf51f37 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -2518,6 +2518,7 @@ static int init_pass2( x264_t *h )
     const int filter_size = (int)(qblur*4) | 1;
     double expected_bits;
     double *qscale, *blurred_qscale;
+    double base_cplx = h->mb.i_mb_count * (h->param.i_bframe ? 120 : 80);
 
     /* find total/average complexity & const_bits */
     for( int i = 0; i < rcc->num_entries; i++ )
@@ -2602,6 +2603,10 @@ static int init_pass2( x264_t *h )
         rcc->last_accum_p_norm = 1;
         rcc->accum_p_norm = 0;
 
+        rcc->last_qscale_for[0] =
+        rcc->last_qscale_for[1] =
+        rcc->last_qscale_for[2] = pow( base_cplx, 1 - rcc->qcompress ) / rate_factor;
+
         /* find qscale */
         for( int i = 0; i < rcc->num_entries; i++ )
         {



More information about the x264-devel mailing list