Scene-cut detection: avoid very short KF intervals In some videos with camera panning, scene cut algo incorrectly identifies a scene cut after just a couple of frames. We force a bigger keyframe interval to avoid this issue. Large BDRate improvement on selected videos: hdres/shields_720p50.y4m: -10.717 hdres/stockholm_ter_720p60.y4m: -10.312 hdres/parkrun_720p50.y4m: -3.501 hdres/mobcal_720p50.y4m: -2.405 (other hdres vids neutral) hdres overall: -0.709 lowres, midres, ugc360p and objective1-fast all neutral. STATS_CHANGED Change-Id: I601a306d2657f74ca8ebf5105f4cbf02121bf0ce
diff --git a/av1/encoder/pass2_strategy.c b/av1/encoder/pass2_strategy.c index 3e5f17f..b135938 100644 --- a/av1/encoder/pass2_strategy.c +++ b/av1/encoder/pass2_strategy.c
@@ -1405,7 +1405,8 @@ // Does the frame satisfy the primary criteria of a key frame? // See above for an explanation of the test criteria. // If so, then examine how well it predicts subsequent frames. - if ((this_frame->pcnt_second_ref < second_ref_usage_thresh) && + if (frame_count_so_far >= 3 && + (this_frame->pcnt_second_ref < second_ref_usage_thresh) && (next_frame->pcnt_second_ref < second_ref_usage_thresh) && ((this_frame->pcnt_inter < VERY_LOW_INTER_THRESH) || ((pcnt_intra > MIN_INTRA_LEVEL) &&