Add compound segment experiment flag

Change-Id: Id80f76ea2598daa93e693c5efe29b782abe33957
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c
index 09868dc..9aeb408 100644
--- a/av1/common/entropymode.c
+++ b/av1/common/entropymode.c
@@ -476,6 +476,17 @@
       { 25, 29, 50, 192, 64, 192, 128, 180, 180 },   // 6 = two intra neighbours
     };
 
+#if CONFIG_COMPOUND_SEGMENT
+static const aom_prob
+    default_compound_type_probs[BLOCK_SIZES][COMPOUND_TYPES - 1] = {
+      { 208, 200 }, { 208, 200 }, { 208, 200 }, { 208, 200 }, { 208, 200 },
+      { 208, 200 }, { 216, 200 }, { 216, 200 }, { 216, 200 }, { 224, 200 },
+      { 224, 200 }, { 240, 200 }, { 240, 200 },
+#if CONFIG_EXT_PARTITION
+      { 255, 200 }, { 255, 200 }, { 255, 200 },
+#endif  // CONFIG_EXT_PARTITION
+    };
+#else  // !CONFIG_COMPOUND_SEGMENT
 static const aom_prob default_compound_type_probs[BLOCK_SIZES]
                                                  [COMPOUND_TYPES - 1] = {
                                                    { 208 }, { 208 }, { 208 },
@@ -487,6 +498,7 @@
                                                    { 255 }, { 255 }, { 255 },
 #endif  // CONFIG_EXT_PARTITION
                                                  };
+#endif  // CONFIG_COMPOUND_SEGMENT
 
 static const aom_prob default_interintra_prob[BLOCK_SIZE_GROUPS] = {
   208, 208, 208, 208,
@@ -643,9 +655,15 @@
   -INTER_COMPOUND_OFFSET(NEAR_NEWMV), -INTER_COMPOUND_OFFSET(NEW_NEARMV)
 };
 
+#if CONFIG_COMPOUND_SEGMENT
+const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)] = {
+  -COMPOUND_AVERAGE, 2, -COMPOUND_WEDGE, -COMPOUND_SEG
+};
+#else  // !CONFIG_COMPOUND_SEGMENT
 const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)] = {
   -COMPOUND_AVERAGE, -COMPOUND_WEDGE
 };
+#endif  // CONFIG_COMPOUND_SEGMENT
 /* clang-format on */
 #endif  // CONFIG_EXT_INTER
 
diff --git a/av1/common/enums.h b/av1/common/enums.h
index 0b238d6..7d91bba 100644
--- a/av1/common/enums.h
+++ b/av1/common/enums.h
@@ -354,6 +354,9 @@
 typedef enum {
   COMPOUND_AVERAGE = 0,
   COMPOUND_WEDGE,
+#if CONFIG_COMPOUND_SEGMENT
+  COMPOUND_SEG,
+#endif  // CONFIG_COMPOUND_SEGMENT
   COMPOUND_TYPES,
 } COMPOUND_TYPE;
 #endif  // CONFIG_EXT_INTER
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index a701e80..70b93b9 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -4382,6 +4382,11 @@
   switch (comp_type) {
     case COMPOUND_AVERAGE: return 0;
     case COMPOUND_WEDGE: return get_interinter_wedge_bits(bsize);
+#if CONFIG_COMPOUND_SEGMENT
+    // TODO(sarahparker) this 0 is just a placeholder, it is possible this will
+    // need to change once this mode is fully implemented
+    case COMPOUND_SEG: return 0;
+#endif  // CONFIG_COMPOUND_SEGMENT
     default: assert(0); return 0;
   }
 }
@@ -7605,6 +7610,9 @@
             }
           }
           break;
+#if CONFIG_COMPOUND_SEGMENT
+        case COMPOUND_SEG: break;
+#endif  // CONFIG_COMPOUND_SEGMENT
         default: assert(0); return 0;
       }
     }
diff --git a/configure b/configure
index fd1d931..5220b2c 100755
--- a/configure
+++ b/configure
@@ -266,6 +266,7 @@
     intra_interp
     filter_intra
     ext_inter
+    compound_segment
     ext_interp
     ext_refs
     global_motion