Tweak the gf_length decision Tweak the condition for videos starting with frozen frames Change-Id: I3398df965c0e3f83b42f0a9b191fd2f7737ca79d
diff --git a/av1/encoder/pass2_strategy.c b/av1/encoder/pass2_strategy.c index 3c02b87..52b92b2 100644 --- a/av1/encoder/pass2_strategy.c +++ b/av1/encoder/pass2_strategy.c
@@ -2053,11 +2053,20 @@ const int last_frame = regions[num_regions - 1].last - offset; // score of how much the arf helps the whole GOP double base_score = 0.0; + int count_base = 0; + bool static_frames = false; + // Accumulate base_score in for (int j = cur_start + 1; j < cur_start + min_shrink_int; j++) { if (stats + j >= twopass->stats_buf_ctx->stats_in_end) break; base_score = (base_score + 1.0) * stats[j].cor_coeff; + count_base++; } + + if (count_base && base_score / count_base > 0.992) { + static_frames = true; + } + int met_blending = 0; // Whether we have met blending areas before int last_blending = 0; // Whether the previous frame if blending for (int j = cur_start + min_shrink_int; j <= cur_last; j++) { @@ -2108,7 +2117,9 @@ AOMMAX(stats[n].intra_error, 0.001))); } - if (this_score > best_score) { + // Slightly relax the condition for videos starting with frozen + // frames. + if (this_score + (static_frames ? 0.5 : 0) > best_score) { best_score = this_score; best_j = j; }