Merge "Fix kf detection in some slide shows."

This commit is contained in:
Paul Wilkins 2018-01-12 18:45:13 +00:00 committed by Gerrit Code Review
commit 733820c509

View File

@ -2700,6 +2700,15 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
#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 @@ static int test_candidate_kf(TWO_PASS *twopass,
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 /