Use pc_root pointer in ThreadData to allocate PC_TREE root

In this CL, the existing pointer 'rt_pc_root' in ThreadData
structure has been renamed to 'pc_root' which is used to
allocate the PC_TREE node for all encoding modes. This
facilitates invoking av1_free_pc_tree_recursive() during
encoder_destroy() in order to prevent potential memory leaks
in case of early termination.

Bug: aomedia:3276
Change-Id: I872b4cb8a45d4089c58ad5e578b452878e907c30
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index 24538b4..af567ba 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -621,7 +621,7 @@
 
   // Preallocate the pc_tree for realtime coding to reduce the cost of memory
   // allocation.
-  thread_data->td->rt_pc_root =
+  thread_data->td->pc_root =
       cpi->sf.rt_sf.use_nonrd_pick_mode
           ? av1_alloc_pc_tree_node(cm->seq_params->sb_size)
           : NULL;
@@ -720,8 +720,9 @@
     // encoding and loop filter stage.
     launch_loop_filter_rows(cm, thread_data, enc_row_mt, mib_size_log2);
   }
-  av1_free_pc_tree_recursive(thread_data->td->rt_pc_root, av1_num_planes(cm), 0,
-                             0, cpi->sf.part_sf.partition_search_type);
+  av1_free_pc_tree_recursive(thread_data->td->pc_root, av1_num_planes(cm), 0, 0,
+                             cpi->sf.part_sf.partition_search_type);
+  thread_data->td->pc_root = NULL;
   error_info->setjmp = 0;
   return 1;
 }
@@ -751,7 +752,7 @@
 
   // Preallocate the pc_tree for realtime coding to reduce the cost of memory
   // allocation.
-  thread_data->td->rt_pc_root =
+  thread_data->td->pc_root =
       cpi->sf.rt_sf.use_nonrd_pick_mode
           ? av1_alloc_pc_tree_node(cm->seq_params->sb_size)
           : NULL;
@@ -768,9 +769,9 @@
     av1_encode_tile(cpi, thread_data->td, tile_row, tile_col);
   }
 
-  av1_free_pc_tree_recursive(thread_data->td->rt_pc_root, av1_num_planes(cm), 0,
-                             0, cpi->sf.part_sf.partition_search_type);
-
+  av1_free_pc_tree_recursive(thread_data->td->pc_root, av1_num_planes(cm), 0, 0,
+                             cpi->sf.part_sf.partition_search_type);
+  thread_data->td->pc_root = NULL;
   error_info->setjmp = 0;
   return 1;
 }