Define ColorCost in the same way as MapCdf

The MapCdf and ColorCost typedefs are both pointers to three-dimensional
arrays. The reason ColorCost is defined as a pointer to a
four-dimensinal array is apparently to allow it to point to a const
array. We can solve that problem by defining ColorCost to be a pointer
to a const array.

A downside is that the new definition of ColorCost does not show the
first dimension, so I added comments to note the first dimensions of the
three-dimensional arrays that MapCdf and ColorCost point to.

Change-Id: I115d892f05b4af2208ab99ca743562e2100ab836
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 331d33f..1d1c381 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -1529,10 +1529,12 @@
 }
 
 /* clang-format off */
+// Pointer to a three-dimensional array whose first dimension is PALETTE_SIZES.
 typedef aom_cdf_prob (*MapCdf)[PALETTE_COLOR_INDEX_CONTEXTS]
                               [CDF_SIZE(PALETTE_COLORS)];
-typedef const int (*ColorCost)[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS]
-                              [PALETTE_COLORS];
+// Pointer to a const three-dimensional array whose first dimension is
+// PALETTE_SIZES.
+typedef const int (*ColorCost)[PALETTE_COLOR_INDEX_CONTEXTS][PALETTE_COLORS];
 /* clang-format on */
 
 typedef struct {
diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c
index 43ac270..bc63cc0 100644
--- a/av1/encoder/tokenize.c
+++ b/av1/encoder/tokenize.c
@@ -51,7 +51,7 @@
           color_map, plane_block_width, i, j, &color_new_idx);
       assert(color_new_idx >= 0 && color_new_idx < n);
       if (calc_rate) {
-        this_rate += (*color_cost)[palette_size_idx][color_ctx][color_new_idx];
+        this_rate += color_cost[palette_size_idx][color_ctx][color_new_idx];
       } else {
         (*t)->token = color_new_idx;
         (*t)->color_ctx = color_ctx;
@@ -82,8 +82,8 @@
   params->color_map = xd->plane[plane].color_index_map;
   params->map_cdf = plane ? xd->tile_ctx->palette_uv_color_index_cdf
                           : xd->tile_ctx->palette_y_color_index_cdf;
-  params->color_cost = plane ? &x->mode_costs.palette_uv_color_cost
-                             : &x->mode_costs.palette_y_color_cost;
+  params->color_cost = plane ? x->mode_costs.palette_uv_color_cost
+                             : x->mode_costs.palette_y_color_cost;
   params->n_colors = pmi->palette_size[plane];
   av1_get_block_dimensions(bsize, plane, xd, &params->plane_width, NULL,
                            &params->rows, &params->cols);