Further clean-ups on dist-wtd compound

Includes removal of enum values.

Change-Id: Ib581c6b114237ce269ffdce3d151ff9cbd0b188d
diff --git a/av1/common/enums.h b/av1/common/enums.h
index 77d2b6a..7a807ee 100644
--- a/av1/common/enums.h
+++ b/av1/common/enums.h
@@ -467,7 +467,9 @@
 
 enum {
   COMPOUND_AVERAGE,
+#if !CONFIG_REMOVE_DIST_WTD_COMP
   COMPOUND_DISTWTD,
+#endif  // !CONFIG_REMOVE_DIST_WTD_COMP
   COMPOUND_WEDGE,
   COMPOUND_DIFFWTD,
   COMPOUND_TYPES,
diff --git a/av1/common/reconinter.h b/av1/common/reconinter.h
index ff44158..ae48a46 100644
--- a/av1/common/reconinter.h
+++ b/av1/common/reconinter.h
@@ -202,7 +202,9 @@
   const int comp_allowed = is_comp_ref_allowed(sb_type);
   switch (type) {
     case COMPOUND_AVERAGE:
+#if !CONFIG_REMOVE_DIST_WTD_COMP
     case COMPOUND_DISTWTD:
+#endif  // !CONFIG_REMOVE_DIST_WTD_COMP
     case COMPOUND_DIFFWTD: return comp_allowed;
     case COMPOUND_WEDGE:
       return comp_allowed && av1_wedge_params_lookup[sb_type].wedge_types > 0;
diff --git a/av1/encoder/compound_type.c b/av1/encoder/compound_type.c
index e083e99..cf659de 100644
--- a/av1/encoder/compound_type.c
+++ b/av1/encoder/compound_type.c
@@ -49,7 +49,7 @@
   }
 
   // Store the stats for COMPOUND_AVERAGE and COMPOUND_DISTWTD
-  for (int comp_type = COMPOUND_AVERAGE; comp_type <= COMPOUND_DISTWTD;
+  for (int comp_type = COMPOUND_AVERAGE; comp_type < COMPOUND_WEDGE;
        comp_type++) {
     comp_rate[comp_type] = st->rate[comp_type];
     comp_dist[comp_type] = st->dist[comp_type];
@@ -859,16 +859,19 @@
       ((mode_search_mask & (1 << COMPOUND_DISTWTD)) &&
        cm->seq_params.order_hint_info.enable_dist_wtd_comp == 1 &&
        cpi->sf.inter_sf.use_dist_wtd_comp_flag != DIST_WTD_COMP_DISABLED);
-#else
-  const int try_distwtd_comp = 0;
-#endif  // !CONFIG_REMOVE_DIST_WTD_COMP
   *try_average_and_distwtd_comp = try_average_comp && try_distwtd_comp;
+#else
+  *try_average_and_distwtd_comp = 0;
+#endif  // !CONFIG_REMOVE_DIST_WTD_COMP
 
   // Check if COMPOUND_AVERAGE and COMPOUND_DISTWTD are valid cases
-  for (comp_type = COMPOUND_AVERAGE; comp_type <= COMPOUND_DISTWTD;
-       comp_type++) {
+  for (comp_type = COMPOUND_AVERAGE; comp_type < COMPOUND_WEDGE; comp_type++) {
     valid_check =
+#if !CONFIG_REMOVE_DIST_WTD_COMP
         (comp_type == COMPOUND_AVERAGE) ? try_average_comp : try_distwtd_comp;
+#else
+        (comp_type == COMPOUND_AVERAGE) ? try_average_comp : 0;
+#endif  // !CONFIG_REMOVE_DIST_WTD_COMP
     if (!*try_average_and_distwtd_comp && valid_check &&
         is_interinter_compound_used(comp_type, bsize))
       valid_comp_types[valid_type_count++] = comp_type;
@@ -907,7 +910,9 @@
     // Compound group index of wedge and diffwtd is 1
     masked_type_cost[COMPOUND_AVERAGE] +=
         mode_costs->comp_group_idx_cost[comp_group_idx_ctx][0];
+#if !CONFIG_REMOVE_DIST_WTD_COMP
     masked_type_cost[COMPOUND_DISTWTD] += masked_type_cost[COMPOUND_AVERAGE];
+#endif  // !CONFIG_REMOVE_DIST_WTD_COMP
     masked_type_cost[COMPOUND_WEDGE] +=
         mode_costs->comp_group_idx_cost[comp_group_idx_ctx][1];
     masked_type_cost[COMPOUND_DIFFWTD] += masked_type_cost[COMPOUND_WEDGE];
@@ -930,7 +935,11 @@
                                                  COMPOUND_TYPE cur_type) {
   mbmi->interinter_comp.type = cur_type;
   mbmi->comp_group_idx = (cur_type >= COMPOUND_WEDGE);
+#if !CONFIG_REMOVE_DIST_WTD_COMP
   mbmi->compound_idx = (cur_type != COMPOUND_DISTWTD);
+#else
+  mbmi->compound_idx = 1;
+#endif  // !CONFIG_REMOVE_DIST_WTD_COMP
 }
 
 // When match is found, populate the compound type data
@@ -985,6 +994,7 @@
   }
 }
 
+#if !CONFIG_REMOVE_DIST_WTD_COMP
 // Choose the better of the two COMPOUND_AVERAGE,
 // COMPOUND_DISTWTD based on modeled cost
 static int find_best_avg_distwtd_comp_type(MACROBLOCK *x, int *comp_model_rate,
@@ -1003,6 +1013,7 @@
   *best_rd = est_rd[best_type];
   return best_type;
 }
+#endif  // !CONFIG_REMOVE_DIST_WTD_COMP
 
 static INLINE void save_comp_rd_search_stat(
     MACROBLOCK *x, const MB_MODE_INFO *const mbmi, const int32_t *comp_rate,
@@ -1295,6 +1306,7 @@
   int masked_type_cost[COMPOUND_TYPES];
 
   int calc_pred_masked_compound = 1;
+#if !CONFIG_REMOVE_DIST_WTD_COMP
   int64_t comp_dist[COMPOUND_TYPES] = { INT64_MAX, INT64_MAX, INT64_MAX,
                                         INT64_MAX };
   int32_t comp_rate[COMPOUND_TYPES] = { INT_MAX, INT_MAX, INT_MAX, INT_MAX };
@@ -1303,6 +1315,13 @@
                                               INT_MAX };
   int64_t comp_model_dist[COMPOUND_TYPES] = { INT64_MAX, INT64_MAX, INT64_MAX,
                                               INT64_MAX };
+#else
+  int64_t comp_dist[COMPOUND_TYPES] = { INT64_MAX, INT64_MAX, INT64_MAX };
+  int32_t comp_rate[COMPOUND_TYPES] = { INT_MAX, INT_MAX, INT_MAX };
+  int comp_rs2[COMPOUND_TYPES] = { INT_MAX, INT_MAX, INT_MAX };
+  int32_t comp_model_rate[COMPOUND_TYPES] = { INT_MAX, INT_MAX, INT_MAX };
+  int64_t comp_model_dist[COMPOUND_TYPES] = { INT64_MAX, INT64_MAX, INT64_MAX };
+#endif  // !CONFIG_REMOVE_DIST_WTD_COMP
   int match_index = 0;
   const int match_found =
       find_comp_rd_in_stats(cpi, x, mbmi, comp_rate, comp_dist, comp_model_rate,
@@ -1316,7 +1335,16 @@
   // Local array to store the valid compound types to be evaluated in the core
   // loop
   COMPOUND_TYPE valid_comp_types[COMPOUND_TYPES] = {
-    COMPOUND_AVERAGE, COMPOUND_DISTWTD, COMPOUND_WEDGE, COMPOUND_DIFFWTD
+#if !CONFIG_REMOVE_DIST_WTD_COMP
+    COMPOUND_AVERAGE,
+    COMPOUND_DISTWTD,
+    COMPOUND_WEDGE,
+    COMPOUND_DIFFWTD
+#else
+    COMPOUND_AVERAGE,
+    COMPOUND_WEDGE,
+    COMPOUND_DIFFWTD
+#endif  // !CONFIG_REMOVE_DIST_WTD_COMP
   };
   int valid_type_count = 0;
   int try_average_and_distwtd_comp = 0;
@@ -1353,6 +1381,7 @@
                                          comp_rate, comp_dist, comp_rs2,
                                          rate_mv, rd, match_index);
   }
+#if !CONFIG_REMOVE_DIST_WTD_COMP
   // Special handling if both compound_average and compound_distwtd
   // are to be searched. In this case, first estimate between the two
   // modes and then call estimate_yrd_for_sb() only for the better of
@@ -1445,6 +1474,7 @@
       }
     }
   }
