Remove UNPOISON_PARTITION_CTX experiment

This experiment has been abandonned for AV1.

Change-Id: I07be0876b21ee20a1eb2490bb98e4f84978ff001
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c
index f079711..a50a20f 100644
--- a/av1/common/entropymode.c
+++ b/av1/common/entropymode.c
@@ -621,22 +621,6 @@
       { 58, 32, 12, 128, 128, 128, 255, 128, 255 },   // l split, a not split
       { 10, 7, 6, 128, 128, 128, 255, 128, 255 },     // a/l both split
 #endif                                                // CONFIG_EXT_PARTITION
-#if CONFIG_UNPOISON_PARTITION_CTX
-      { 0, 0, 141, 0, 0, 0, 0, 0, 0 },  // 8x8 -> 4x4
-      { 0, 0, 87, 0, 0, 0, 0, 0, 0 },   // 16x16 -> 8x8
-      { 0, 0, 59, 0, 0, 0, 0, 0, 0 },   // 32x32 -> 16x16
-      { 0, 0, 30, 0, 0, 0, 0, 0, 0 },   // 64x64 -> 32x32
-#if CONFIG_EXT_PARTITION
-      { 0, 0, 30, 0, 0, 0, 0, 0, 0 },   // 128x128 -> 64x64
-#endif                                  // CONFIG_EXT_PARTITION
-      { 0, 122, 0, 0, 0, 0, 0, 0, 0 },  // 8x8 -> 4x4
-      { 0, 73, 0, 0, 0, 0, 0, 0, 0 },   // 16x16 -> 8x8
-      { 0, 58, 0, 0, 0, 0, 0, 0, 0 },   // 32x32 -> 16x16
-      { 0, 34, 0, 0, 0, 0, 0, 0, 0 },   // 64x64 -> 32x32
-#if CONFIG_EXT_PARTITION
-      { 0, 34, 0, 0, 0, 0, 0, 0, 0 },  // 128x128 -> 64x64
-#endif                                 // CONFIG_EXT_PARTITION
-#endif                                 // CONFIG_UNPOISON_PARTITION_CTX
     };
 #else
 static const aom_prob
@@ -668,22 +652,6 @@
       { 58, 32, 12 },   // l split, a not split
       { 10, 7, 6 },     // a/l both split
 #endif  // CONFIG_EXT_PARTITION
-#if CONFIG_UNPOISON_PARTITION_CTX
-      { 0, 0, 141 },    // 8x8 -> 4x4
-      { 0, 0, 87 },     // 16x16 -> 8x8
-      { 0, 0, 59 },     // 32x32 -> 16x16
-      { 0, 0, 30 },     // 64x64 -> 32x32
-#if CONFIG_EXT_PARTITION
-      { 0, 0, 30 },     // 128x128 -> 64x64
-#endif  // CONFIG_EXT_PARTITION
-      { 0, 122, 0 },    // 8x8 -> 4x4
-      { 0, 73, 0 },     // 16x16 -> 8x8
-      { 0, 58, 0 },     // 32x32 -> 16x16
-      { 0, 34, 0 },     // 64x64 -> 32x32
-#if CONFIG_EXT_PARTITION
-      { 0, 34, 0 },     // 128x128 -> 64x64
-#endif  // CONFIG_EXT_PARTITION
-#endif  // CONFIG_UNPOISON_PARTITION_CTX
     };
 #endif  // CONFIG_EXT_PARTITION_TYPES
 
@@ -3468,30 +3436,6 @@
                          counts->partition[i], fc->partition_prob[i]);
   }
 #endif  // CONFIG_EXT_PARTITION_TYPES
