Commit 017257a3 authored by Marco's avatar Marco
Browse files

Adjustment to scene detection and key frame.

For 1 pass vbr: use higher threshold on avg_sad
and force key frame under scene cut detection if
above the threshold. Allow it for speed >= 6 for now,
since it does not use the full nonrd_pickmode partition
(as in speed 5).

Improves quality somewhat on scene cut frames.
Neutral on overall metrics and fps for speed 6 on
ytlive set.

Change-Id: I12626f7627419ca14f9d0d249df86c7104438162
parent 963cc22c
......@@ -2276,6 +2276,7 @@ void vp9_scene_detection_onepass(VP9_COMP *cpi) {
int start_frame = 0;
int frames_to_buffer = 1;
int frame = 0;
int scene_cut_force_key_frame = 0;
uint64_t avg_sad_current = 0;
uint32_t min_thresh = 4000;
float thresh = 8.0f;
......@@ -2306,6 +2307,8 @@ void vp9_scene_detection_onepass(VP9_COMP *cpi) {
rc->high_source_sad = 1;
else
rc->high_source_sad = 0;
if (rc->high_source_sad && avg_sad_current > min_thresh << 1)
scene_cut_force_key_frame = 1;
// Update recursive average for current frame.
if (avg_sad_current > 0)
rc->avg_source_sad[0] =
......@@ -2366,6 +2369,8 @@ void vp9_scene_detection_onepass(VP9_COMP *cpi) {
rc->high_source_sad = 1;
else
rc->high_source_sad = 0;
if (rc->high_source_sad && avg_sad > min_thresh << 1)
scene_cut_force_key_frame = 1;
if (avg_sad > 0 || cpi->oxcf.rc_mode == VPX_CBR)
rc->avg_source_sad[0] = (3 * rc->avg_source_sad[0] + avg_sad) >> 2;
} else {
......@@ -2397,6 +2402,8 @@ void vp9_scene_detection_onepass(VP9_COMP *cpi) {
cpi->ext_refresh_frame_flags_pending == 0) {
int target;
cpi->refresh_golden_frame = 1;
if (cpi->oxcf.speed >= 6 && scene_cut_force_key_frame)
cm->frame_type = KEY_FRAME;
rc->source_alt_ref_pending = 0;
if (cpi->sf.use_altref_onepass && cpi->oxcf.enable_auto_arf)
rc->source_alt_ref_pending = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment