]> git.videolan.org Git - x264.git/commitdiff
Fix a potential failure in VBV
authorJason Garrett-Glaser <darkshikari@gmail.com>
Fri, 14 Aug 2009 00:13:33 +0000 (17:13 -0700)
committerJason Garrett-Glaser <darkshikari@gmail.com>
Fri, 14 Aug 2009 00:13:33 +0000 (17:13 -0700)
If VBV does underflow, ratecontrol could be permanently broken for the rest of the clip.
Revert part of the previous VBV changes to fix this.

encoder/ratecontrol.c

index f60fc43d0f78862b4d5ad52bbede88ae4d5587a0..8eaa178270f76574adeffc353b2345fad04ecc0a 100644 (file)
@@ -1459,7 +1459,7 @@ static double clip_qscale( x264_t *h, int pict_type, double q )
         double bits = predict_size( &rcc->pred[h->sh.i_type], q, rcc->last_satd );
         double qf = 1.0;
         if( bits > rcc->buffer_fill/2 )
-            qf = rcc->buffer_fill/(2*bits);
+            qf = x264_clip3f( rcc->buffer_fill/(2*bits), 0.2, 1.0 );
         q /= qf;
         bits *= qf;
         if( bits < rcc->buffer_rate/2 )