Initialize pc_tree_stats in reset_partition

Uniniatialized variables in pc_tree_stats have been set
to zero/INT64_MAX for all nodes.

If some of the partitions/sub-blocks are skipped, their
pc_tree_stats are not cleared. These stats would contain
random values, output of ml_prune_2pass_split_partition
would be different when multi-threading is enabled.

This CL fixes the issue by resetting pc_tree_stats in
reset_partition function.

STATS_CHANGED

Change-Id: I6957562884c41341e4237328e2b419a61a3a78f5
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 9d8df35..0db78e2 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -2352,6 +2352,17 @@
   pc_tree->cb_search_range = SEARCH_FULL_PLANE;
   pc_tree->none.skip = 0;
 
+  pc_tree->pc_tree_stats.valid = 0;
+  pc_tree->pc_tree_stats.split = 0;
+  pc_tree->pc_tree_stats.skip = 0;
+  pc_tree->pc_tree_stats.rdcost = INT64_MAX;
+
+  for (int i = 0; i < 4; i++) {
+    pc_tree->pc_tree_stats.sub_block_split[i] = 0;
+    pc_tree->pc_tree_stats.sub_block_skip[i] = 0;
+    pc_tree->pc_tree_stats.sub_block_rdcost[i] = INT64_MAX;
+  }
+
   if (bsize >= BLOCK_8X8) {
     BLOCK_SIZE subsize = get_partition_subsize(bsize, PARTITION_SPLIT);
     for (int idx = 0; idx < 4; ++idx)
@@ -4417,15 +4428,6 @@
   }
 }
 
-// clear pc_tree_stats
-static INLINE void clear_pc_tree_stats(PC_TREE *pt) {
-  if (pt == NULL) return;
-  pt->pc_tree_stats.valid = 0;
-  for (int i = 0; i < 4; ++i) {
-    clear_pc_tree_stats(pt->split[i]);
-  }
-}
-
 // Minimum number of samples to trigger the
 // mode_pruning_based_on_two_pass_partition_search feature.
 #define FIRST_PARTITION_PASS_MIN_SAMPLES 16
@@ -4659,7 +4661,6 @@
         // Reset the stats tables.
         if (sf->mode_pruning_based_on_two_pass_partition_search)
           av1_zero(x->first_partition_pass_stats);
-        clear_pc_tree_stats(pc_root);
         rd_pick_sqr_partition(cpi, td, tile_data, tp, mi_row, mi_col,
                               cm->seq_params.sb_size, &dummy_rdc, INT64_MAX,
                               pc_root, NULL);