Select TMVP MVs for wedge mode even when tip is not enabled

STATS_CHANGED

This fixes the issue that when tip ref frame is not used E139 is not applied. Also contains a few clean-ups.

Fixes #444
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c
index 8461642..b3556f1 100644
--- a/av1/common/mvref_common.c
+++ b/av1/common/mvref_common.c
@@ -310,7 +310,8 @@
 
 #if CONFIG_WEDGE_TMVP
           if (is_wedge) {
-            const int this_decision = decisions[h * 8 * bw + w * 8];
+            const int this_decision =
+                decisions[h * TMVP_MI_SIZE * bw + w * TMVP_MI_SIZE];
 
             if (this_decision == 0 && idx == 1) continue;
             if (this_decision == 1 && idx == 0) continue;
@@ -531,6 +532,21 @@
   y_inside_boundary = ROUND_POWER_OF_TWO(y_inside_boundary, 1);
   int w, h;
 
+#if CONFIG_WEDGE_TMVP
+  const uint8_t *decisions = NULL;
+  const BLOCK_SIZE bsize = mi->sb_type[xd->tree_type == CHROMA_PART];
+  const int bw = block_size_wide[bsize];
+  const bool is_wedge = is_inter_ref_frame(mi->ref_frame[0]) &&
+                        is_inter_ref_frame(mi->ref_frame[1]) &&
+                        !is_tip_ref_frame(mi->ref_frame[0]) &&
+                        !is_tip_ref_frame(mi->ref_frame[1]) &&
+                        mi->interinter_comp.type == COMPOUND_WEDGE;
+  if (is_wedge) {
+    decisions = av1_get_contiguous_soft_mask_decision(
+        mi->interinter_comp.wedge_index, mi->interinter_comp.wedge_sign, bsize);
+  }
+#endif  // CONFIG_WEDGE_TMVP
+
   for (h = 0; h < y_inside_boundary; h++) {
     MV_REF *mv = frame_mvs;
     for (w = 0; w < x_inside_boundary; w++) {
@@ -557,6 +573,15 @@
             if ((abs(mi->mv[idx].as_mv.row) > REFMVS_LIMIT) ||
                 (abs(mi->mv[idx].as_mv.col) > REFMVS_LIMIT))
               continue;
+#if CONFIG_WEDGE_TMVP
+            if (is_wedge) {
+              const int this_decision =
+                  decisions[h * TMVP_MI_SIZE * bw + w * TMVP_MI_SIZE];
+
+              if (this_decision == 0 && idx == 1) continue;
+              if (this_decision == 1 && idx == 0) continue;
+            }
+#endif  // CONFIG_WEDGE_TMVP
             mv->ref_frame[0] = ref_frame;
             mv->mv[0].as_int = mi->mv[idx].as_int;
           }