+#endif  // !CONFIG_REMOVE_DIST_WTD_COMP
 
   // If COMPOUND_AVERAGE is not valid, use the spare buffer
   if (valid_comp_types[0] != COMPOUND_AVERAGE) restore_dst_buf(xd, *tmp_dst, 1);
@@ -1559,8 +1589,12 @@
   if (mbmi->interinter_comp.type != best_type_stats.best_compound_data.type) {
     mbmi->comp_group_idx =
         (best_type_stats.best_compound_data.type < COMPOUND_WEDGE) ? 0 : 1;
+#if !CONFIG_REMOVE_DIST_WTD_COMP
     mbmi->compound_idx =
         !(best_type_stats.best_compound_data.type == COMPOUND_DISTWTD);
+#else
+    mbmi->compound_idx = 1;
+#endif  // !CONFIG_REMOVE_DIST_WTD_COMP
     mbmi->interinter_comp = best_type_stats.best_compound_data;
     memcpy(xd->seg_mask, buffers->tmp_best_mask_buf, mask_len);
   }
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index ebe8a44..7a5c1e8 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -2394,7 +2394,10 @@
   const AV1_COMMON *cm = &cpi->common;
   const int masked_compound_used = is_any_masked_compound_used(bsize) &&
                                    cm->seq_params.enable_masked_compound;
-  int mode_search_mask = (1 << COMPOUND_AVERAGE) | (1 << COMPOUND_DISTWTD) |
+  int mode_search_mask = (1 << COMPOUND_AVERAGE) |
+#if !CONFIG_REMOVE_DIST_WTD_COMP
+                         (1 << COMPOUND_DISTWTD) |
+#endif  // !CONFIG_REMOVE_DIST_WTD_COMP
                          (1 << COMPOUND_WEDGE) | (1 << COMPOUND_DIFFWTD);
 
   const int num_planes = av1_num_planes(cm);