NEW_MULTISYMBOL: use CDFs for palette tree coding.

AWCY results, 1 frame, tune-content=1

objective-1-fast:
PSNR (Y, Cb, Cr) : -0.26%, -0.24%, -0.26%
PSNR-HVS         : -0.26%
MS-SSIM          : -0.25%

screenshots:
PSNR (Y, Cb, Cr) :  -2.28%, -2.29%, -2.29%
PSNR-HVS         :  -2.30%
MS-SSIM          :  -2.26%

twitch-1 :
PSNR (Y, Cb, Cr) : -0.73%, -0.73%, -0.73%
PSNR-HVS         : -0.75%
MS-SSIM          : -0.74%

Change-Id: I7aac475710ab3895778d7ff05d9113f5713133b1
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index 9f42d06..b2b93e6 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -825,10 +825,17 @@
                                                    [palette_y_mode_ctx],
                  ACCT_STR)) {
       pmi->palette_size[0] =
+#if CONFIG_NEW_MULTISYMBOL
+          aom_read_symbol(r,
+                          xd->tile_ctx->palette_y_size_cdf[bsize - BLOCK_8X8],
+                          PALETTE_SIZES, ACCT_STR) +
+          2;
+#else
           aom_read_tree(r, av1_palette_size_tree,
                         av1_default_palette_y_size_prob[bsize - BLOCK_8X8],
                         ACCT_STR) +
           2;
+#endif
       n = pmi->palette_size[0];
 #if CONFIG_PALETTE_DELTA_ENCODING
       read_palette_colors_y(xd, cm->bit_depth, pmi, r);
@@ -847,10 +854,17 @@
     if (aom_read(r, av1_default_palette_uv_mode_prob[palette_uv_mode_ctx],
                  ACCT_STR)) {
       pmi->palette_size[1] =
+#if CONFIG_NEW_MULTISYMBOL
+          aom_read_symbol(r,
+                          xd->tile_ctx->palette_uv_size_cdf[bsize - BLOCK_8X8],
+                          PALETTE_SIZES, ACCT_STR) +
+          2;
+#else
           aom_read_tree(r, av1_palette_size_tree,
                         av1_default_palette_uv_size_prob[bsize - BLOCK_8X8],
                         ACCT_STR) +
           2;
+#endif
       n = pmi->palette_size[1];
 #if CONFIG_PALETTE_DELTA_ENCODING
       read_palette_colors_uv(xd, cm->bit_depth, pmi, r);
diff --git a/av1/decoder/detokenize.c b/av1/decoder/detokenize.c
index 3207806..d2d7894 100644
--- a/av1/decoder/detokenize.c
+++ b/av1/decoder/detokenize.c
@@ -260,10 +260,18 @@
   const int n = mbmi->palette_mode_info.palette_size[plane];
   int i, j;
   uint8_t *const color_map = xd->plane[plane].color_index_map;
+#if CONFIG_NEW_MULTISYMBOL
+  aom_cdf_prob(
+      *palette_cdf)[PALETTE_COLOR_INDEX_CONTEXTS][CDF_SIZE(PALETTE_COLORS)] =
+      plane ? xd->tile_ctx->palette_uv_color_index_cdf
+            : xd->tile_ctx->palette_y_color_index_cdf;
+
+#else
   const aom_prob(
       *const prob)[PALETTE_COLOR_INDEX_CONTEXTS][PALETTE_COLORS - 1] =
       plane ? av1_default_palette_uv_color_index_prob
             : av1_default_palette_y_color_index_prob;
+#endif
   int plane_block_width, plane_block_height, rows, cols;
   av1_get_block_dimensions(mbmi->sb_type, plane, xd, &plane_block_width,
                            &plane_block_height, &rows, &cols);
@@ -275,9 +283,14 @@
     for (j = AOMMIN(i, cols - 1); j >= AOMMAX(0, i - rows + 1); --j) {
       const int color_ctx = av1_get_palette_color_index_context(
           color_map, plane_block_width, (i - j), j, n, color_order, NULL);
+#if CONFIG_NEW_MULTISYMBOL
+      const int color_idx = aom_read_symbol(
+          r, palette_cdf[n - PALETTE_MIN_SIZE][color_ctx], n, ACCT_STR);
+#else
       const int color_idx =
           aom_read_tree(r, av1_palette_color_index_tree[n - 2],
                         prob[n - 2][color_ctx], ACCT_STR);
+#endif
       assert(color_idx >= 0 && color_idx < n);
       color_map[(i - j) * plane_block_width + j] = color_order[color_idx];
     }
@@ -295,9 +308,14 @@
     for (j = (i == 0 ? 1 : 0); j < cols; ++j) {
       const int color_ctx = av1_get_palette_color_index_context(
           color_map, plane_block_width, i, j, n, color_order, NULL);
+#if CONFIG_NEW_MULTISYMBOL
+      const int color_idx = aom_read_symbol(
+          r, palette_cdf[n - PALETTE_MIN_SIZE][color_ctx], n, ACCT_STR);
+#else
       const int color_idx =
           aom_read_tree(r, av1_palette_color_index_tree[n - PALETTE_MIN_SIZE],
                         prob[n - PALETTE_MIN_SIZE][color_ctx], ACCT_STR);
+#endif
       assert(color_idx >= 0 && color_idx < n);
       color_map[i * plane_block_width + j] = color_order[color_idx];
     }