shithub: libvpx

Download patch

ref: 733820c5092eb1504157f10c84519524f6fd511a
parent: 8c0cd2bd76d91af80f0a4d7b8b26cb8d4d240cb9
parent: bb4052b873b41e7ef8c01c74539a3f49bf3bb104
author: Paul Wilkins <paulwilkins@google.com>
date: Fri Jan 12 13:45:13 EST 2018

Merge "Fix kf detection in some slide shows."

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2700,6 +2700,15 @@
 #endif
 }
 
+// Slide show transition detection.
+// Tests for case where there is very low error either side of the current frame
+// but much higher just for this frame. This can help detect key frames in
+// slide shows even where the slides are pictures of different sizes.
+// It will not help if the transition is a fade or other multi-frame effect.
+static int slide_transition(double this_err, double last_err, double next_err) {
+  return (this_err > (last_err * 5.0)) && (this_err > (next_err * 5.0));
+}
+
 // Threshold for use of the lagging second reference frame. High second ref
 // usage may point to a transient event like a flash or occlusion rather than
 // a real scene cut.
@@ -2744,6 +2753,8 @@
   if ((this_frame->pcnt_second_ref < SECOND_REF_USEAGE_THRESH) &&
       (next_frame->pcnt_second_ref < SECOND_REF_USEAGE_THRESH) &&
       ((this_frame->pcnt_inter < VERY_LOW_INTER_THRESH) ||
+       (slide_transition(this_frame->coded_error, last_frame->coded_error,
+                         next_frame->coded_error)) ||
        ((pcnt_intra > MIN_INTRA_LEVEL) &&
         (pcnt_intra > (INTRA_VS_INTER_THRESH * modified_pcnt_inter)) &&
         ((this_frame->intra_error /