Use enc_row_mt->allocated_tile_cols/rows correctly

enc_row_mt->allocated_tile_cols and enc_row_mt->allocated_tile_rows
should reflect the number of elements in the cpi->tile_data array whose
row_mt_sync field has been allocated by row_mt_mem_alloc().

Do not modify enc_row_mt->allocated_tile_cols and
enc_row_mt->allocated_tile_rows in av1_alloc_tile_data(). Instead,
modify them in row_mt_mem_alloc() and av1_row_mt_mem_dealloc().

Bug: 487259772
Change-Id: Id2db863a6cdeac6bbb93a45f7bf87a5226eb8dde
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index ece4d958..6cc6770 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -1365,7 +1365,6 @@
 
 void av1_alloc_tile_data(AV1_COMP *cpi) {
   AV1_COMMON *const cm = &cpi->common;
-  AV1EncRowMultiThreadInfo *const enc_row_mt = &cpi->mt_info.enc_row_mt;
   const int tile_cols = cm->tiles.cols;
   const int tile_rows = cm->tiles.rows;
 
@@ -1373,16 +1372,12 @@
 
   aom_free(cpi->tile_data);
   cpi->allocated_tiles = 0;
-  enc_row_mt->allocated_tile_cols = 0;
-  enc_row_mt->allocated_tile_rows = 0;
 
   CHECK_MEM_ERROR(
       cm, cpi->tile_data,
       aom_memalign(32, tile_cols * tile_rows * sizeof(*cpi->tile_data)));
 
   cpi->allocated_tiles = tile_cols * tile_rows;
-  enc_row_mt->allocated_tile_cols = tile_cols;
-  enc_row_mt->allocated_tile_rows = tile_rows;
   for (int tile_row = 0; tile_row < tile_rows; ++tile_row) {
     for (int tile_col = 0; tile_col < tile_cols; ++tile_col) {
       const int tile_index = tile_row * tile_cols + tile_col;
diff --git a/av1/encoder/encoder_alloc.h b/av1/encoder/encoder_alloc.h
index 33caa2a..97b5273 100644
--- a/av1/encoder/encoder_alloc.h
+++ b/av1/encoder/encoder_alloc.h
@@ -185,15 +185,12 @@
 static inline void dealloc_compressor_data(AV1_COMP *cpi) {
   AV1_COMMON *const cm = &cpi->common;
   TokenInfo *token_info = &cpi->token_info;
-  AV1EncRowMultiThreadInfo *const enc_row_mt = &cpi->mt_info.enc_row_mt;
   const int num_planes = av1_num_planes(cm);
   dealloc_context_buffers_ext(&cpi->mbmi_ext_info);
 
   aom_free(cpi->tile_data);
   cpi->tile_data = NULL;
   cpi->allocated_tiles = 0;
-  enc_row_mt->allocated_tile_cols = 0;
-  enc_row_mt->allocated_tile_rows = 0;
 
   // Delete sementation map
   aom_free(cpi->enc_seg.map);
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index c10c662..1c8d1bd 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -265,6 +265,8 @@
       }
     }
   }
+  enc_row_mt->allocated_tile_cols = tile_cols;
+  enc_row_mt->allocated_tile_rows = tile_rows;
   const int sb_rows = get_sb_rows_in_frame(cm);
   CHECK_MEM_ERROR(
       cm, enc_row_mt->num_tile_cols_done,
@@ -295,6 +297,8 @@
       }
     }
   }
+  enc_row_mt->allocated_tile_cols = 0;
+  enc_row_mt->allocated_tile_rows = 0;
   aom_free(enc_row_mt->num_tile_cols_done);
   enc_row_mt->num_tile_cols_done = NULL;
   enc_row_mt->allocated_rows = 0;