Add cdfs and mask buffers for mrc-tx

These are not currently being used for anything so there is
no impact on performance.

Change-Id: Ida4e0afcc10bee665f8daa379314cd18b3a4ea28
diff --git a/av1/encoder/block.h b/av1/encoder/block.h
index 59f45ee..6b4c354 100644
--- a/av1/encoder/block.h
+++ b/av1/encoder/block.h
@@ -228,6 +228,12 @@
   int partition_cost[PARTITION_CONTEXTS + CONFIG_UNPOISON_PARTITION_CTX]
                     [PARTITION_TYPES];
 #endif  // CONFIG_EXT_PARTITION_TYPES
+#if CONFIG_MRC_TX
+  int mrc_mask_inter_cost[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS]
+                         [PALETTE_COLORS];
+  int mrc_mask_intra_cost[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS]
+                         [PALETTE_COLORS];
+#endif  // CONFIG_MRC_TX
   int palette_y_size_cost[PALETTE_BLOCK_SIZES][PALETTE_SIZES];
   int palette_uv_size_cost[PALETTE_BLOCK_SIZES][PALETTE_SIZES];
   int palette_y_color_cost[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS]
diff --git a/av1/encoder/context_tree.c b/av1/encoder/context_tree.c
index 41ca53e..bd9a7d0 100644
--- a/av1/encoder/context_tree.c
+++ b/av1/encoder/context_tree.c
@@ -69,6 +69,10 @@
         cm, ctx->color_index_map[i],
         aom_memalign(32, num_pix * sizeof(*ctx->color_index_map[i])));
   }
+#if CONFIG_MRC_TX
+  CHECK_MEM_ERROR(cm, ctx->mrc_mask,
+                  aom_memalign(32, num_pix * sizeof(*ctx->mrc_mask)));
+#endif  // CONFIG_MRC_TX
 }
 
 static void free_mode_context(PICK_MODE_CONTEXT *ctx) {
@@ -100,6 +104,10 @@
     aom_free(ctx->color_index_map[i]);
     ctx->color_index_map[i] = 0;
   }
+#if CONFIG_MRC_TX
+  aom_free(ctx->mrc_mask);
+  ctx->mrc_mask[i] = 0;
+#endif  // CONFIG_MRC_TX
 }
 
 static void alloc_tree_contexts(AV1_COMMON *cm, PC_TREE *tree,
diff --git a/av1/encoder/context_tree.h b/av1/encoder/context_tree.h
index 8027a3f..64c23fc 100644
--- a/av1/encoder/context_tree.h
+++ b/av1/encoder/context_tree.h
@@ -28,6 +28,9 @@
   MODE_INFO mic;
   MB_MODE_INFO_EXT mbmi_ext;
   uint8_t *color_index_map[2];
+#if CONFIG_MRC_TX
+  uint8_t *mrc_mask;
+#endif  // CONFIG_MRC_TX
 #if CONFIG_VAR_TX
   uint8_t *blk_skip[MAX_MB_PLANE];
 #endif
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 35cfafc..501c536 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -651,6 +651,9 @@
 #endif  // CONFIG_LV_MAP
   }
   for (i = 0; i < 2; ++i) pd[i].color_index_map = ctx->color_index_map[i];
+#if CONFIG_MRC_TX
+  xd->mrc_mask = ctx->mrc_mask;
+#endif  // CONFIG_MRC_TX
   // Restore the coding context of the MB to that that was in place
   // when the mode was picked for it
   for (y = 0; y < mi_height; y++)
@@ -1407,6 +1410,9 @@
   }
 
   for (i = 0; i < 2; ++i) pd[i].color_index_map = ctx->color_index_map[i];
+#if CONFIG_MRC_TX
+  xd->mrc_mask = ctx->mrc_mask;
+#endif  // CONFIG_MRC_TX
 
   ctx->skippable = 0;
 
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index 8a2a63c..c30506a 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -132,6 +132,16 @@
                                fc->palette_uv_color_index_cdf[i][j], NULL);
     }
   }
+#if CONFIG_MRC_TX
+  for (i = 0; i < PALETTE_SIZES; ++i) {
+    for (j = 0; j < PALETTE_COLOR_INDEX_CONTEXTS; ++j) {
+      av1_cost_tokens_from_cdf(x->mrc_mask_inter_cost[i][j],
+                               fc->mrc_mask_inter_cdf[i][j], NULL);
+      av1_cost_tokens_from_cdf(x->mrc_mask_intra_cost[i][j],
+                               fc->mrc_mask_intra_cdf[i][j], NULL);
+    }
+  }
+#endif  // CONFIG_MRC_TX
 
 #if CONFIG_CFL
   int sign_cost[CFL_JOINT_SIGNS];