summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorMarco <marpan@google.com>2017-10-10 15:30:32 -0700
committerMarco <marpan@google.com>2017-10-12 10:59:23 -0700
commita673b4f4afb6591d48ffc5c74b539771e28e0f69 (patch)
tree772fd101d634d135743ebabbe2051f1b958013d6 /vp9
parent72c69e14ad7b5375fed113c025dca70d20fcaf0a (diff)
downloadlibvpx-a673b4f4afb6591d48ffc5c74b539771e28e0f69.tar
libvpx-a673b4f4afb6591d48ffc5c74b539771e28e0f69.tar.gz
libvpx-a673b4f4afb6591d48ffc5c74b539771e28e0f69.tar.bz2
libvpx-a673b4f4afb6591d48ffc5c74b539771e28e0f69.zip
Adjust to scene detection for 1 pass vbr.
Expose the threshold for setting key frame on cut, and increase it for speed 5. Also small adjustment to min_thresh. No change in overall metrics or fps. Small quality improvement and lower encode time on scene cuts. Change-Id: I36e06ff3b26b6c29aede39c23fce454525fc9026
Diffstat (limited to 'vp9')
-rw-r--r--vp9/encoder/vp9_ratectrl.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index 8c71beaff..f45f9d900 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -2280,8 +2280,10 @@ void vp9_scene_detection_onepass(VP9_COMP *cpi) {
uint64_t avg_sad_current = 0;
uint32_t min_thresh = 4000;
float thresh = 8.0f;
+ uint32_t thresh_key = 140000;
+ if (cpi->oxcf.speed <= 5) thresh_key = 240000;
if (cpi->oxcf.rc_mode == VPX_VBR) {
- min_thresh = 70000;
+ min_thresh = 65000;
thresh = 2.1f;
}
if (cpi->oxcf.lag_in_frames > 0) {
@@ -2307,7 +2309,7 @@ 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)
+ if (rc->high_source_sad && avg_sad_current > thresh_key)
scene_cut_force_key_frame = 1;
// Update recursive average for current frame.
if (avg_sad_current > 0)
@@ -2369,7 +2371,7 @@ 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)
+ if (rc->high_source_sad && avg_sad > thresh_key)
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;
@@ -2402,8 +2404,7 @@ 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;
+ if (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;