Refactor av1_init_tile_data function

Extracted the allocations of tile level structures from
av1_init_tile_data into a separate function to facilitate
row-based multi-threading in encoder.

Change-Id: I8720b04fdc77c3073380eaf73e71fa759fdf2961
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index e9b81ed..7df8aea 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -225,6 +225,9 @@
   const int tile_rows = cm->tile_rows;
   int num_workers = AOMMIN(cpi->oxcf.max_threads, tile_cols * tile_rows);
 
+  if (cpi->tile_data == NULL || cpi->allocated_tiles < tile_cols * tile_rows)
+    av1_alloc_tile_data(cpi);
+
   av1_init_tile_data(cpi);
   // Only run once to create threads and allocate thread data.
   if (cpi->num_workers == 0) {