ref: bdfbd6325ef8582beb0cb382f7d0f12cc488ecee
parent: 57d30b7b4dd6fe630cca176978c9fd174adc96e1
parent: 8a79769aff63c41e2db42af7a0afeec289789dcb
author: Marco Paniconi <[email protected]>
date: Mon May 16 17:09:46 EDT 2016
Merge "vp9: Update to rc-metric for keeping track of average frame size."
--- 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;