ref: bb4052b873b41e7ef8c01c74539a3f49bf3bb104
parent: 8a4336ed2edea09b67f49828df1f8c526a85a7a6
author: paulwilkins <[email protected]>
date: Wed Jan 10 10:03:21 EST 2018
Fix kf detection in some slide shows. This fix improves detection of key frames in slide shows. In particular it helps if the slides are pictures of varying formats as in a sample provided by yclin@. This change does not impact any of the clips in our standard tests but for the example slide show test clip helped global psnr by several db and resolved a serious visual quality issue. Change-Id: Iaeeeed55dc0bb50aeacd4996ed660ced06374603
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2701,6 +2701,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.
@@ -2745,6 +2754,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 /