Make "--enable-overlay" encoder flag work

In the current code base, --enable-overlay wasn't populated
and used in the encoder, and the encoder always assume
enable-overlay=1. This CL implemented the correct logic.

Bug: 492512589

STATS_CHANGED for --enable-overlay=0

Change-Id: I484db2f1a7dbd4650035f5c8eaa069fdc97b5718
diff --git a/av1/encoder/encode_strategy.c b/av1/encoder/encode_strategy.c
index e4b0a37..327ae9e 100644
--- a/av1/encoder/encode_strategy.c
+++ b/av1/encoder/encode_strategy.c
@@ -787,7 +787,8 @@
       if (tf_buf != NULL) {
         frame_input->source = tf_buf;
         show_existing_alt_ref = av1_check_show_filtered_frame(
-            tf_buf, &frame_diff, q_index, cm->seq_params->bit_depth);
+            tf_buf, &frame_diff, q_index, cm->seq_params->bit_depth,
+            cpi->oxcf.algo_cfg.enable_overlay);
         if (show_existing_alt_ref) {
           cpi->common.showable_frame |= 1;
         } else {
@@ -822,8 +823,9 @@
       // TODO(angiebird): Reuse tf_info->tf_buf here.
       av1_temporal_filter(cpi, arf_src_index, cpi->gf_frame_index, &frame_diff,
                           tf_buf_second_arf);
-      show_existing_alt_ref = av1_check_show_filtered_frame(
-          tf_buf_second_arf, &frame_diff, q_index, cm->seq_params->bit_depth);
+      show_existing_alt_ref =
+          av1_check_show_filtered_frame(tf_buf_second_arf, &frame_diff, q_index,
+                                        cm->seq_params->bit_depth, 1);
       if (show_existing_alt_ref) {
         aom_extend_frame_borders(tf_buf_second_arf, av1_num_planes(cm));
         frame_input->source = tf_buf_second_arf;
diff --git a/av1/encoder/temporal_filter.c b/av1/encoder/temporal_filter.c
index bf827f1..da81e04 100644
--- a/av1/encoder/temporal_filter.c
+++ b/av1/encoder/temporal_filter.c
@@ -1589,7 +1589,10 @@
 
 int av1_check_show_filtered_frame(const YV12_BUFFER_CONFIG *frame,
                                   const FRAME_DIFF *frame_diff, int q_index,
-                                  aom_bit_depth_t bit_depth) {
+                                  aom_bit_depth_t bit_depth,
+                                  int enable_overlay) {
+  if (!enable_overlay) return 1;
+
   const int frame_height = frame->y_crop_height;
   const int frame_width = frame->y_crop_width;
   const int block_height = block_size_high[TF_BLOCK_SIZE];
diff --git a/av1/encoder/temporal_filter.h b/av1/encoder/temporal_filter.h
index d0108c4..5d380a2 100644
--- a/av1/encoder/temporal_filter.h
+++ b/av1/encoder/temporal_filter.h
@@ -341,17 +341,19 @@
  * to make decision.
  *
  * \ingroup src_frame_proc
- * \param[in]  frame        filtered frame's buffer
- * \param[in]  frame_diff   structure of sse and sum of the
- *                          filtered frame.
- * \param[in]  q_index      q_index used for this frame
- * \param[in]  bit_depth    bit depth
+ * \param[in]  frame          filtered frame's buffer
+ * \param[in]  frame_diff     structure of sse and sum of the
+ *                            filtered frame.
+ * \param[in]  q_index        q_index used for this frame
+ * \param[in]  bit_depth      bit depth
+ * \param[in]  enable_overlay arf overlay is enabled or disabled
  * \return     return 1 if this frame can be shown directly, otherwise
  *             return 0
  */
 int av1_check_show_filtered_frame(const YV12_BUFFER_CONFIG *frame,
                                   const FRAME_DIFF *frame_diff, int q_index,
-                                  aom_bit_depth_t bit_depth);
+                                  aom_bit_depth_t bit_depth,
+                                  int enable_overlay);
 
 /*!\cond */
 // Allocates memory for members of TemporalFilterData.