[x264-devel] CRF-max: don't warn if VBV underflow occurs

Jason Garrett-Glaser git at videolan.org
Wed Oct 30 21:18:33 CET 2013


x264 | branch: master | Jason Garrett-Glaser <jason at x264.com> | Thu Oct 24 14:44:43 2013 -0700| [e0b8b2565f153f1b8f87c054d5a3bde75b2fd45e] | committer: Jason Garrett-Glaser

CRF-max: don't warn if VBV underflow occurs

Only warn if underflow occurs for reasons other than CRF-max, as CRF-max
implies that VBV underflow is desired by the user.

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

 encoder/ratecontrol.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index 1a39a49..1e98f92 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -101,7 +101,7 @@ struct x264_ratecontrol_t
     double vbv_max_rate;        /* # of bits added to buffer_fill per second */
     predictor_t *pred;          /* predict frame size from satd */
     int single_frame_vbv;
-    double rate_factor_max_increment; /* Don't allow RF above (CRF + this value). */
+    float rate_factor_max_increment; /* Don't allow RF above (CRF + this value). */
 
     /* ABR stuff */
     int    last_satd;
@@ -2108,7 +2108,13 @@ static int update_vbv( x264_t *h, int bits )
     rct->buffer_fill_final -= (uint64_t)bits * h->sps->vui.i_time_scale;
 
     if( rct->buffer_fill_final < 0 )
-        x264_log( h, X264_LOG_WARNING, "VBV underflow (frame %d, %.0f bits)\n", h->i_frame, (double)rct->buffer_fill_final / h->sps->vui.i_time_scale );
+    {
+        double underflow = (double)rct->buffer_fill_final / h->sps->vui.i_time_scale;
+        if( rcc->rate_factor_max_increment && rcc->qpm >= rcc->qp_novbv + rcc->rate_factor_max_increment )
+            x264_log( h, X264_LOG_DEBUG, "VBV underflow due to CRF-max (frame %d, %.0f bits)\n", h->i_frame, underflow );
+        else
+            x264_log( h, X264_LOG_WARNING, "VBV underflow (frame %d, %.0f bits)\n", h->i_frame, underflow );
+    }
     rct->buffer_fill_final = X264_MAX( rct->buffer_fill_final, 0 );
 
     if( h->param.b_avcintra_compat )



More information about the x264-devel mailing list