From 570b6d25c0498f77339db28a291cab87de2d3ea2 Mon Sep 17 00:00:00 2001 From: Paul Wilkins Date: Fri, 6 Dec 2013 13:17:34 +0000 Subject: [PATCH] Remove rate correction factor. Removed an adaptive rate correction factor that was having a negative impact on quality in many clips. This factor was influencing the Q range available to each frame independently of the bits allocated to each. Average results with DISABLE_RC_LONG_TERM_MEM. derf +0.199, -0.059. yt +3.957, +3.798 std hd +1.577, +2.140 yt hd +4.127, +4.513 Average results without DISABLE_RC_LONG_TERM_MEM derf -0.628, -0.665 yt +3.432, +3.015 std hd -0.105, +0.153 yt hd +3.432, +3.015 Change-Id: I45bab6b606f49a442e7b27a6d631f3ffd843bbce --- vp9/encoder/vp9_firstpass.c | 20 +------------------- vp9/encoder/vp9_onyx_if.c | 5 ++--- vp9/encoder/vp9_onyx_int.h | 1 - 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index 60830d00c..3f194b221 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -1030,22 +1030,6 @@ static int estimate_max_q(VP9_COMP *cpi, sr_correction = 0.75; } - // Calculate a corrective factor based on a rolling ratio of bits spent - // vs target bits - if (cpi->rc.rolling_target_bits > 0 && - cpi->rc.active_worst_quality < cpi->rc.worst_quality) { - double rolling_ratio = (double)cpi->rc.rolling_actual_bits / - (double)cpi->rc.rolling_target_bits; - - if (rolling_ratio < 0.95) - cpi->twopass.est_max_qcorrection_factor -= 0.005; - else if (rolling_ratio > 1.05) - cpi->twopass.est_max_qcorrection_factor += 0.005; - - cpi->twopass.est_max_qcorrection_factor = fclamp( - cpi->twopass.est_max_qcorrection_factor, 0.1, 10.0); - } - // Corrections for higher compression speed settings // (reduced compression expected) // FIXME(jimbankoski): Once we settle on vp9 speed features we need to @@ -1062,8 +1046,7 @@ static int estimate_max_q(VP9_COMP *cpi, err_correction_factor = calc_correction_factor(err_per_mb, ERR_DIVISOR, 0.4, 0.90, q) * - sr_correction * speed_correction * - cpi->twopass.est_max_qcorrection_factor; + sr_correction * speed_correction; bits_per_mb_at_this_q = vp9_rc_bits_per_mb(INTER_FRAME, q, err_correction_factor); @@ -2168,7 +2151,6 @@ void vp9_second_pass(VP9_COMP *cpi) { if (cpi->common.current_video_frame == 0) { int section_target_bandwidth = (int)(cpi->twopass.bits_left / frames_left); - cpi->twopass.est_max_qcorrection_factor = 1.0; // guess at maxq needed in 2nd pass cpi->twopass.maxq_max_limit = cpi->rc.worst_quality; diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index d40fc6673..f476ae970 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -1632,7 +1632,6 @@ VP9_PTR vp9_create_compressor(VP9_CONFIG *oxcf) { cpi->rc.rate_correction_factor = 1.0; cpi->rc.key_frame_rate_correction_factor = 1.0; cpi->rc.gf_rate_correction_factor = 1.0; - cpi->twopass.est_max_qcorrection_factor = 1.0; cal_nmvjointsadcost(cpi->mb.nmvjointsadcost); cpi->mb.nmvcost[0] = &cpi->mb.nmvcosts[0][MV_MAX]; @@ -2617,7 +2616,7 @@ static void output_frame_level_debug_stats(VP9_COMP *cpi) { if (cpi->twopass.total_left_stats.coded_error != 0.0) fprintf(f, "%10d %10d %10d %10d %10d %10d %10d %10d %10d" "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f" - "%6d %6d %5d %5d %5d %8.2f %10d %10.3f" + "%6d %6d %5d %5d %5d %10d %10.3f" "%10.3f %8d %10d %10d %10d\n", cpi->common.current_video_frame, cpi->rc.this_frame_target, cpi->rc.projected_frame_size, 0, @@ -2632,7 +2631,7 @@ static void output_frame_level_debug_stats(VP9_COMP *cpi) { vp9_convert_qindex_to_q(cpi->cq_target_quality), cpi->refresh_last_frame, cpi->refresh_golden_frame, cpi->refresh_alt_ref_frame, cm->frame_type, cpi->rc.gfu_boost, - cpi->twopass.est_max_qcorrection_factor, (int)cpi->twopass.bits_left, + (int)cpi->twopass.bits_left, cpi->twopass.total_left_stats.coded_error, (double)cpi->twopass.bits_left / (1 + cpi->twopass.total_left_stats.coded_error), diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h index c6315653e..526192215 100644 --- a/vp9/encoder/vp9_onyx_int.h +++ b/vp9/encoder/vp9_onyx_int.h @@ -569,7 +569,6 @@ typedef struct VP9_COMP { int alt_extra_bits; int sr_update_lag; - double est_max_qcorrection_factor; } twopass; YV12_BUFFER_CONFIG alt_ref_buffer; -- 2.40.0