ref: e6657f32c56aa3e6e30a05590b4a247efd12aaef
parent: 885872f8995fa7dfe7962ae1dfa357af29ac547f
parent: 24db57f0e14e5e6cc9022a33f4e23b84e027a1a5
author: Marco Paniconi <marpan@google.com>
date: Wed Apr 13 18:36:28 EDT 2016
Merge "vp9: Adjustment to scene-cut detection."
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -1687,6 +1687,7 @@
cpi->common.buffer_pool = pool;
cpi->rc.high_source_sad = 0;
+ cpi->rc.count_last_scene_change = 0;
init_config(cpi, oxcf);
vp9_rc_init(&cpi->oxcf, oxcf->pass, &cpi->rc);
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -2084,10 +2084,11 @@
else
rc->high_source_sad = 0;
if (avg_sad > 0 || cpi->oxcf.rc_mode == VPX_CBR)
- rc->avg_source_sad = (rc->avg_source_sad + avg_sad) >> 1;
+ rc->avg_source_sad = (3 * rc->avg_source_sad + avg_sad) >> 2;
// For VBR, under scene change/high content change, force golden refresh.
if (cpi->oxcf.rc_mode == VPX_VBR &&
rc->high_source_sad &&
+ rc->count_last_scene_change > 4 &&
cpi->ext_refresh_frame_flags_pending == 0) {
int target;
cpi->refresh_golden_frame = 1;
@@ -2099,6 +2100,9 @@
rc->frames_till_gf_update_due = rc->frames_to_key;
target = calc_pframe_target_size_one_pass_vbr(cpi);
vp9_rc_set_frame_target(cpi, target);
+ rc->count_last_scene_change = 0;
+ } else {
+ rc->count_last_scene_change++;
}
}
}
--- a/vp9/encoder/vp9_ratectrl.h
+++ b/vp9/encoder/vp9_ratectrl.h
@@ -161,6 +161,7 @@
uint64_t avg_source_sad;
int high_source_sad;
+ int count_last_scene_change;
} RATE_CONTROL;
struct VP9_COMP;