summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorMarco <marpan@google.com>2017-10-09 17:53:21 -0700
committerMarco <marpan@google.com>2017-10-10 11:20:05 -0700
commit017257a317be2605e91341b20f539028730dc89b (patch)
tree296151ecc4203b0978f7105a766ff356a438d973 /vp9
parent963cc22cefc0b35bd5675d63604a8e96954f1b03 (diff)
downloadlibvpx-017257a317be2605e91341b20f539028730dc89b.tar
libvpx-017257a317be2605e91341b20f539028730dc89b.tar.gz
libvpx-017257a317be2605e91341b20f539028730dc89b.tar.bz2
libvpx-017257a317be2605e91341b20f539028730dc89b.zip
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
Diffstat (limited to 'vp9')
-rw-r--r--vp9/encoder/vp9_ratectrl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index 536af35fa..8c71beaff 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -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;