From: Fiona Glaser Date: Thu, 24 Oct 2013 21:44:43 +0000 (-0700) Subject: CRF-max: don't warn if VBV underflow occurs X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7634f8c6047e9e12036778a8dc8d4cd4b06eebcb;p=libx264 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. --- diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index 030d2ab8..f1f165b9 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 )