-#if CONFIG_UNPOISON_PARTITION_CTX
-  for (i = PARTITION_CONTEXTS_PRIMARY;
-       i < PARTITION_CONTEXTS_PRIMARY + PARTITION_BLOCK_SIZES; ++i) {
-    unsigned int ct[2] = { counts->partition[i][PARTITION_VERT],
-                           counts->partition[i][PARTITION_SPLIT] };
-    assert(counts->partition[i][PARTITION_NONE] == 0);
-    assert(counts->partition[i][PARTITION_HORZ] == 0);
-    assert(fc->partition_prob[i][PARTITION_NONE] == 0);
-    assert(fc->partition_prob[i][PARTITION_HORZ] == 0);
-    fc->partition_prob[i][PARTITION_VERT] =
-        av1_mode_mv_merge_probs(pre_fc->partition_prob[i][PARTITION_VERT], ct);
-  }
-  for (i = PARTITION_CONTEXTS_PRIMARY + PARTITION_BLOCK_SIZES;
-       i < PARTITION_CONTEXTS_PRIMARY + 2 * PARTITION_BLOCK_SIZES; ++i) {
-    unsigned int ct[2] = { counts->partition[i][PARTITION_HORZ],
-                           counts->partition[i][PARTITION_SPLIT] };
-    assert(counts->partition[i][PARTITION_NONE] == 0);
-    assert(counts->partition[i][PARTITION_VERT] == 0);
-    assert(fc->partition_prob[i][PARTITION_NONE] == 0);
-    assert(fc->partition_prob[i][PARTITION_VERT] == 0);
-    fc->partition_prob[i][PARTITION_HORZ] =
-        av1_mode_mv_merge_probs(pre_fc->partition_prob[i][PARTITION_HORZ], ct);
-  }
-#endif
   for (i = 0; i < DELTA_Q_PROBS; ++i)
     fc->delta_q_prob[i] =
         mode_mv_merge_probs(pre_fc->delta_q_prob[i], counts->delta_q[i]);
diff --git a/av1/common/enums.h b/av1/common/enums.h
index 71083e9..8b6d615 100644
--- a/av1/common/enums.h
+++ b/av1/common/enums.h
@@ -196,13 +196,7 @@
 #define PARTITION_PLOFFSET 4  // number of probability models per block size
 #define PARTITION_BLOCK_SIZES (4 + CONFIG_EXT_PARTITION)
 #define PARTITION_CONTEXTS_PRIMARY (PARTITION_BLOCK_SIZES * PARTITION_PLOFFSET)
-#if CONFIG_UNPOISON_PARTITION_CTX
-#define INVALID_PARTITION_CTX (-1)
-#define PARTITION_CONTEXTS \
-  (PARTITION_CONTEXTS_PRIMARY + 2 * PARTITION_BLOCK_SIZES)
-#else
 #define PARTITION_CONTEXTS PARTITION_CONTEXTS_PRIMARY
-#endif
 
 // block transform size
 #if defined(_MSC_VER)
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index 761db5b..f25758a 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -1073,11 +1073,7 @@
 #endif  // CONFIG_EXT_PARTITION_TYPES
 
 static INLINE int partition_plane_context(const MACROBLOCKD *xd, int mi_row,
-                                          int mi_col,
-#if CONFIG_UNPOISON_PARTITION_CTX
-                                          int has_rows, int has_cols,
-#endif
-                                          BLOCK_SIZE bsize) {
+                                          int mi_col, BLOCK_SIZE bsize) {
   const PARTITION_CONTEXT *above_ctx = xd->above_seg_context + mi_col;
   const PARTITION_CONTEXT *left_ctx =
       xd->left_seg_context + (mi_row & MAX_MIB_MASK);
@@ -1088,18 +1084,7 @@
   assert(b_width_log2_lookup[bsize] == b_height_log2_lookup[bsize]);
   assert(bsl >= 0);
 
-#if CONFIG_UNPOISON_PARTITION_CTX
-  if (has_rows && has_cols)
-    return (left * 2 + above) + bsl * PARTITION_PLOFFSET;
-  else if (has_rows && !has_cols)
-    return PARTITION_CONTEXTS_PRIMARY + bsl;
-  else if (!has_rows && has_cols)
-    return PARTITION_CONTEXTS_PRIMARY + PARTITION_BLOCK_SIZES + bsl;
-  else
-    return INVALID_PARTITION_CTX;  // Bogus context, forced SPLIT
-#else
   return (left * 2 + above) + bsl * PARTITION_PLOFFSET;
-#endif
 }
 
 static INLINE int max_block_wide(const MACROBLOCKD *xd, BLOCK_SIZE bsize,
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index fc6852d..2edf667 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -756,12 +756,7 @@
                                      int mi_row, int mi_col, aom_reader *r,
                                      int has_rows, int has_cols,
                                      BLOCK_SIZE bsize) {
-#if CONFIG_UNPOISON_PARTITION_CTX
-  const int ctx =
-      partition_plane_context(xd, mi_row, mi_col, has_rows, has_cols, bsize);
-#else
   const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize);
-#endif
   PARTITION_TYPE p;
   FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
   (void)cm;
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 58f9422..ada55a6 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -2232,11 +2232,7 @@
   const int has_cols = (mi_col + hbs) < cm->mi_cols;
   const int is_partition_point = bsize >= BLOCK_8X8;
   const int ctx = is_partition_point
