NEW_MULTISYMBOL: adapt comp_inter_mode.

Change-Id: I2e783a16418708c6403de3c2e84450dbc83df3b7
diff --git a/av1/common/entropy.c b/av1/common/entropy.c
index e4ea24b..75afdc0 100644
--- a/av1/common/entropy.c
+++ b/av1/common/entropy.c
@@ -5690,7 +5690,9 @@
 
   aom_cdf_prob *fc_cdf_ptr;
 
-// FIXME: comp_inter_cdf not defined
+#if CONFIG_NEW_MULTISYMBOL
+  AVERAGE_TILE_CDFS(comp_inter_cdf)
+#endif
 
 // FIXME: comp_ref_cdf and comp_bwd_ref not defined
 
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c
index f47a8ed..5b4ce52 100644
--- a/av1/common/entropymode.c
+++ b/av1/common/entropymode.c
@@ -1383,6 +1383,14 @@
 static const aom_prob default_comp_inter_p[COMP_INTER_CONTEXTS] = {
   239, 183, 119, 96, 41
 };
+#if CONFIG_NEW_MULTISYMBOL
+static const aom_cdf_prob default_comp_inter_cdf[COMP_INTER_CONTEXTS][CDF_SIZE(
+    2)] = { { AOM_ICDF(239 * 128), AOM_ICDF(32768), 0 },
+            { AOM_ICDF(183 * 128), AOM_ICDF(32768), 0 },
+            { AOM_ICDF(119 * 128), AOM_ICDF(32768), 0 },
+            { AOM_ICDF(96 * 128), AOM_ICDF(32768), 0 },
+            { AOM_ICDF(41 * 128), AOM_ICDF(32768), 0 } };
+#endif
 
 #if CONFIG_EXT_REFS
 static const aom_prob default_comp_ref_p[REF_CONTEXTS][FWD_REFS - 1] = {
@@ -4523,6 +4531,9 @@
   av1_copy(fc->partition_prob, default_partition_probs);
   av1_copy(fc->intra_inter_prob, default_intra_inter_p);
   av1_copy(fc->comp_inter_prob, default_comp_inter_p);
+#if CONFIG_NEW_MULTISYMBOL
+  av1_copy(fc->comp_inter_cdf, default_comp_inter_cdf);
+#endif
   av1_copy(fc->comp_ref_prob, default_comp_ref_p);
 #if CONFIG_LV_MAP
   av1_copy(fc->txb_skip, default_txb_skip);
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h
index 40fd389..e7a6ecb 100644
--- a/av1/common/entropymode.h
+++ b/av1/common/entropymode.h
@@ -214,6 +214,9 @@
 #endif  // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
   aom_prob intra_inter_prob[INTRA_INTER_CONTEXTS];
   aom_prob comp_inter_prob[COMP_INTER_CONTEXTS];
+#if CONFIG_NEW_MULTISYMBOL
+  aom_cdf_prob comp_inter_cdf[COMP_INTER_CONTEXTS][CDF_SIZE(2)];
+#endif
   aom_prob single_ref_prob[REF_CONTEXTS][SINGLE_REFS - 1];
 #if CONFIG_EXT_REFS
   aom_prob comp_ref_prob[REF_CONTEXTS][FWD_REFS - 1];
diff --git a/av1/common/pred_common.h b/av1/common/pred_common.h
index ecbe12f..7148849 100644
--- a/av1/common/pred_common.h
+++ b/av1/common/pred_common.h
@@ -101,6 +101,12 @@
                                                    const MACROBLOCKD *xd) {
   return cm->fc->comp_inter_prob[av1_get_reference_mode_context(cm, xd)];
 }
+#if CONFIG_NEW_MULTISYMBOL
+static INLINE aom_cdf_prob *av1_get_reference_mode_cdf(const AV1_COMMON *cm,
+                                                       const MACROBLOCKD *xd) {
+  return xd->tile_ctx->comp_inter_cdf[av1_get_reference_mode_context(cm, xd)];
+}
+#endif
 
 int av1_get_pred_context_comp_ref_p(const AV1_COMMON *cm,
                                     const MACROBLOCKD *xd);
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index af2c5bb..96f8c70 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -275,9 +275,11 @@
   FRAME_CONTEXT *const fc = cm->fc;
   int i, j;
 
+#if !CONFIG_NEW_MULTISYMBOL
   if (cm->reference_mode == REFERENCE_MODE_SELECT)
     for (i = 0; i < COMP_INTER_CONTEXTS; ++i)
       av1_diff_update_prob(r, &fc->comp_inter_prob[i], ACCT_STR);
+#endif
 
   if (cm->reference_mode != COMPOUND_REFERENCE) {
     for (i = 0; i < REF_CONTEXTS; ++i) {
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index bae2c0a..35483a9 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -1238,11 +1238,13 @@
     // does the feature use compound prediction or not
     // (if not specified at the frame/segment level)
     if (cm->reference_mode == REFERENCE_MODE_SELECT) {
-#if SUB8X8_COMP_REF
-      aom_write(w, is_compound, av1_get_reference_mode_prob(cm, xd));
-#else
+#if !SUB8X8_COMP_REF
       if (mbmi->sb_type != BLOCK_4X4)
-        aom_write(w, is_compound, av1_get_reference_mode_prob(cm, xd));
+#endif
+#if CONFIG_NEW_MULTISYMBOL
+        aom_write_symbol(w, is_compound, av1_get_reference_mode_cdf(cm, xd), 2);
+#else
+      aom_write(w, is_compound, av1_get_reference_mode_prob(cm, xd));
 #endif
     } else {
       assert((!is_compound) == (cm->reference_mode == SINGLE_REFERENCE));
@@ -5019,6 +5021,7 @@
                                 counts->intra_inter[i], probwt);
 #endif
 
+#if !CONFIG_NEW_MULTISYMBOL
     if (cpi->allow_comp_inter_inter) {
       const int use_hybrid_pred = cm->reference_mode == REFERENCE_MODE_SELECT;
       if (use_hybrid_pred)
@@ -5026,6 +5029,7 @@
           av1_cond_prob_diff_update(header_bc, &fc->comp_inter_prob[i],
                                     counts->comp_inter[i], probwt);
     }
+#endif
 
     if (cm->reference_mode != COMPOUND_REFERENCE) {
       for (i = 0; i < REF_CONTEXTS; i++) {