diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-10-01 15:51:40 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-10-01 16:12:38 +0200 |
commit | 31ab1575e59e33957864d1bdf13253f8d366ccba (patch) | |
tree | 074dd6605a3d7e0a42b6cd12d2f071fe25d3d25a /libavcodec/ratecontrol.c | |
parent | adc5539e7b94a94114d591d83e7ae63f52b5916f (diff) | |
parent | 1218777ffd152287244349d4ff9e1cbc84fa2c54 (diff) | |
download | ffmpeg-31ab1575e59e33957864d1bdf13253f8d366ccba.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
avcodec: Convert some commented-out printf/av_log instances to av_dlog
avcodec: Drop silly and/or broken printf debug output
avcodec: Drop some silly commented-out av_log() invocations
avformat: Convert some commented-out printf/av_log instances to av_dlog
avformat: Remove non-compiling and/or silly commented-out printf/av_log statements
Remove some silly disabled code.
ac3dec: ensure get_buffer() gets a buffer for the correct number of channels
Conflicts:
libavcodec/dnxhddec.c
libavcodec/ffv1.c
libavcodec/h264.c
libavcodec/h264_parser.c
libavcodec/mjpegdec.c
libavcodec/motion_est_template.c
libavcodec/mpegaudiodec.c
libavcodec/mpegvideo_enc.c
libavcodec/put_bits.h
libavcodec/ratecontrol.c
libavcodec/wmaenc.c
libavdevice/timefilter.c
libavformat/asfdec.c
libavformat/avidec.c
libavformat/avienc.c
libavformat/flvenc.c
libavformat/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ratecontrol.c')
-rw-r--r-- | libavcodec/ratecontrol.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index b9f581f5da..8f8647c058 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -283,7 +283,8 @@ int ff_vbv_update(MpegEncContext *s, int frame_size){ const double min_rate= s->avctx->rc_min_rate/fps; const double max_rate= s->avctx->rc_max_rate/fps; -//av_log(0,0, "%d %f %d %f %f\n", buffer_size, rcc->buffer_index, frame_size, min_rate, max_rate); + av_dlog(s, "%d %f %d %f %f\n", + buffer_size, rcc->buffer_index, frame_size, min_rate, max_rate); if(buffer_size){ int left; @@ -457,7 +458,6 @@ static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, double q, if(s->avctx->rc_qmod_freq && frame_num%s->avctx->rc_qmod_freq==0 && pict_type==AV_PICTURE_TYPE_P) q*= s->avctx->rc_qmod_amp; -//printf("q:%f\n", q); /* buffer overflow/underflow protection */ if(buffer_size){ double expected_size= rcc->buffer_index; @@ -493,7 +493,9 @@ static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, double q, } } } -//printf("q:%f max:%f min:%f size:%f index:%d bits:%f agr:%f\n", q,max_rate, min_rate, buffer_size, rcc->buffer_index, bits, s->avctx->rc_buffer_aggressivity); + av_dlog(s, "q:%f max:%f min:%f size:%f index:%f agr:%f\n", + q, max_rate, min_rate, buffer_size, rcc->buffer_index, + s->avctx->rc_buffer_aggressivity); if(s->avctx->rc_qsquish==0.0 || qmin==qmax){ if (q<qmin) q=qmin; else if(q>qmax) q=qmax; @@ -636,8 +638,6 @@ static void adaptive_quantization(MpegEncContext *s, double q){ if (intq > qmax) intq= qmax; else if(intq < qmin) intq= qmin; -//if(i%s->mb_width==0) printf("\n"); -//printf("%2d%3d ", intq, ff_sqrt(s->mc_mb_var[i])); s->lambda_table[mb_xy]= intq; } } @@ -682,7 +682,6 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) get_qminmax(&qmin, &qmax, s, pict_type); fps= get_fps(s->avctx); -//printf("input_pic_num:%d pic_num:%d frame_rate:%d\n", s->input_picture_number, s->picture_number, s->frame_rate); /* update predictors */ if(picture_number>2 && !dry_run){ const int last_var= s->last_pict_type == AV_PICTURE_TYPE_I ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum; @@ -706,9 +705,6 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) else dts_pic= s->last_picture_ptr; -//if(dts_pic) -// av_log(NULL, AV_LOG_ERROR, "%"PRId64" %"PRId64" %"PRId64" %d\n", s->current_picture_ptr->pts, s->user_specified_pts, dts_pic->pts, picture_number); - if (!dts_pic || dts_pic->f.pts == AV_NOPTS_VALUE) wanted_bits= (uint64_t)(s->bit_rate*(double)picture_number/fps); else @@ -727,7 +723,8 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) assert(pict_type == rce->new_pict_type); q= rce->new_qscale / br_compensation; -//printf("%f %f %f last:%d var:%d type:%d//\n", q, rce->new_qscale, br_compensation, s->frame_bits, var, pict_type); + av_dlog(s, "%f %f %f last:%d var:%d type:%d//\n", q, rce->new_qscale, + br_compensation, s->frame_bits, var, pict_type); }else{ rce->pict_type= rce->new_pict_type= pict_type; @@ -764,9 +761,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) return -1; assert(q>0.0); -//printf("%f ", q); q= get_diff_limited_q(s, rce, q); -//printf("%f ", q); assert(q>0.0); if(pict_type==AV_PICTURE_TYPE_P || s->intra_only){ //FIXME type dependent blur like in 2-pass @@ -775,9 +770,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) rcc->short_term_qsum+= q; rcc->short_term_qcount++; -//printf("%f ", q); q= short_term_q= rcc->short_term_qsum/rcc->short_term_qcount; -//printf("%f ", q); } assert(q>0.0); @@ -908,18 +901,15 @@ static int init_pass2(MpegEncContext *s) double bits; rce->new_qscale= modify_qscale(s, rce, blurred_qscale[i], i); bits= qp2bits(rce, rce->new_qscale) + rce->mv_bits + rce->misc_bits; -//printf("%d %f\n", rce->new_bits, blurred_qscale[i]); bits += 8*ff_vbv_update(s, bits); rce->expected_bits= expected_bits; expected_bits += bits; } - /* - av_log(s->avctx, AV_LOG_INFO, - "expected_bits: %f all_available_bits: %d rate_factor: %f\n", - expected_bits, (int)all_available_bits, rate_factor); - */ + av_dlog(s->avctx, + "expected_bits: %f all_available_bits: %d rate_factor: %f\n", + expected_bits, (int)all_available_bits, rate_factor); if(expected_bits > all_available_bits) { rate_factor-= step; ++toobig; @@ -931,8 +921,10 @@ static int init_pass2(MpegEncContext *s) /* check bitrate calculations and print info */ qscale_sum = 0.0; for(i=0; i<rcc->num_entries; i++){ - /* av_log(s->avctx, AV_LOG_DEBUG, "[lavc rc] entry[%d].new_qscale = %.3f qp = %.3f\n", - i, rcc->entry[i].new_qscale, rcc->entry[i].new_qscale / FF_QP2LAMBDA); */ + av_dlog(s, "[lavc rc] entry[%d].new_qscale = %.3f qp = %.3f\n", + i, + rcc->entry[i].new_qscale, + rcc->entry[i].new_qscale / FF_QP2LAMBDA); qscale_sum += av_clip(rcc->entry[i].new_qscale / FF_QP2LAMBDA, s->avctx->qmin, s->avctx->qmax); } assert(toobig <= 40); |