diff options
author | Paul Wilkins <paulwilkins@google.com> | 2010-11-11 02:39:20 -0800 |
---|---|---|
committer | Code Review <code-review@webmproject.org> | 2010-11-11 02:39:20 -0800 |
commit | 213f7b0907b1af2453e4af0f0e8c39606aeab974 (patch) | |
tree | a32f8091dbbcc1ab44e10ae275a753e7505f5562 | |
parent | 692b10858d8be54706f3e02ba3075c9718d7d683 (diff) | |
parent | 513f8e681415eb8fc96fdf862ffa17a26b1a5bb2 (diff) | |
download | libvpx-213f7b0907b1af2453e4af0f0e8c39606aeab974.tar libvpx-213f7b0907b1af2453e4af0f0e8c39606aeab974.tar.gz libvpx-213f7b0907b1af2453e4af0f0e8c39606aeab974.tar.bz2 libvpx-213f7b0907b1af2453e4af0f0e8c39606aeab974.zip |
Merge "Relax rate control for last few frames"
-rw-r--r-- | vp8/encoder/firstpass.c | 33 | ||||
-rw-r--r-- | vp8/encoder/onyx_int.h | 3 |
2 files changed, 10 insertions, 26 deletions
diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c index 8a94fa369..a7f5ce44c 100644 --- a/vp8/encoder/firstpass.c +++ b/vp8/encoder/firstpass.c @@ -1439,7 +1439,7 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) // Boost for arf frame Boost = (cpi->gfu_boost * 3 * GFQ_ADJUSTMENT) / (2 * 100); - Boost += (cpi->baseline_gf_interval * 50); + Boost += (i * 50); allocation_chunks = (i * 100) + Boost; // Normalize Altboost and allocations chunck down to prevent overflow @@ -1738,16 +1738,6 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) vp8_avg_stats(§ionstats); - if (sectionstats.pcnt_motion < .17) - cpi->section_is_low_motion = 1; - else - cpi->section_is_low_motion = 0; - - if (sectionstats.mvc_abs + sectionstats.mvr_abs > 45) - cpi->section_is_fast_motion = 1; - else - cpi->section_is_fast_motion = 0; - cpi->section_intra_rating = sectionstats.intra_error / DOUBLE_DIVIDE_CHECK(sectionstats.coded_error); Ratio = sectionstats.intra_error / DOUBLE_DIVIDE_CHECK(sectionstats.coded_error); @@ -1980,7 +1970,14 @@ void vp8_second_pass(VP8_COMP *cpi) cpi->ni_av_qi = cpi->worst_quality; } } - else + // The last few frames of a clip almost always have to few or too many + // bits and for the sake of over exact rate control we dont want to make + // radical adjustments to the allowed quantizer range just to use up a + // few surplus bits or get beneath the target rate. + else if ( (cpi->common.current_video_frame < + (((unsigned int)cpi->total_stats->count * 255)>>8)) && + ((cpi->common.current_video_frame + cpi->baseline_gf_interval) < + (unsigned int)cpi->total_stats->count) ) { if (frames_left < 1) frames_left = 1; @@ -2344,17 +2341,7 @@ void vp8_find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) vp8_avg_stats(§ionstats); - if (sectionstats.pcnt_motion < .17) - cpi->section_is_low_motion = 1; - else - cpi->section_is_low_motion = 0; - - if (sectionstats.mvc_abs + sectionstats.mvr_abs > 45) - cpi->section_is_fast_motion = 1; - else - cpi->section_is_fast_motion = 0; - - cpi->section_intra_rating = sectionstats.intra_error / DOUBLE_DIVIDE_CHECK(sectionstats.coded_error); + cpi->section_intra_rating = sectionstats.intra_error / DOUBLE_DIVIDE_CHECK(sectionstats.coded_error); Ratio = sectionstats.intra_error / DOUBLE_DIVIDE_CHECK(sectionstats.coded_error); // if( (Ratio > 11) ) //&& (sectionstats.pcnt_second_ref < .20) ) diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index be5b00de8..a9eedf399 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@ -614,9 +614,6 @@ typedef struct unsigned int tempdata2; int base_skip_false_prob[128]; - unsigned int section_is_low_motion; - unsigned int section_benefits_from_aggresive_q; - unsigned int section_is_fast_motion; unsigned int section_intra_rating; double section_max_qfactor; |