Correct max_after in tf_setup_filtering_buffer()
Change-Id: I82dd2618a218df5afb679e7265ccb2443d884f3d
diff --git a/av1/encoder/temporal_filter.c b/av1/encoder/temporal_filter.c
index 88f28c6..608c5a54 100644
--- a/av1/encoder/temporal_filter.c
+++ b/av1/encoder/temporal_filter.c
@@ -951,7 +951,8 @@
const int max_before = AOMMIN(filter_frame_lookahead_idx, key_to_curframe);
// Number of buffered frames after the to-filter frame.
- const int max_after = AOMMIN(lookahead_depth - max_before, curframe_to_key);
+ const int max_after =
+ AOMMIN(lookahead_depth - filter_frame_lookahead_idx - 1, curframe_to_key);
// Estimate noises for each plane.
const struct lookahead_entry *to_filter_buf = av1_lookahead_peek(