-                      ? partition_plane_context(xd, mi_row, mi_col,
-#if CONFIG_UNPOISON_PARTITION_CTX
-                                                has_rows, has_cols,
-#endif
-                                                bsize)
+                      ? partition_plane_context(xd, mi_row, mi_col, bsize)
                       : 0;
   FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
   (void)cm;
diff --git a/av1/encoder/block.h b/av1/encoder/block.h
index cc640a4..b0d13d2 100644
--- a/av1/encoder/block.h
+++ b/av1/encoder/block.h
@@ -235,11 +235,9 @@
 #endif
   int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS];
 #if CONFIG_EXT_PARTITION_TYPES
-  int partition_cost[PARTITION_CONTEXTS + CONFIG_UNPOISON_PARTITION_CTX]
-                    [EXT_PARTITION_TYPES];
+  int partition_cost[PARTITION_CONTEXTS][EXT_PARTITION_TYPES];
 #else
-  int partition_cost[PARTITION_CONTEXTS + CONFIG_UNPOISON_PARTITION_CTX]
-                    [PARTITION_TYPES];
+  int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES];
 #endif  // CONFIG_EXT_PARTITION_TYPES
 #if CONFIG_MRC_TX
   int mrc_mask_inter_cost[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS]
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 51c4371..399fa85 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -1520,12 +1520,7 @@
 #endif
   const int is_partition_root = bsize >= BLOCK_8X8;
   const int ctx = is_partition_root
-                      ? partition_plane_context(xd, mi_row, mi_col,
-#if CONFIG_UNPOISON_PARTITION_CTX
-                                                mi_row + hbs < cm->mi_rows,
-                                                mi_col + hbs < cm->mi_cols,
-#endif
-                                                bsize)
+                      ? partition_plane_context(xd, mi_row, mi_col, bsize)
                       : -1;
   const PARTITION_TYPE partition = pc_tree->partitioning;
   const BLOCK_SIZE subsize = get_subsize(bsize, partition);
@@ -1783,12 +1778,7 @@
   const int hbs = bs / 2;
   int i;
   const int pl = (bsize >= BLOCK_8X8)
-                     ? partition_plane_context(xd, mi_row, mi_col,
-#if CONFIG_UNPOISON_PARTITION_CTX
-                                               mi_row + hbs < cm->mi_rows,
-                                               mi_col + hbs < cm->mi_cols,
-#endif
-                                               bsize)
+                     ? partition_plane_context(xd, mi_row, mi_col, bsize)
                      : 0;
   const PARTITION_TYPE partition =
       (bsize >= BLOCK_8X8) ? get_partition(cm, mi_row, mi_col, bsize)
@@ -2436,12 +2426,6 @@
   MACROBLOCK *const x = &td->mb;
   MACROBLOCKD *const xd = &x->e_mbd;
   RD_STATS sum_rdc, this_rdc;
-#if CONFIG_UNPOISON_PARTITION_CTX
-  const AV1_COMMON *const cm = &cpi->common;
-  const int hbs = mi_size_wide[bsize] / 2;
-  const int has_rows = mi_row + hbs < cm->mi_rows;
-  const int has_cols = mi_col + hbs < cm->mi_cols;
-#endif  // CONFIG_UNPOISON_PARTITION_CTX
 #if CONFIG_EXT_PARTITION_TYPES_AB
   const AV1_COMMON *const cm = &cpi->common;
 #endif
@@ -2475,11 +2459,7 @@
 
   if (sum_rdc.rdcost >= best_rdc->rdcost) return;
 
-  int pl = partition_plane_context(xd, mi_row, mi_col,
-#if CONFIG_UNPOISON_PARTITION_CTX
-                                   has_rows, has_cols,
-#endif
-                                   bsize);
+  int pl = partition_plane_context(xd, mi_row, mi_col, bsize);
   sum_rdc.rate += x->partition_cost[pl][partition];
   sum_rdc.rdcost = RDCOST(x->rdmult, sum_rdc.rate, sum_rdc.dist);
 
@@ -2551,23 +2531,13 @@
   RD_SEARCH_MACROBLOCK_CONTEXT x_ctx;
   const TOKENEXTRA *const tp_orig = *tp;
   PICK_MODE_CONTEXT *ctx_none = &pc_tree->none;
