Increase num workers for pass=1

first pass only stage does not have to restrict
it's number of workers to that of the encode stage.
This patch increases the number of workers for first
pass only stage.

Change-Id: I2aba825362f16a1ef3360187b9e50953730c098c
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 8a22da6..85bede5 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -2182,8 +2182,15 @@
     int is_frame_visible = 0;
     int index_size = 0;
     int has_fwd_keyframe = 0;
+    int num_workers = 0;
 
-    const int num_workers = av1_compute_num_enc_workers(cpi);
+    if (cpi->oxcf.pass == 1) {
+#if !CONFIG_REALTIME_ONLY
+      num_workers = av1_fp_compute_num_enc_workers(cpi);
+#endif
+    } else {
+      num_workers = av1_compute_num_enc_workers(cpi);
+    }
     if ((num_workers > 1) && (cpi->mt_info.num_workers == 0))
       av1_create_workers(cpi, num_workers);
 
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index 5a3fdef..c1f2c4c 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -918,18 +918,18 @@
 
 #if !CONFIG_REALTIME_ONLY
 // Computes the number of workers for firstpass stage (row/tile multi-threading)
-static AOM_INLINE int fp_compute_num_enc_workers(AV1_COMP *cpi) {
+int av1_fp_compute_num_enc_workers(AV1_COMP *cpi) {
   AV1_COMMON *cm = &cpi->common;
   const int tile_cols = cm->tiles.cols;
   const int tile_rows = cm->tiles.rows;
   int total_num_threads_row_mt = 0;
+  TileInfo tile_info;
 
   if (cpi->oxcf.max_threads <= 1) return 1;
 
   for (int row = 0; row < tile_rows; row++) {
     for (int col = 0; col < tile_cols; col++) {
-      const int tile_index = row * cm->tiles.cols + col;
-      TileInfo tile_info = cpi->tile_data[tile_index].tile_info;
+      av1_tile_init(&tile_info, cm, row, col);
       const int num_mb_rows_in_tile = av1_get_mb_rows_in_tile(tile_info);
       const int num_mb_cols_in_tile = av1_get_mb_cols_in_tile(tile_info);
       total_num_threads_row_mt +=
@@ -1056,7 +1056,7 @@
   // threads to the theoretical limit in row-mt does not have much impact on
   // post-processing multi-threading stage. Need to revisit this when
   // post-processing time starts shooting up.
-  num_workers = fp_compute_num_enc_workers(cpi);
+  num_workers = av1_fp_compute_num_enc_workers(cpi);
 
   if (enc_row_mt->allocated_tile_cols != tile_cols ||
       enc_row_mt->allocated_tile_rows != tile_rows ||
diff --git a/av1/encoder/ethread.h b/av1/encoder/ethread.h
index 0edcaa4..02964ec 100644
--- a/av1/encoder/ethread.h
+++ b/av1/encoder/ethread.h
@@ -40,6 +40,8 @@
 
 #if !CONFIG_REALTIME_ONLY
 void av1_fp_encode_tiles_row_mt(AV1_COMP *cpi);
+
+int av1_fp_compute_num_enc_workers(AV1_COMP *cpi);
 #endif
 
 void av1_accumulate_frame_counts(struct FRAME_COUNTS *acc_counts,