ref: f6ddb92a33aac1081348df1e2f899b3c1f55028d
parent: 3448987ab20aa05716ffc4aedf6d02e23f75920b
author: Jingning Han <[email protected]>
date: Mon Sep 24 09:53:53 EDT 2018
Use layer dependent gfu_boost factor When multi-layer ARF is enabled, use the corresponding gfu_boost factor assigned to each ARF to compute the best_quality_index adjustment. This on average improves the coding performance by 0.2% for lowres and hdres, 0.4% for ntflx2k. It seems this change will only affect a small group of clips, e.g., pamphlet, bowing, mobcal_720p, etc., which tend to gain 4-5%, whereas the rest clips remain largely identical coding statistics. Change-Id: Ie19636a6cf32214aefd73e21ead2aea647ddbca8
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -777,13 +777,19 @@
kf_low_motion_minq, kf_high_motion_minq);
}
-static int get_gf_active_quality(const RATE_CONTROL *const rc, int q,
+static int get_gf_active_quality(const VP9_COMP *const cpi, int q,
vpx_bit_depth_t bit_depth) {
+ const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
+ const RATE_CONTROL *const rc = &cpi->rc;
+
int *arfgf_low_motion_minq;
int *arfgf_high_motion_minq;
+ const int gfu_boost = cpi->multi_layer_arf
+ ? gf_group->gfu_boost[gf_group->index]
+ : rc->gfu_boost;
ASSIGN_MINQ_TABLE(bit_depth, arfgf_low_motion_minq);
ASSIGN_MINQ_TABLE(bit_depth, arfgf_high_motion_minq);
- return get_active_quality(q, rc->gfu_boost, gf_low, gf_high,
+ return get_active_quality(q, gfu_boost, gf_low, gf_high,
arfgf_low_motion_minq, arfgf_high_motion_minq);
}
@@ -935,7 +941,7 @@
} else {
q = active_worst_quality;
}
- active_best_quality = get_gf_active_quality(rc, q, cm->bit_depth);
+ active_best_quality = get_gf_active_quality(cpi, q, cm->bit_depth);
} else {
// Use the lower of active_worst_quality and recent/average Q.
if (cm->current_video_frame > 1) {
@@ -1082,7 +1088,7 @@
if (oxcf->rc_mode == VPX_CQ) {
if (q < cq_level) q = cq_level;
- active_best_quality = get_gf_active_quality(rc, q, cm->bit_depth);
+ active_best_quality = get_gf_active_quality(cpi, q, cm->bit_depth);
// Constrained quality use slightly lower active best.
active_best_quality = active_best_quality * 15 / 16;
@@ -1097,7 +1103,7 @@
delta_qindex = vp9_compute_qdelta(rc, q, q * 0.50, cm->bit_depth);
active_best_quality = VPXMAX(qindex + delta_qindex, rc->best_quality);
} else {
- active_best_quality = get_gf_active_quality(rc, q, cm->bit_depth);
+ active_best_quality = get_gf_active_quality(cpi, q, cm->bit_depth);
}
} else {
if (oxcf->rc_mode == VPX_Q) {
@@ -1278,7 +1284,7 @@
if (oxcf->rc_mode == VPX_CQ) {
if (q < cq_level) q = cq_level;
- active_best_quality = get_gf_active_quality(rc, q, cm->bit_depth);
+ active_best_quality = get_gf_active_quality(cpi, q, cm->bit_depth);
// Constrained quality use slightly lower active best.
active_best_quality = active_best_quality * 15 / 16;
@@ -1287,7 +1293,7 @@
if (!cpi->refresh_alt_ref_frame) {
active_best_quality = cq_level;
} else {
- active_best_quality = get_gf_active_quality(rc, q, cm->bit_depth);
+ 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.
@@ -1295,7 +1301,7 @@
active_best_quality = (active_best_quality + cq_level + 1) / 2;
}
} else {
- active_best_quality = get_gf_active_quality(rc, q, cm->bit_depth);
+ active_best_quality = get_gf_active_quality(cpi, q, cm->bit_depth);
}
} else {
if (oxcf->rc_mode == VPX_Q) {