JNT_COMP: 4. add context and entropy read/write

Change-Id: I0e6f7ab981e31f7120105515f6204568b6dc82d3
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index d7d7059..f507b93 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -3531,6 +3531,11 @@
       av1_diff_update_prob(&r, &fc->txfm_partition_prob[i], ACCT_STR);
   for (int i = 0; i < SKIP_CONTEXTS; ++i)
     av1_diff_update_prob(&r, &fc->skip_probs[i], ACCT_STR);
+
+#if CONFIG_JNT_COMP
+  for (int i = 0; i < COMP_INDEX_CONTEXTS; ++i)
+    av1_diff_update_prob(&r, &fc->compound_index_probs[i], ACCT_STR);
+#endif  // CONFIG_JNT_COMP
 #endif
 
   if (!frame_is_intra_only(cm)) {
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index d2b0acb..a22f3ec 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -2221,6 +2221,16 @@
   read_ref_frames(cm, xd, r, mbmi->segment_id, mbmi->ref_frame);
   is_compound = has_second_ref(mbmi);
 
+#if CONFIG_JNT_COMP
+  if (is_compound) {
+    const int comp_index_ctx = get_comp_index_context(cm, xd);
+    mbmi->compound_idx =
+        aom_read(r, ec_ctx->compound_index_probs[comp_index_ctx], ACCT_STR);
+    if (xd->counts)
+      ++xd->counts->compound_index[comp_index_ctx][mbmi->compound_idx];
+  }
+#endif  // CONFIG_JNT_COMP
+
 #if CONFIG_EXT_COMP_REFS
 #if !USE_UNI_COMP_REFS
   // NOTE: uni-directional comp refs disabled