Exclude tpl_mode.{c,h} from CONFIG_REALTIME_ONLY

0.7% binary size reduction.

BUG=aomedia:2397

Change-Id: Ie30fd4dc6763d8577ac6af0a5b14aa033ff44110
diff --git a/av1/av1.cmake b/av1/av1.cmake
index ea0d309..16d1e34 100644
--- a/av1/av1.cmake
+++ b/av1/av1.cmake
@@ -415,6 +415,8 @@
                    "${AOM_ROOT}/av1/encoder/temporal_filter.c"
                    "${AOM_ROOT}/av1/encoder/temporal_filter.h"
                    "${AOM_ROOT}/av1/encoder/temporal_filter_constants.h"
+                   "${AOM_ROOT}/av1/encoder/tpl_model.c"
+                   "${AOM_ROOT}/av1/encoder/tpl_model.h"
                    "${AOM_ROOT}/av1/encoder/x86/temporal_filter_sse4.c"
                    "${AOM_ROOT}/av1/encoder/x86/highbd_temporal_filter_sse4.c")
 endif()
diff --git a/av1/encoder/encode_strategy.c b/av1/encoder/encode_strategy.c
index 3c87a98..f1f139f 100644
--- a/av1/encoder/encode_strategy.c
+++ b/av1/encoder/encode_strategy.c
@@ -1299,7 +1299,7 @@
          REF_FRAMES * sizeof(*cm->remapped_ref_idx));
 
   cpi->td.mb.e_mbd.delta_qindex = 0;
-#if ENABLE_KF_TPL
+#if ENABLE_KF_TPL && !CONFIG_REALTIME_ONLY
   if (oxcf->lag_in_frames > 0 && oxcf->pass != 1 &&
       frame_params.frame_type == KEY_FRAME && frame_params.show_frame) {
     av1_configure_buffer_updates(cpi, &frame_params, frame_update_type, 0);
@@ -1312,6 +1312,7 @@
     cm->using_qmatrix = cpi->oxcf.using_qm;
     cm->min_qmlevel = cpi->oxcf.qm_minlevel;
     cm->max_qmlevel = cpi->oxcf.qm_maxlevel;
+#if !CONFIG_REALTIME_ONLY
     if (oxcf->lag_in_frames > 0 && oxcf->pass != 1) {
       if (cpi->gf_group.index == 1 && cpi->oxcf.enable_tpl_model) {
         av1_configure_buffer_updates(cpi, &frame_params, frame_update_type, 0);
@@ -1320,6 +1321,7 @@
         assert(cpi->num_gf_group_show_frames == 1);
       }
     }
+#endif
   }
 
 #if TEMPORAL_FILTER_KEY_FRAME
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index ec8e1b3..36ec9de 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -3637,7 +3637,6 @@
 
   return rdmult;
 }
-#endif  // !CONFIG_REALTIME_ONLY
 
 // analysis_type 0: Use mc_dep_cost and intra_cost
 // analysis_type 1: Use count of best inter predictor chosen
@@ -3812,6 +3811,7 @@
     }
   }
 }
+#endif  // !CONFIG_REALTIME_ONLY
 
 #define AVG_CDF_WEIGHT_LEFT 3
 #define AVG_CDF_WEIGHT_TOP_RIGHT 1
@@ -4160,11 +4160,12 @@
     xd->cur_frame_force_integer_mv = cm->cur_frame_force_integer_mv;
 
     x->sb_energy_level = 0;
+#if !CONFIG_REALTIME_ONLY
     if (cm->delta_q_info.delta_q_present_flag) {
       setup_delta_q(cpi, td, x, tile_info, mi_row, mi_col, num_planes);
       av1_tpl_rdmult_setup_sb(cpi, x, sb_size, mi_row, mi_col);
     }
-
+#endif
     td->mb.cb_coef_buff = av1_get_cb_coeff_buffer(cpi, mi_row, mi_col);
 
     MB_MODE_INFO **mi = cm->mi_grid_base + get_mi_grid_idx(cm, mi_row, mi_col);
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 4a186e4..ef739b1 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -3876,6 +3876,7 @@
   cm->switchable_motion_mode = 1;
 }
 
+#if !CONFIG_REALTIME_ONLY
 static int get_gfu_boost_from_r0(double r0, int frames_to_key) {
   double factor = sqrt((double)frames_to_key);
   factor = AOMMIN(factor, 10.0);
@@ -3891,6 +3892,7 @@
   const int boost = (int)rint((75.0 + 14.0 * factor) / r0);
   return boost;
 }
+#endif
 
 int combine_prior_with_tpl_boost(int prior_boost, int tpl_boost,
                                  int frames_to_key) {
@@ -3902,6 +3904,7 @@
   return boost;
 }
 
+#if !CONFIG_REALTIME_ONLY
 static void process_tpl_stats_frame(AV1_COMP *cpi) {
   const GF_GROUP *const gf_group = &cpi->gf_group;
   AV1_COMMON *const cm = &cpi->common;
@@ -3972,6 +3975,7 @@
     }
   }
 }
+#endif  // !CONFIG_REALTIME_ONLY
 
 static int determine_frame_high_precision_mv(const AV1_COMP *cpi, int qindex) {
   (void)cpi;
@@ -3991,11 +3995,13 @@
   // Setup variables that depend on the dimensions of the frame.
   av1_set_speed_features_framesize_dependent(cpi, cpi->speed);
 
+#if !CONFIG_REALTIME_ONLY
   if (cpi->oxcf.enable_tpl_model && cpi->tpl_model_pass == 0 &&
       is_frame_tpl_eligible(cpi)) {
     process_tpl_stats_frame(cpi);
     av1_tpl_rdmult_setup(cpi);
   }
+#endif
 
   // Decide q and q bounds.
   *q = av1_rc_pick_q_and_bounds(cpi, &cpi->rc, cm->width, cm->height,
@@ -5138,12 +5144,14 @@
       loop = 1;
     }
 
+#if !CONFIG_REALTIME_ONLY
     if (cpi->tpl_model_pass == 1) {
       assert(cpi->oxcf.enable_tpl_model == 2);
       av1_tpl_setup_forward_stats(cpi);
       cpi->tpl_model_pass = 0;
       loop = 1;
     }
+#endif
 
     if (loop) {
       ++loop_count;