diff options
author | Jingning Han <jingning@google.com> | 2018-11-30 11:01:14 -0800 |
---|---|---|
committer | Jingning Han <jingning@google.com> | 2018-11-30 11:46:27 -0800 |
commit | 8ef9af0a6c1b2c69f3ea8f2cd878b194a8a686a7 (patch) | |
tree | abc6553f352f924c0a919fb6cc970e227ff38770 /vp9/encoder/vp9_ratectrl.c | |
parent | 7ca417f66547dc5e9e3ad36c45e147f05e66522a (diff) | |
download | libvpx-8ef9af0a6c1b2c69f3ea8f2cd878b194a8a686a7.tar libvpx-8ef9af0a6c1b2c69f3ea8f2cd878b194a8a686a7.tar.gz libvpx-8ef9af0a6c1b2c69f3ea8f2cd878b194a8a686a7.tar.bz2 libvpx-8ef9af0a6c1b2c69f3ea8f2cd878b194a8a686a7.zip |
Clean up rc_pick_q_and_bounds_two_pass()
Remove unneeded VPX_Q condition check.
Change-Id: I46b09ae522caa47fa7ea4441b6a6ac2840315d1c
Diffstat (limited to 'vp9/encoder/vp9_ratectrl.c')
-rw-r--r-- | vp9/encoder/vp9_ratectrl.c | 69 |
1 files changed, 17 insertions, 52 deletions
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index 396ba0269..b28549f0d 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -1394,16 +1394,7 @@ static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi, int *bottom_index, return rc_constant_q(cpi, bottom_index, top_index, gf_group_index); if (frame_is_intra_only(cm)) { - if (rc->frames_to_key == 1 && oxcf->rc_mode == VPX_Q) { - // If the next frame is also a key frame or the current frame is the - // only frame in the sequence in AOM_Q mode, just use the cq_level - // as q. - active_best_quality = cq_level; - active_worst_quality = cq_level; - } else { - pick_kf_q_bound_two_pass(cpi, &active_best_quality, - &active_worst_quality); - } + pick_kf_q_bound_two_pass(cpi, &active_best_quality, &active_worst_quality); } else if (!rc->is_src_frame_alt_ref && (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) { // Use the lower of active_worst_quality and recent @@ -1434,54 +1425,31 @@ static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi, int *bottom_index, ((layer_depth - 1) * q + active_best_quality + layer_depth / 2) / layer_depth; } - } else if (oxcf->rc_mode == VPX_Q) { - if (!cpi->refresh_alt_ref_frame) { - active_best_quality = cq_level; - } else { - active_best_quality = get_gf_active_quality(cpi, q, cm->bit_depth); - - // Modify best quality for second level arfs. For mode VPX_Q this - // becomes the baseline frame q. - if (gf_group->rf_level[gf_group_index] == GF_ARF_LOW) { - const int layer_depth = gf_group->layer_depth[gf_group_index]; - // linearly fit the frame q depending on the layer depth index from - // the base layer ARF. - active_best_quality = ((layer_depth - 1) * cq_level + - active_best_quality + layer_depth / 2) / - layer_depth; - } - } } else { active_best_quality = get_gf_active_quality(cpi, q, cm->bit_depth); } } else { - if (oxcf->rc_mode == VPX_Q) { - active_best_quality = cq_level; - } else { - active_best_quality = inter_minq[active_worst_quality]; + active_best_quality = inter_minq[active_worst_quality]; - // For the constrained quality mode we don't want - // q to fall below the cq level. - if ((oxcf->rc_mode == VPX_CQ) && (active_best_quality < cq_level)) { - active_best_quality = cq_level; - } + // For the constrained quality mode we don't want + // q to fall below the cq level. + if ((oxcf->rc_mode == VPX_CQ) && (active_best_quality < cq_level)) { + active_best_quality = cq_level; } } // Extension to max or min Q if undershoot or overshoot is outside // the permitted range. - if (cpi->oxcf.rc_mode != VPX_Q) { - if (frame_is_intra_only(cm) || - (!rc->is_src_frame_alt_ref && - (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame))) { - active_best_quality -= - (cpi->twopass.extend_minq + cpi->twopass.extend_minq_fast); - active_worst_quality += (cpi->twopass.extend_maxq / 2); - } else { - active_best_quality -= - (cpi->twopass.extend_minq + cpi->twopass.extend_minq_fast) / 2; - active_worst_quality += cpi->twopass.extend_maxq; - } + if (frame_is_intra_only(cm) || + (!rc->is_src_frame_alt_ref && + (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame))) { + active_best_quality -= + (cpi->twopass.extend_minq + cpi->twopass.extend_minq_fast); + active_worst_quality += (cpi->twopass.extend_maxq / 2); + } else { + active_best_quality -= + (cpi->twopass.extend_minq + cpi->twopass.extend_minq_fast) / 2; + active_worst_quality += cpi->twopass.extend_maxq; } // For normal frames do not allow an active minq lower than the q used for @@ -1517,10 +1485,7 @@ static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi, int *bottom_index, active_worst_quality = clamp(active_worst_quality, active_best_quality, rc->worst_quality); - if (oxcf->rc_mode == VPX_Q) { - q = active_best_quality; - // Special case code to try and match quality with forced key frames. - } else if (frame_is_intra_only(cm) && rc->this_key_frame_forced) { + if (frame_is_intra_only(cm) && rc->this_key_frame_forced) { // If static since last kf use better of last boosted and last kf q. if (cpi->twopass.last_kfgroup_zeromotion_pct >= STATIC_MOTION_THRESH) { q = VPXMIN(rc->last_kf_qindex, rc->last_boosted_qindex); |