-#if CONFIG_UNPOISON_PARTITION_CTX
-  const int hbs = mi_size_wide[bsize] / 2;
-  const int has_rows = mi_row + hbs < cm->mi_rows;
-  const int has_cols = mi_col + hbs < cm->mi_cols;
-#else
   int tmp_partition_cost[PARTITION_TYPES];
-#endif
   BLOCK_SIZE subsize;
   RD_STATS this_rdc, sum_rdc, best_rdc;
   const int bsize_at_least_8x8 = (bsize >= BLOCK_8X8);
   int do_square_split = bsize_at_least_8x8;
   const int pl = bsize_at_least_8x8
-                     ? partition_plane_context(xd, mi_row, mi_col,
-#if CONFIG_UNPOISON_PARTITION_CTX
-                                               has_rows, has_cols,
-#endif
-                                               bsize)
+                     ? partition_plane_context(xd, mi_row, mi_col, bsize)
                      : 0;
   const int *partition_cost =
       pl >= 0 ? x->partition_cost[pl] : x->partition_cost[0];
@@ -2606,7 +2576,6 @@
 
   (void)*tp_orig;
 
-#if !CONFIG_UNPOISON_PARTITION_CTX
   if (force_horz_split || force_vert_split) {
     tmp_partition_cost[PARTITION_NONE] = INT_MAX;
 
@@ -2630,7 +2599,6 @@
 
     partition_cost = tmp_partition_cost;
   }
-#endif
 
 #ifndef NDEBUG
   // Nothing should rely on the default value of this array (which is just
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index 1ef57f6..c001277 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -91,28 +91,6 @@
     for (i = 0; i < PARTITION_CONTEXTS_PRIMARY; ++i)
       av1_cost_tokens_from_cdf(x->partition_cost[i], fc->partition_cdf[i],
                                NULL);
-#if CONFIG_UNPOISON_PARTITION_CTX
-    for (; i < PARTITION_CONTEXTS_PRIMARY + PARTITION_BLOCK_SIZES; ++i) {
-      aom_prob p = fc->partition_prob[i][PARTITION_VERT];
-      assert(p > 0);
-      x->partition_cost[i][PARTITION_NONE] = INT_MAX;
-      x->partition_cost[i][PARTITION_HORZ] = INT_MAX;
-      x->partition_cost[i][PARTITION_VERT] = av1_cost_bit(p, 0);
-      x->partition_cost[i][PARTITION_SPLIT] = av1_cost_bit(p, 1);
-    }
-    for (; i < PARTITION_CONTEXTS_PRIMARY + 2 * PARTITION_BLOCK_SIZES; ++i) {
-      aom_prob p = fc->partition_prob[i][PARTITION_HORZ];
-      assert(p > 0);
-      x->partition_cost[i][PARTITION_NONE] = INT_MAX;
-      x->partition_cost[i][PARTITION_HORZ] = av1_cost_bit(p, 0);
-      x->partition_cost[i][PARTITION_VERT] = INT_MAX;
-      x->partition_cost[i][PARTITION_SPLIT] = av1_cost_bit(p, 1);
-    }
-    x->partition_cost[PARTITION_CONTEXTS][PARTITION_NONE] = INT_MAX;
-    x->partition_cost[PARTITION_CONTEXTS][PARTITION_HORZ] = INT_MAX;
-    x->partition_cost[PARTITION_CONTEXTS][PARTITION_VERT] = INT_MAX;
-    x->partition_cost[PARTITION_CONTEXTS][PARTITION_SPLIT] = 0;
-#endif  // CONFIG_UNPOISON_PARTITION_CTX
   }
 
   for (i = 0; i < SKIP_CONTEXTS; ++i) {
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake
index c254eb1..ecaf14d 100644
--- a/build/cmake/aom_config_defaults.cmake
+++ b/build/cmake/aom_config_defaults.cmake
@@ -195,6 +195,5 @@
 set(CONFIG_TX64X64 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_TXK_SEL 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_TXMG 1 CACHE NUMBER "AV1 experiment flag.")
-set(CONFIG_UNPOISON_PARTITION_CTX 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_VAR_TX_NO_TX_MODE 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_XIPHRC 0 CACHE NUMBER "AV1 experiment flag.")
diff --git a/configure b/configure
index 9c539b4..398c8a9 100755
--- a/configure
+++ b/configure
@@ -267,7 +267,6 @@
     ext_partition
     ext_partition_types
     ext_partition_types_ab
-    unpoison_partition_ctx
     ext_tile
     ncobmc
     q_adapt_probs