Move largest_tile_id to encoder data

largest_tile_id is used in encoder only, and is moved to the encoder
data.

Change-Id: Id8558b7ee1f3b72195adbda1f91b794764547a6a
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index 5a785f7..1340a18 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -333,7 +333,6 @@
   aom_op_timing_info_t op_frame_timing[MAX_NUM_OPERATING_POINTS + 1];
   uint32_t frame_presentation_time;
 
-  int largest_tile_id;
   int context_update_tile_id;
 
   // Scale of the current frame with respect to itself.
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index a19069e..b2be167 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -3459,7 +3459,7 @@
   const int have_tiles = tile_cols * tile_rows > 1;
   int first_tg = 1;
 
-  cm->largest_tile_id = 0;
+  cpi->largest_tile_id = 0;
 
   if (cm->large_scale_tile) {
     // For large_scale_tile case, we always have only one tile group, so it can
@@ -3527,7 +3527,7 @@
         // Record the maximum tile size we see, so we can compact headers later.
         if (tile_size > max_tile_size) {
           max_tile_size = tile_size;
-          cm->largest_tile_id = tile_cols * tile_row + tile_col;
+          cpi->largest_tile_id = tile_cols * tile_row + tile_col;
         }
 
         if (have_tiles) {
@@ -3668,7 +3668,7 @@
       curr_tg_data_size += (tile_size + (is_last_tile_in_tg ? 0 : 4));
       buf->size = tile_size;
       if (tile_size > max_tile_size) {
-        cm->largest_tile_id = tile_cols * tile_row + tile_col;
+        cpi->largest_tile_id = tile_cols * tile_row + tile_col;
         max_tile_size = tile_size;
       }
 
@@ -3703,7 +3703,7 @@
           // Force context update tile to be the first tile in error
           // resiliant mode as the duplicate frame headers will have
           // context_update_tile_id set to 0
-          cm->largest_tile_id = 0;
+          cpi->largest_tile_id = 0;
 
           // Rewrite the OBU header to change the OBU type to Redundant Frame
           // Header.
@@ -3726,7 +3726,7 @@
     // Fill in context_update_tile_id indicating the tile to use for the
     // cdf update. The encoder currently sets it to the largest tile
     // (but is up to the encoder)
-    aom_wb_overwrite_literal(saved_wb, cm->largest_tile_id,
+    aom_wb_overwrite_literal(saved_wb, cpi->largest_tile_id,
                              cm->log2_tile_cols + cm->log2_tile_rows);
     // If more than one tile group. tile_size_bytes takes the default value 4
     // and does not need to be set. For a single tile group it is set in the
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 56d83b2..cd75a6b 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -5423,7 +5423,7 @@
 #endif  // CONFIG_ENTROPY_STATS
 
   if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
-    *cm->fc = cpi->tile_data[cm->largest_tile_id].tctx;
+    *cm->fc = cpi->tile_data[cpi->largest_tile_id].tctx;
     av1_reset_cdf_symbol_counters(cm->fc);
   }
 
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 41cd62e..385eea0 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -790,6 +790,7 @@
 
   TOKENEXTRA *tile_tok[MAX_TILE_ROWS][MAX_TILE_COLS];
   TOKENLIST *tplist[MAX_TILE_ROWS][MAX_TILE_COLS];
+  int largest_tile_id;
 
   TileBufferEnc tile_buffers[MAX_TILE_ROWS][MAX_TILE_COLS];