JNT_COMP: 6. support wedge

Support compound_segment and wedge.
JNT_COMP is a competitor to compound_segment and wedge. They are
mutually exclusive.

Change-Id: Id93c36de44a69008182424f40325e42e699bedcd
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index ae4529f..7825846 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -2642,24 +2642,20 @@
       ) {
     if (is_any_masked_compound_used(bsize)) {
 #if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
-      if (cm->allow_masked_compound) {
+#if CONFIG_JNT_COMP
+      if (cm->allow_masked_compound && mbmi->compound_idx)
+#else
+      if (cm->allow_masked_compound)
+#endif  // CONFIG_JNT_COMP
+      {
 #if CONFIG_WEDGE && CONFIG_COMPOUND_SEGMENT
         if (!is_interinter_compound_used(COMPOUND_WEDGE, bsize))
           mbmi->interinter_compound_type =
               aom_read_bit(r, ACCT_STR) ? COMPOUND_AVERAGE : COMPOUND_SEG;
         else
 #endif  // CONFIG_WEDGE && CONFIG_COMPOUND_SEGMENT
-#if CONFIG_JNT_COMP
-        {
-          if (mbmi->compound_idx) {
-            mbmi->interinter_compound_type = aom_read_symbol(
-                r, ec_ctx->compound_type_cdf[bsize], COMPOUND_TYPES, ACCT_STR);
-          }
-        }
-#else
-        mbmi->interinter_compound_type = aom_read_symbol(
-            r, ec_ctx->compound_type_cdf[bsize], COMPOUND_TYPES, ACCT_STR);
-#endif  // CONFIG_JNT_COMP
+          mbmi->interinter_compound_type = aom_read_symbol(
+              r, ec_ctx->compound_type_cdf[bsize], COMPOUND_TYPES, ACCT_STR);
 #if CONFIG_WEDGE
         if (mbmi->interinter_compound_type == COMPOUND_WEDGE) {
           assert(is_interinter_compound_used(COMPOUND_WEDGE, bsize));
@@ -2670,10 +2666,7 @@
 #endif  // CONFIG_WEDGE
 #if CONFIG_COMPOUND_SEGMENT
         if (mbmi->interinter_compound_type == COMPOUND_SEG) {
-#if CONFIG_JNT_COMP
-          if (mbmi->compound_idx)
-#endif  // CONFIG_JNT_COMP
-            mbmi->mask_type = aom_read_literal(r, MAX_SEG_MASK_BITS, ACCT_STR);
+          mbmi->mask_type = aom_read_literal(r, MAX_SEG_MASK_BITS, ACCT_STR);
         }
 #endif  // CONFIG_COMPOUND_SEGMENT
       }
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 99a166e..93b7e51 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -1770,23 +1770,19 @@
 #endif  // CONFIG_MOTION_VAR
         is_any_masked_compound_used(bsize)) {
 #if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
-      if (cm->allow_masked_compound) {
+#if CONFIG_JNT_COMP
+      if (cm->allow_masked_compound && mbmi->compound_idx)
+#else
+      if (cm->allow_masked_compound)
+#endif  // CONFIG_JNT_COMP
+      {
 #if CONFIG_WEDGE && CONFIG_COMPOUND_SEGMENT
         if (!is_interinter_compound_used(COMPOUND_WEDGE, bsize))
           aom_write_bit(w, mbmi->interinter_compound_type == COMPOUND_AVERAGE);
         else
 #endif  // CONFIG_WEDGE && CONFIG_COMPOUND_SEGMENT
-#if CONFIG_JNT_COMP
-        {
-          if (mbmi->compound_idx) {
-            aom_write_symbol(w, mbmi->interinter_compound_type,
-                             ec_ctx->compound_type_cdf[bsize], COMPOUND_TYPES);
-          }
-        }
-#else
-        aom_write_symbol(w, mbmi->interinter_compound_type,
-                         ec_ctx->compound_type_cdf[bsize], COMPOUND_TYPES);
-#endif  // CONFIG_JNT_COMP
+          aom_write_symbol(w, mbmi->interinter_compound_type,
+                           ec_ctx->compound_type_cdf[bsize], COMPOUND_TYPES);
 #if CONFIG_WEDGE
         if (is_interinter_compound_used(COMPOUND_WEDGE, bsize) &&
             mbmi->interinter_compound_type == COMPOUND_WEDGE) {
@@ -1796,10 +1792,7 @@
 #endif  // CONFIG_WEDGE
 #if CONFIG_COMPOUND_SEGMENT
         if (mbmi->interinter_compound_type == COMPOUND_SEG) {
-#if CONFIG_JNT_COMP
-          if (mbmi->compound_idx)
-#endif  // CONFIG_JNT_COMP
-            aom_write_literal(w, mbmi->mask_type, MAX_SEG_MASK_BITS);
+          aom_write_literal(w, mbmi->mask_type, MAX_SEG_MASK_BITS);
         }
 #endif  // CONFIG_COMPOUND_SEGMENT
       }