From 55ee1fca03709753595d768c6fbb2c11f9f55ae0 Mon Sep 17 00:00:00 2001 From: angiebird Date: Mon, 21 Oct 2019 17:09:11 -0700 Subject: [PATCH] Remove detect_transition_to_still() Change-Id: I877f55355fc85d67f46bb76e521a19d35d76df09 --- vp9/encoder/vp9_firstpass.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index 8c774dfa8..23b344f6d 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -1830,26 +1830,6 @@ static int check_transition_to_still(const FIRST_PASS_INFO *first_pass_info, return j == still_interval; } -static int detect_transition_to_still(VP9_COMP *cpi, int frame_interval, - int still_interval, - double loop_decay_rate, - double last_decay_rate) { - const TWO_PASS *const twopass = &cpi->twopass; - RATE_CONTROL *const rc = &cpi->rc; - int show_idx = get_show_idx(twopass); - - // Break clause to detect very still sections after motion - // For example a static image after a fade or other transition - // instead of a clean scene cut. - if (frame_interval > rc->min_gf_interval && loop_decay_rate >= 0.999 && - last_decay_rate < 0.9) { - return check_transition_to_still(&twopass->first_pass_info, show_idx, - still_interval); - } - - return 0; -} - // This function detects a flash through the high relative pcnt_second_ref // score in the frame following a flash frame. The offset passed in should // reflect this. @@ -3149,11 +3129,16 @@ static void find_next_key_frame(VP9_COMP *cpi, int kf_show_idx) { // Special check for transition or high motion followed by a // static scene. - if (detect_transition_to_still(cpi, i, cpi->oxcf.key_freq - i, - loop_decay_rate, decay_accumulator)) - break; - - // Step on to the next frame. + if (i > rc->min_gf_interval && loop_decay_rate >= 0.999 && + decay_accumulator < 0.9) { + int still_interval = oxcf->key_freq - i; + // TODO(angiebird): Figure out why we use "+1" here + int show_idx = kf_show_idx + i + 1; + if (check_transition_to_still(first_pass_info, show_idx, + still_interval)) { + break; + } + } } ++rc->frames_to_key; ++i; -- 2.40.0