Simplify temporal filtering preparation

Skip initializations for frame coding. The coding stats change is
in the range of 0.05%.

STATS_CHANGED

Change-Id: I6233067f29207be7ad2a2c73799650b70e948ab6
diff --git a/av1/encoder/encode_strategy.c b/av1/encoder/encode_strategy.c
index 795f25a..ffc9f07 100644
--- a/av1/encoder/encode_strategy.c
+++ b/av1/encoder/encode_strategy.c
@@ -884,22 +884,7 @@
     }
     // If we are doing kf filtering, set up a few things.
     if (apply_filtering) {
-      MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
-      av1_init_mi_buffers(&cm->mi_params);
-      setup_mi(cpi, frame_input->source);
-      av1_init_macroblockd(cm, xd);
-      memset(cpi->mbmi_ext_info.frame_base, 0,
-             cpi->mbmi_ext_info.alloc_size *
-                 sizeof(*cpi->mbmi_ext_info.frame_base));
-
-      av1_set_speed_features_framesize_independent(cpi, oxcf->speed);
-      av1_set_speed_features_framesize_dependent(cpi, oxcf->speed);
-      av1_set_rd_speed_thresholds(cpi);
-      av1_setup_frame_buf_refs(cm);
-      av1_setup_frame_sign_bias(cm);
-      av1_frame_init_quantizer(cpi);
       av1_setup_past_independence(cm);
-
       if (!frame_params->show_frame && cpi->no_show_fwd_kf) {
         // fwd kf
         arf_src_index = -1 * gf_group->arf_src_offset[gf_group->index];
diff --git a/av1/encoder/temporal_filter.c b/av1/encoder/temporal_filter.c
index bdfb9aa..8aed9d4 100644
--- a/av1/encoder/temporal_filter.c
+++ b/av1/encoder/temporal_filter.c
@@ -20,6 +20,7 @@
 #include "av1/common/quant_common.h"
 #include "av1/common/reconinter.h"
 #include "av1/encoder/av1_quantize.h"
+#include "av1/encoder/encodeframe.h"
 #include "av1/encoder/encoder.h"
 #include "av1/encoder/extend.h"
 #include "av1/encoder/firstpass.h"
@@ -967,7 +968,7 @@
  *         in this function. Estimated noise levels for YUV planes will be
  *         saved in `noise_levels`.
  */
-static void tf_setup_filtering_buffer(const AV1_COMP *cpi,
+static void tf_setup_filtering_buffer(AV1_COMP *cpi,
                                       const int filter_frame_lookahead_idx,
                                       const int is_second_arf,
                                       YV12_BUFFER_CONFIG **frames,
@@ -1065,6 +1066,12 @@
   *num_frames_for_filtering = num_frames;
   *filter_frame_idx = num_before;
   assert(frames[*filter_frame_idx] == to_filter_frame);
+
+  av1_setup_src_planes(&cpi->td.mb, &to_filter_buf->img, 0, 0, num_planes,
+                       cpi->common.seq_params.sb_size);
+  av1_setup_block_planes(&cpi->td.mb.e_mbd,
+                         cpi->common.seq_params.subsampling_x,
+                         cpi->common.seq_params.subsampling_y, num_planes);
 }
 
 /*!\cond */