Clean up variable names in row-mt

Renamed some variables in row multi-threading
code. Also, removed redundant initialization
and conditional in tpl multi-threading.

Change-Id: Idac33c7394643d2cc8b89de3270e278c53ecbe63
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index 7dabbbd..3c18fdc 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -217,7 +217,7 @@
   }
 }
 
-static void row_mt_mem_alloc(AV1_COMP *cpi, int max_sb_rows, int max_sb_cols,
+static void row_mt_mem_alloc(AV1_COMP *cpi, int max_rows, int max_cols,
                              int alloc_row_ctx) {
   struct AV1Common *cm = &cpi->common;
   AV1EncRowMultiThreadInfo *const enc_row_mt = &cpi->mt_info.enc_row_mt;
@@ -231,12 +231,12 @@
       int tile_index = tile_row * tile_cols + tile_col;
       TileDataEnc *const this_tile = &cpi->tile_data[tile_index];
 
-      row_mt_sync_mem_alloc(&this_tile->row_mt_sync, cm, max_sb_rows);
+      row_mt_sync_mem_alloc(&this_tile->row_mt_sync, cm, max_rows);
 
       this_tile->row_ctx = NULL;
       if (alloc_row_ctx) {
-        assert(max_sb_cols > 0);
-        const int num_row_ctx = AOMMAX(1, (max_sb_cols - 1));
+        assert(max_cols > 0);
+        const int num_row_ctx = AOMMAX(1, (max_cols - 1));
         CHECK_MEM_ERROR(cm, this_tile->row_ctx,
                         (FRAME_CONTEXT *)aom_memalign(
                             16, num_row_ctx * sizeof(*this_tile->row_ctx)));
@@ -245,8 +245,8 @@
   }
   enc_row_mt->allocated_tile_cols = tile_cols;
   enc_row_mt->allocated_tile_rows = tile_rows;
-  enc_row_mt->allocated_sb_rows = max_sb_rows;
-  enc_row_mt->allocated_sb_cols = max_sb_cols - 1;
+  enc_row_mt->allocated_rows = max_rows;
+  enc_row_mt->allocated_cols = max_cols - 1;
 }
 
 void av1_row_mt_mem_dealloc(AV1_COMP *cpi) {
@@ -266,7 +266,8 @@
       if (cpi->oxcf.algo_cfg.cdf_update_mode) aom_free(this_tile->row_ctx);
     }
   }
-  enc_row_mt->allocated_sb_rows = 0;
+  enc_row_mt->allocated_rows = 0;
+  enc_row_mt->allocated_cols = 0;
   enc_row_mt->allocated_tile_cols = 0;
   enc_row_mt->allocated_tile_rows = 0;
 }
@@ -991,8 +992,8 @@
 
   if (enc_row_mt->allocated_tile_cols != tile_cols ||
       enc_row_mt->allocated_tile_rows != tile_rows ||
-      enc_row_mt->allocated_sb_rows != max_sb_rows ||
-      enc_row_mt->allocated_sb_cols != (max_sb_cols - 1)) {
+      enc_row_mt->allocated_rows != max_sb_rows ||
+      enc_row_mt->allocated_cols != (max_sb_cols - 1)) {
     av1_row_mt_mem_dealloc(cpi);
     row_mt_mem_alloc(cpi, max_sb_rows, max_sb_cols,
                      cpi->oxcf.algo_cfg.cdf_update_mode);
@@ -1066,7 +1067,7 @@
 
   if (enc_row_mt->allocated_tile_cols != tile_cols ||
       enc_row_mt->allocated_tile_rows != tile_rows ||
-      enc_row_mt->allocated_sb_rows != max_mb_rows) {
+      enc_row_mt->allocated_rows != max_mb_rows) {
     av1_row_mt_mem_dealloc(cpi);
     row_mt_mem_alloc(cpi, max_mb_rows, -1, 0);
   }
@@ -1217,7 +1218,7 @@
 
 // Allocate memory for tpl row synchronization.
 void av1_tpl_alloc(AV1TplRowMultiThreadSync *tpl_sync, AV1_COMMON *cm,
-                   int mb_rows, int num_workers) {
+                   int mb_rows) {
   tpl_sync->rows = mb_rows;
 #if CONFIG_MULTITHREAD
   {
@@ -1236,8 +1237,6 @@
     }
   }
 #endif  // CONFIG_MULTITHREAD
-
-  tpl_sync->num_threads_working = num_workers;
   CHECK_MEM_ERROR(cm, tpl_sync->num_finished_cols,
                   aom_malloc(sizeof(*tpl_sync->num_finished_cols) * mb_rows));
 
@@ -1292,10 +1291,9 @@
   else
     num_workers = AOMMIN(num_workers, mt_info->num_enc_workers);
 
-  if (!tpl_sync->sync_range || mb_rows != tpl_sync->rows ||
-      num_workers > tpl_sync->num_threads_working) {
+  if (mb_rows != tpl_sync->rows) {
     av1_tpl_dealloc(tpl_sync);
-    av1_tpl_alloc(tpl_sync, cm, mb_rows, num_workers);
+    av1_tpl_alloc(tpl_sync, cm, mb_rows);
   }
   tpl_sync->num_threads_working = num_workers;