diff options
Diffstat (limited to 'src/libffmpeg/libavcodec/ratecontrol.c')
-rw-r--r-- | src/libffmpeg/libavcodec/ratecontrol.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libffmpeg/libavcodec/ratecontrol.c b/src/libffmpeg/libavcodec/ratecontrol.c index 29dc1f495..f4f433add 100644 --- a/src/libffmpeg/libavcodec/ratecontrol.c +++ b/src/libffmpeg/libavcodec/ratecontrol.c @@ -117,13 +117,18 @@ int ff_rate_control_init(MpegEncContext *s) p= next; } -#ifdef CONFIG_XVID + + if(init_pass2(s) < 0) return -1; + //FIXME maybe move to end - if((s->flags&CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) + if((s->flags&CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) { +#ifdef CONFIG_XVID return ff_xvid_rate_control_init(s); +#else + av_log(s->avctx, AV_LOG_ERROR, "XviD ratecontrol requires libavcodec compiled with XviD support\n"); + return -1; #endif - - if(init_pass2(s) < 0) return -1; + } } if(!(s->flags&CODEC_FLAG_PASS2)){ @@ -906,7 +911,7 @@ static int init_pass2(MpegEncContext *s) av_free(qscale); av_free(blured_qscale); - if(abs(expected_bits/all_available_bits - 1.0) > 0.01 ){ + if(fabs(expected_bits/all_available_bits - 1.0) > 0.01 ){ av_log(s->avctx, AV_LOG_ERROR, "Error: 2pass curve failed to converge\n"); return -1; } |