rtc: Avoid cdf update for rtc mode

For real time encoding with cost update frequency
set to COST_UPD_TILE/COST_UPD_OFF, tile ctxt is
not updated at superblock level. Thus, it is not
required to update the CDF's during encoding.

Change-Id: If4a48d958d69f61578826f143e815f84e4070c1e
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 52fa8b0..345ad12 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -750,6 +750,12 @@
   }
 }
 
+static AOM_INLINE int is_rtc_mode(const CostUpdateFreq *cost_upd_freq,
+                                  int use_non_rd_mode) {
+  return (use_non_rd_mode && cost_upd_freq->coeff >= 2 &&
+          cost_upd_freq->mode >= 2 && cost_upd_freq->mv >= 2);
+}
+
 /*!\brief Encode a superblock row by breaking it into superblocks
  *
  * \ingroup partition_search
@@ -777,8 +783,7 @@
   const int use_nonrd_mode = cpi->sf.rt_sf.use_nonrd_pick_mode;
   const CostUpdateFreq *const cost_upd_freq = &cpi->oxcf.cost_upd_freq;
   const int rtc_mode = is_rtc_mode(cost_upd_freq, use_nonrd_mode);
-  const int update_cdf =
-      tile_data->allow_update_cdf && row_mt_enabled && !rtc_mode;
+  const int update_cdf = tile_data->allow_update_cdf && row_mt_enabled;
 
 #if CONFIG_COLLECT_COMPONENT_TIMING
   start_timing(cpi, encode_sb_row_time);
@@ -911,6 +916,9 @@
   TokenList *tplist = token_info->tplist[0][0];
   unsigned int tile_tok = 0;
   int tplist_count = 0;
+  const int use_nonrd_mode = cpi->sf.rt_sf.use_nonrd_pick_mode;
+  const CostUpdateFreq *const cost_upd_freq = &cpi->oxcf.cost_upd_freq;
+  const int rtc_mode = is_rtc_mode(cost_upd_freq, use_nonrd_mode);
 
   for (tile_row = 0; tile_row < tile_rows; ++tile_row) {
     for (tile_col = 0; tile_col < tile_cols; ++tile_col) {
@@ -931,8 +939,9 @@
         tplist_count = av1_get_sb_rows_in_tile(cm, tile_data->tile_info);
       }
       tile_data->allow_update_cdf = !cm->tiles.large_scale;
-      tile_data->allow_update_cdf =
-          tile_data->allow_update_cdf && !cm->features.disable_cdf_update;
+      tile_data->allow_update_cdf = tile_data->allow_update_cdf &&
+                                    !cm->features.disable_cdf_update &&
+                                    !rtc_mode;
       tile_data->tctx = *cm->fc;
     }
   }
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 2db238a..a23892e 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -3213,12 +3213,6 @@
          cm->show_frame;
 }
 
-static AOM_INLINE int is_rtc_mode(const CostUpdateFreq *cost_upd_freq,
-                                  int use_non_rd_mode) {
-  return (use_non_rd_mode && cost_upd_freq->coeff >= 2 &&
-          cost_upd_freq->mode >= 2 && cost_upd_freq->mv >= 2);
-}
-
 #if CONFIG_AV1_TEMPORAL_DENOISING
 static INLINE int denoise_svc(const struct AV1_COMP *const cpi) {
   return (!cpi->use_svc || (cpi->use_svc && cpi->svc.spatial_layer_id >=
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index 25f8e77..0a9325c 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -432,9 +432,6 @@
   int thread_id = thread_data->thread_id;
   AV1EncRowMultiThreadInfo *const enc_row_mt = &cpi->mt_info.enc_row_mt;
   int cur_tile_id = enc_row_mt->thread_id_to_tile_id[thread_id];
-  const CostUpdateFreq *const cost_upd_freq = &cpi->oxcf.cost_upd_freq;
-  const int rtc_mode =
-      is_rtc_mode(cost_upd_freq, cpi->sf.rt_sf.use_nonrd_pick_mode);
 #if CONFIG_MULTITHREAD
   pthread_mutex_t *enc_row_mt_mutex_ = enc_row_mt->mutex_;
 #endif
@@ -474,7 +471,7 @@
     td->mb.e_mbd.tile_ctx = td->tctx;
     td->mb.tile_pb_ctx = &this_tile->tctx;
 
-    if (this_tile->allow_update_cdf && !rtc_mode) {
+    if (this_tile->allow_update_cdf) {
       td->mb.row_ctx = this_tile->row_ctx;
       if (current_mi_row == tile_info->mi_row_start)
         memcpy(td->mb.e_mbd.tile_ctx, &this_tile->tctx, sizeof(FRAME_CONTEXT));