summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_firstpass.c
diff options
context:
space:
mode:
authorpaulwilkins <paulwilkins@google.com>2018-01-09 15:51:28 +0000
committerpaulwilkins <paulwilkins@google.com>2018-01-10 17:26:32 +0000
commit32f86ce276bad32ded0a5b5623c6c400a00deb3a (patch)
tree969e043706da357e6f59d3c16be06bd5b4aab0f9 /vp9/encoder/vp9_firstpass.c
parent0226ce79e9389ccf7d10ed7acacba6840ad911c9 (diff)
downloadlibvpx-32f86ce276bad32ded0a5b5623c6c400a00deb3a.tar
libvpx-32f86ce276bad32ded0a5b5623c6c400a00deb3a.tar.gz
libvpx-32f86ce276bad32ded0a5b5623c6c400a00deb3a.tar.bz2
libvpx-32f86ce276bad32ded0a5b5623c6c400a00deb3a.zip
Add zoom break out for kf boost loop.
Adds a breakout threshold to key frame boost loop. This reduces the boost somewhat in cases where there is a significant zoom component. In tests most clips no effect but a sizable gain for some clips like station. Change-Id: I8b7a4d57f7ce5f4e3faab3f5688f7e4d61679b9a
Diffstat (limited to 'vp9/encoder/vp9_firstpass.c')
-rw-r--r--vp9/encoder/vp9_firstpass.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index fb6b132a5..0c5cd97d2 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2815,6 +2815,7 @@ static int test_candidate_kf(TWO_PASS *twopass,
#define FRAMES_TO_CHECK_DECAY 8
#define MIN_KF_TOT_BOOST 300
#define KF_BOOST_SCAN_MAX_FRAMES 32
+#define KF_ABS_ZOOM_THRESH 6.0
#ifdef AGGRESSIVE_VBR
#define KF_MAX_FRAME_BOOST 80.0
@@ -2842,6 +2843,7 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
double kf_group_err = 0.0;
double recent_loop_decay[FRAMES_TO_CHECK_DECAY];
double sr_accumulator = 0.0;
+ double abs_mv_in_out_accumulator = 0.0;
const double av_err = get_distribution_av_err(cpi, twopass);
vp9_zero(next_frame);
@@ -3021,7 +3023,14 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
KF_MAX_FRAME_BOOST * zm_factor);
boost_score += frame_boost;
- if (frame_boost < 25.00) break;
+
+ // Measure of zoom. Large zoom tends to indicate reduced boost.
+ abs_mv_in_out_accumulator +=
+ fabs(next_frame.mv_in_out_count * next_frame.pcnt_motion);
+
+ if ((frame_boost < 25.00) ||
+ (abs_mv_in_out_accumulator > KF_ABS_ZOOM_THRESH))
+ break;
} else {
break;
}