ref: 8a79769aff63c41e2db42af7a0afeec289789dcb
parent: 656f9c41260c376a6e34e6fef6d586f8ebeae325
author: Marco <[email protected]>
date: Fri May 13 07:41:37 EDT 2016
vp9: Update to rc-metric for keeping track of average frame size. Rename and change to how its updated. Only affects 1 pass vbr. Small change in metrics (< ~0.1%) on ytlive set. Change-Id: Ibb1fe485699b6c4a8194951c8f229abe2f64b9a5
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -337,7 +337,7 @@
rc->total_actual_bits = 0;
rc->total_target_bits = 0;
rc->total_target_vs_actual = 0;
- rc->avg_intersize_gfint = 0;
+ rc->avg_size_inter = 0;
rc->avg_frame_low_motion = 0;
rc->high_source_sad = 0;
rc->count_last_scene_change = 0;
@@ -1471,7 +1471,8 @@
if (cm->frame_type != KEY_FRAME)
compute_frame_low_motion(cpi);
if (!cpi->refresh_golden_frame && !cpi->refresh_alt_ref_frame)
- rc->avg_intersize_gfint += rc->projected_frame_size;
+ rc->avg_size_inter = ROUND_POWER_OF_TWO(
+ rc->avg_size_inter * 3 + rc->projected_frame_size, 2);
}
}
@@ -1547,8 +1548,6 @@
cm->frame_type = INTER_FRAME;
}
if (rc->frames_till_gf_update_due == 0) {
- rc->avg_intersize_gfint =
- rc->avg_intersize_gfint / (rc->baseline_gf_interval + 1);
rc->gfu_boost = DEFAULT_GF_BOOST;
if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && cpi->oxcf.pass == 0) {
vp9_cyclic_refresh_set_golden_update(cpi);
@@ -1559,7 +1558,7 @@
// Increase gf interval at high Q and high overshoot.
if (cm->current_video_frame > 30 &&
rc->avg_frame_qindex[INTER_FRAME] > (7 * rc->worst_quality) >> 3 &&
- rc->avg_intersize_gfint > (5 * rc->avg_frame_bandwidth) >> 1) {
+ rc->avg_size_inter > (5 * rc->avg_frame_bandwidth) >> 1) {
rc->baseline_gf_interval = (3 * rc->baseline_gf_interval) >> 1;
} else if (cm->current_video_frame > 30 &&
rc->avg_frame_low_motion < 20) {
@@ -1571,7 +1570,6 @@
rc->frames_till_gf_update_due = rc->baseline_gf_interval;
cpi->refresh_golden_frame = 1;
rc->source_alt_ref_pending = USE_ALTREF_FOR_ONE_PASS;
- rc->avg_intersize_gfint = 0;
}
if (cm->frame_type == KEY_FRAME)
target = calc_iframe_target_size_one_pass_vbr(cpi);
@@ -2160,7 +2158,6 @@
target = calc_pframe_target_size_one_pass_vbr(cpi);
vp9_rc_set_frame_target(cpi, target);
rc->count_last_scene_change = 0;
- rc->avg_intersize_gfint = 0;
} else {
rc->count_last_scene_change++;
}
--- a/vp9/encoder/vp9_ratectrl.h
+++ b/vp9/encoder/vp9_ratectrl.h
@@ -162,7 +162,7 @@
uint64_t avg_source_sad;
int high_source_sad;
int count_last_scene_change;
- int avg_intersize_gfint;
+ int avg_size_inter;
int avg_frame_low_motion;
} RATE_CONTROL;