Remove COEF_INTERLEAVE experiment

This experiment has been abandonned.

Change-Id: Ifde0a76266af9f8c202c01805410b72d64594b0b
diff --git a/av1/common/blockd.c b/av1/common/blockd.c
index 45a560e..c788311 100644
--- a/av1/common/blockd.c
+++ b/av1/common/blockd.c
@@ -40,86 +40,6 @@
   }
 }
 
-#if CONFIG_COEF_INTERLEAVE
-void av1_foreach_transformed_block_interleave(
-    const MACROBLOCKD *const xd, BLOCK_SIZE bsize,
-    foreach_transformed_block_visitor visit, void *arg) {
-  const struct macroblockd_plane *const pd_y = &xd->plane[0];
-  const struct macroblockd_plane *const pd_c = &xd->plane[1];
-  const MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
-
-  const TX_SIZE tx_log2_y = mbmi->tx_size;
-  const TX_SIZE tx_log2_c = av1_get_uv_tx_size(mbmi, pd_c);
-  const int tx_sz_y = (1 << tx_log2_y);
-  const int tx_sz_c = (1 << tx_log2_c);
-
-  const BLOCK_SIZE plane_bsize_y = get_plane_block_size(bsize, pd_y);
-  const BLOCK_SIZE plane_bsize_c = get_plane_block_size(bsize, pd_c);
-
-  const int num_4x4_w_y = num_4x4_blocks_wide_lookup[plane_bsize_y];
-  const int num_4x4_w_c = num_4x4_blocks_wide_lookup[plane_bsize_c];
-  const int num_4x4_h_y = num_4x4_blocks_high_lookup[plane_bsize_y];
-  const int num_4x4_h_c = num_4x4_blocks_high_lookup[plane_bsize_c];
-
-  const int step_y = 1 << (tx_log2_y << 1);
-  const int step_c = 1 << (tx_log2_c << 1);
-
-  const int max_4x4_w_y =
-      get_max_4x4_size(num_4x4_w_y, xd->mb_to_right_edge, pd_y->subsampling_x);
-  const int max_4x4_h_y =
-      get_max_4x4_size(num_4x4_h_y, xd->mb_to_bottom_edge, pd_y->subsampling_y);
-
-  const int extra_step_y = ((num_4x4_w_y - max_4x4_w_y) >> tx_log2_y) * step_y;
-
-  const int max_4x4_w_c =
-      get_max_4x4_size(num_4x4_w_c, xd->mb_to_right_edge, pd_c->subsampling_x);
-  const int max_4x4_h_c =
-      get_max_4x4_size(num_4x4_h_c, xd->mb_to_bottom_edge, pd_c->subsampling_y);
-
-  const int extra_step_c = ((num_4x4_w_c - max_4x4_w_c) >> tx_log2_c) * step_c;
-
-  // The max_4x4_w/h may be smaller than tx_sz under some corner cases,
-  // i.e. when the SB is splitted by tile boundaries.
-  const int tu_num_w_y = (max_4x4_w_y + tx_sz_y - 1) / tx_sz_y;
-  const int tu_num_h_y = (max_4x4_h_y + tx_sz_y - 1) / tx_sz_y;
-  const int tu_num_w_c = (max_4x4_w_c + tx_sz_c - 1) / tx_sz_c;
-  const int tu_num_h_c = (max_4x4_h_c + tx_sz_c - 1) / tx_sz_c;
-  const int tu_num_c = tu_num_w_c * tu_num_h_c;
-
-  int tu_idx_c = 0;
-  int offset_y, row_y, col_y;
-  int offset_c, row_c, col_c;
-
-  for (row_y = 0; row_y < tu_num_h_y; row_y++) {
-    for (col_y = 0; col_y < tu_num_w_y; col_y++) {
-      // luma
-      offset_y = (row_y * tu_num_w_y + col_y) * step_y + row_y * extra_step_y;
-      visit(0, offset_y, row_y * tx_sz_y, col_y * tx_sz_y, plane_bsize_y,
-            tx_log2_y, arg);
-      // chroma
-      if (tu_idx_c < tu_num_c) {
-        row_c = (tu_idx_c / tu_num_w_c) * tx_sz_c;
-        col_c = (tu_idx_c % tu_num_w_c) * tx_sz_c;
-        offset_c = tu_idx_c * step_c + (tu_idx_c / tu_num_w_c) * extra_step_c;
-        visit(1, offset_c, row_c, col_c, plane_bsize_c, tx_log2_c, arg);
-        visit(2, offset_c, row_c, col_c, plane_bsize_c, tx_log2_c, arg);
-        tu_idx_c++;
-      }
-    }
-  }
-
-  // In 422 case, it's possible that Chroma has more TUs than Luma
-  while (tu_idx_c < tu_num_c) {
-    row_c = (tu_idx_c / tu_num_w_c) * tx_sz_c;
-    col_c = (tu_idx_c % tu_num_w_c) * tx_sz_c;
-    offset_c = tu_idx_c * step_c + row_c * extra_step_c;
-    visit(1, offset_c, row_c, col_c, plane_bsize_c, tx_log2_c, arg);
-    visit(2, offset_c, row_c, col_c, plane_bsize_c, tx_log2_c, arg);
-    tu_idx_c++;
-  }
-}
-#endif
-
 void av1_foreach_transformed_block_in_plane(
     const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
     foreach_transformed_block_visitor visit, void *arg) {
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 4ae3a9e..c998d3d 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -1279,17 +1279,6 @@
                                    void *arg);
 #endif
 
-#if CONFIG_COEF_INTERLEAVE
-static INLINE int get_max_4x4_size(int num_4x4, int mb_to_edge,
-                                   int subsampling) {
-  return num_4x4 + (mb_to_edge >= 0 ? 0 : mb_to_edge >> (5 + subsampling));
-}
-
-void av1_foreach_transformed_block_interleave(
-    const MACROBLOCKD *const xd, BLOCK_SIZE bsize,
-    foreach_transformed_block_visitor visit, void *arg);
-#endif
-
 void av1_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
                       int plane, TX_SIZE tx_size, int has_eob, int aoff,
                       int loff);
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 4ccb983..a08856b 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -307,7 +307,6 @@
 #endif  // CONFIG_CFL
 }
 
-#if !CONFIG_COEF_INTERLEAVE
 static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd,
                                   aom_reader *r, MB_MODE_INFO *const mbmi,
                                   int plane, BLOCK_SIZE plane_bsize,
@@ -392,49 +391,6 @@
     }
   }
 }
-#endif
-
-#if CONFIG_COEF_INTERLEAVE
-static int reconstruct_inter_block(AV1_COMMON *cm, MACROBLOCKD *const xd,
-                                   aom_reader *const r, int segment_id,
-                                   int plane, int row, int col,
-                                   TX_SIZE tx_size) {
-  PLANE_TYPE plane_type = get_plane_type(plane);
-  int block_idx = get_block_idx(xd, plane, row, col);
-  struct macroblockd_plane *const pd = &xd->plane[plane];
-
-#if CONFIG_LV_MAP
-  (void)segment_id;
-  int16_t max_scan_line = 0;
-  int eob;
-  av1_read_coeffs_txb_facade(cm, xd, r, row, col, block_idx, plane, pd->dqcoeff,
-                             tx_size, &max_scan_line, &eob);
-  // tx_type will be read out in av1_read_coeffs_txb_facade
-  const TX_TYPE tx_type =
-      av1_get_tx_type(plane_type, xd, row, col, block_idx, tx_size);
-#else   // CONFIG_LV_MAP
-  int16_t max_scan_line = 0;
-  const TX_TYPE tx_type =
-      av1_get_tx_type(plane_type, xd, row, col, block_idx, tx_size);
-  const SCAN_ORDER *scan_order =
-      get_scan(cm, tx_size, tx_type, &xd->mi[0]->mbmi);
-  const int eob =
-      av1_decode_block_tokens(cm, xd, plane, scan_order, col, row, tx_size,
-                              tx_type, &max_scan_line, r, segment_id);
-#endif  // CONFIG_LV_MAP
-  uint8_t *dst =
-      &pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
-  if (eob)
-    inverse_transform_block(xd, plane,
-#if CONFIG_LGT_FROM_PRED
-                            xd->mi[0]->mbmi.mode,
-#endif
-                            tx_type, tx_size, dst, pd->dst.stride,
-                            max_scan_line, eob);
-
-  return eob;
-}
-#endif  // CONFIG_COEF_INTERLEAVE
 
 static void set_offsets(AV1_COMMON *const cm, MACROBLOCKD *const xd,
                         BLOCK_SIZE bsize, int mi_row, int mi_col, int bw,
@@ -641,121 +597,6 @@
   }
   if (mbmi->skip) av1_reset_skip_context(xd, mi_row, mi_col, bsize);
 
-#if CONFIG_COEF_INTERLEAVE
-  {
-    const struct macroblockd_plane *const pd_y = &xd->plane[0];
-    const struct macroblockd_plane *const pd_c = &xd->plane[1];
-    const TX_SIZE tx_log2_y = mbmi->tx_size;
-    const TX_SIZE tx_log2_c = av1_get_uv_tx_size(mbmi, pd_c);
-    const int tx_sz_y = (1 << tx_log2_y);
-    const int tx_sz_c = (1 << tx_log2_c);
-    const int num_4x4_w_y = pd_y->n4_w;
-    const int num_4x4_h_y = pd_y->n4_h;
-    const int num_4x4_w_c = pd_c->n4_w;
-    const int num_4x4_h_c = pd_c->n4_h;
-    const int max_4x4_w_y = get_max_4x4_size(num_4x4_w_y, xd->mb_to_right_edge,
-                                             pd_y->subsampling_x);
-    const int max_4x4_h_y = get_max_4x4_size(num_4x4_h_y, xd->mb_to_bottom_edge,
-                                             pd_y->subsampling_y);
-    const int max_4x4_w_c = get_max_4x4_size(num_4x4_w_c, xd->mb_to_right_edge,
-                                             pd_c->subsampling_x);
-    const int max_4x4_h_c = get_max_4x4_size(num_4x4_h_c, xd->mb_to_bottom_edge,
-                                             pd_c->subsampling_y);
-
-    // The max_4x4_w/h may be smaller than tx_sz under some corner cases,
-    // i.e. when the SB is splitted by tile boundaries.
-    const int tu_num_w_y = (max_4x4_w_y + tx_sz_y - 1) / tx_sz_y;
-    const int tu_num_h_y = (max_4x4_h_y + tx_sz_y - 1) / tx_sz_y;
-    const int tu_num_w_c = (max_4x4_w_c + tx_sz_c - 1) / tx_sz_c;
-    const int tu_num_h_c = (max_4x4_h_c + tx_sz_c - 1) / tx_sz_c;
-    const int tu_num_c = tu_num_w_c * tu_num_h_c;
-
-    if (!is_inter_block(mbmi)) {
-      int tu_idx_c = 0;
-      int row_y, col_y, row_c, col_c;
-      int plane;
-
-      for (plane = 0; plane <= 1; ++plane) {
-        if (mbmi->palette_mode_info.palette_size[plane])
-          av1_decode_palette_tokens(xd, plane, r);
-      }
-
-      for (row_y = 0; row_y < tu_num_h_y; row_y++) {
-        for (col_y = 0; col_y < tu_num_w_y; col_y++) {
-          // luma
-          predict_and_reconstruct_intra_block(
-              cm, xd, r, mbmi, 0, row_y * tx_sz_y, col_y * tx_sz_y, tx_log2_y);
-          // chroma
-          if (tu_idx_c < tu_num_c) {
-            row_c = (tu_idx_c / tu_num_w_c) * tx_sz_c;
-            col_c = (tu_idx_c % tu_num_w_c) * tx_sz_c;
-            predict_and_reconstruct_intra_block(cm, xd, r, mbmi, 1, row_c,
-                                                col_c, tx_log2_c);
-            predict_and_reconstruct_intra_block(cm, xd, r, mbmi, 2, row_c,
-                                                col_c, tx_log2_c);
-            tu_idx_c++;
-          }
-        }
-      }
-
-      // In 422 case, it's possilbe that Chroma has more TUs than Luma
-      while (tu_idx_c < tu_num_c) {
-        row_c = (tu_idx_c / tu_num_w_c) * tx_sz_c;
-        col_c = (tu_idx_c % tu_num_w_c) * tx_sz_c;
-        predict_and_reconstruct_intra_block(cm, xd, r, mbmi, 1, row_c, col_c,
-                                            tx_log2_c);
-        predict_and_reconstruct_intra_block(cm, xd, r, mbmi, 2, row_c, col_c,
-                                            tx_log2_c);
-        tu_idx_c++;
-      }
-    } else {
-      // Prediction
-      av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL,
-                                    AOMMAX(bsize, BLOCK_8X8));
-
-      // Reconstruction
-      if (!mbmi->skip) {
-        int eobtotal = 0;
-        int tu_idx_c = 0;
-        int row_y, col_y, row_c, col_c;
-
-        for (row_y = 0; row_y < tu_num_h_y; row_y++) {
-          for (col_y = 0; col_y < tu_num_w_y; col_y++) {
-            // luma
-            eobtotal += reconstruct_inter_block(cm, xd, r, mbmi->segment_id, 0,
-                                                row_y * tx_sz_y,
-                                                col_y * tx_sz_y, tx_log2_y);
-            // chroma
-            if (tu_idx_c < tu_num_c) {
-              row_c = (tu_idx_c / tu_num_w_c) * tx_sz_c;
-              col_c = (tu_idx_c % tu_num_w_c) * tx_sz_c;
-              eobtotal += reconstruct_inter_block(cm, xd, r, mbmi->segment_id,
-                                                  1, row_c, col_c, tx_log2_c);
-              eobtotal += reconstruct_inter_block(cm, xd, r, mbmi->segment_id,
-                                                  2, row_c, col_c, tx_log2_c);
-              tu_idx_c++;
-            }
-          }
-        }
-
-        // In 422 case, it's possilbe that Chroma has more TUs than Luma
-        while (tu_idx_c < tu_num_c) {
-          row_c = (tu_idx_c / tu_num_w_c) * tx_sz_c;
-          col_c = (tu_idx_c % tu_num_w_c) * tx_sz_c;
-          eobtotal += reconstruct_inter_block(cm, xd, r, mbmi->segment_id, 1,
-                                              row_c, col_c, tx_log2_c);
-          eobtotal += reconstruct_inter_block(cm, xd, r, mbmi->segment_id, 2,
-                                              row_c, col_c, tx_log2_c);
-          tu_idx_c++;
-        }
-
-        // TODO(CONFIG_COEF_INTERLEAVE owners): bring eob == 0 corner case
-        // into line with the defaut configuration
-        if (bsize >= BLOCK_8X8 && eobtotal == 0) mbmi->skip = 1;
-      }
-    }
-  }
-#else  // CONFIG_COEF_INTERLEAVE
   if (!is_inter_block(mbmi)) {
     int plane;
 
@@ -912,7 +753,6 @@
     }
   }
 #endif  // CONFIG_CFL
-#endif  // CONFIG_COEF_INTERLEAVE
 
   int reader_corrupted_flag = aom_reader_has_error(r);
   aom_merge_corrupted_flag(&xd->corrupted, reader_corrupted_flag);
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 4423696..f5f03de 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -642,7 +642,6 @@
 }
 #endif  // !CONFIG_LV_MAP
 
-#if !CONFIG_COEF_INTERLEAVE
 #if CONFIG_LV_MAP
 static void pack_txb_tokens(aom_writer *w, AV1_COMMON *cm, MACROBLOCK *const x,
                             const TOKENEXTRA **tp,
@@ -772,7 +771,6 @@
   }
 }
 #endif  // CONFIG_LV_MAP
-#endif
 
 static void write_segment_id(aom_writer *w, const struct segmentation *seg,
                              struct segmentation_probs *segp, int segment_id) {
@@ -2127,82 +2125,6 @@
     }
   }
 
-#if CONFIG_COEF_INTERLEAVE
-  if (!mbmi->skip) {
-    const struct macroblockd_plane *const pd_y = &xd->plane[0];
-    const struct macroblockd_plane *const pd_c = &xd->plane[1];
-    const TX_SIZE tx_log2_y = mbmi->tx_size;
-    const TX_SIZE tx_log2_c = av1_get_uv_tx_size(mbmi, pd_c);
-    const int tx_sz_y = (1 << tx_log2_y);
-    const int tx_sz_c = (1 << tx_log2_c);
-
-    const BLOCK_SIZE plane_bsize_y =
-        get_plane_block_size(AOMMAX(mbmi->sb_type, 3), pd_y);
-    const BLOCK_SIZE plane_bsize_c =
-        get_plane_block_size(AOMMAX(mbmi->sb_type, 3), pd_c);
-
-    const int num_4x4_w_y = num_4x4_blocks_wide_lookup[plane_bsize_y];
-    const int num_4x4_w_c = num_4x4_blocks_wide_lookup[plane_bsize_c];
-    const int num_4x4_h_y = num_4x4_blocks_high_lookup[plane_bsize_y];
-    const int num_4x4_h_c = num_4x4_blocks_high_lookup[plane_bsize_c];
-
-    const int max_4x4_w_y = get_max_4x4_size(num_4x4_w_y, xd->mb_to_right_edge,
-                                             pd_y->subsampling_x);
-    const int max_4x4_h_y = get_max_4x4_size(num_4x4_h_y, xd->mb_to_bottom_edge,
-                                             pd_y->subsampling_y);
-    const int max_4x4_w_c = get_max_4x4_size(num_4x4_w_c, xd->mb_to_right_edge,
-                                             pd_c->subsampling_x);
-    const int max_4x4_h_c = get_max_4x4_size(num_4x4_h_c, xd->mb_to_bottom_edge,
-                                             pd_c->subsampling_y);
-
-    // The max_4x4_w/h may be smaller than tx_sz under some corner cases,
-    // i.e. when the SB is splitted by tile boundaries.
-    const int tu_num_w_y = (max_4x4_w_y + tx_sz_y - 1) / tx_sz_y;
-    const int tu_num_h_y = (max_4x4_h_y + tx_sz_y - 1) / tx_sz_y;
-    const int tu_num_w_c = (max_4x4_w_c + tx_sz_c - 1) / tx_sz_c;
-    const int tu_num_h_c = (max_4x4_h_c + tx_sz_c - 1) / tx_sz_c;
-    const int tu_num_y = tu_num_w_y * tu_num_h_y;
-    const int tu_num_c = tu_num_w_c * tu_num_h_c;
-
-    int tu_idx_y = 0, tu_idx_c = 0;
-    TOKEN_STATS token_stats;
-    init_token_stats(&token_stats);
-
-    assert(*tok < tok_end);
-
-    while (tu_idx_y < tu_num_y) {
-      pack_mb_tokens(w, tok, tok_end, cm->bit_depth, tx_log2_y, &token_stats);
-      assert(*tok < tok_end && (*tok)->token == EOSB_TOKEN);
-      (*tok)++;
-      tu_idx_y++;
-
-      if (tu_idx_c < tu_num_c) {
-        pack_mb_tokens(w, tok, tok_end, cm->bit_depth, tx_log2_c, &token_stats);
-        assert(*tok < tok_end && (*tok)->token == EOSB_TOKEN);
-        (*tok)++;
-
-        pack_mb_tokens(w, tok, tok_end, cm->bit_depth, tx_log2_c, &token_stats);
-        assert(*tok < tok_end && (*tok)->token == EOSB_TOKEN);
-        (*tok)++;
-
-        tu_idx_c++;
-      }
-    }
-
-    // In 422 case, it's possilbe that Chroma has more TUs than Luma
-    while (tu_idx_c < tu_num_c) {
-      pack_mb_tokens(w, tok, tok_end, cm->bit_depth, tx_log2_c, &token_stats);
-      assert(*tok < tok_end && (*tok)->token == EOSB_TOKEN);
-      (*tok)++;
-
-      pack_mb_tokens(w, tok, tok_end, cm->bit_depth, tx_log2_c, &token_stats);
-      assert(*tok < tok_end && (*tok)->token == EOSB_TOKEN);
-      (*tok)++;
-
-      tu_idx_c++;
-    }
-  }
-#else  // CONFIG_COEF_INTERLEAVE
   if (!mbmi->skip) {
 #if !CONFIG_LV_MAP
     assert(*tok < tok_end);
@@ -2313,7 +2235,6 @@
 #endif
     }
   }
-#endif  // CONFIG_COEF_INTERLEAVE
 }
 
 #if NC_MODE_INFO
diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c
index e4ea8ef..f62fef4 100644
--- a/av1/encoder/tokenize.c
+++ b/av1/encoder/tokenize.c
@@ -520,11 +520,6 @@
     pt = get_coef_context(nb, token_cache, AOMMIN(c, eob - 1));
   }
 
-#if CONFIG_COEF_INTERLEAVE
-  t->token = EOSB_TOKEN;
-  t++;
-#endif
-
   *tp = t;
 
 #if CONFIG_ADAPT_SCAN
@@ -745,9 +740,6 @@
   }
 
   if (!dry_run) {
-#if CONFIG_COEF_INTERLEAVE
-    av1_foreach_transformed_block_interleave(xd, bsize, tokenize_b, &arg);
-#else
     int plane;
 
     for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
@@ -764,7 +756,6 @@
       (*t)->token = EOSB_TOKEN;
       (*t)++;
     }
-#endif
   } else if (dry_run == DRY_RUN_NORMAL) {
     int plane;
     for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake
index 9f019d9..bd5ecce 100644
--- a/build/cmake/aom_config_defaults.cmake
+++ b/build/cmake/aom_config_defaults.cmake
@@ -113,7 +113,6 @@
 set(CONFIG_CDEF 1 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_CDEF_SINGLEPASS 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_CFL 1 CACHE NUMBER "AV1 experiment flag.")
-set(CONFIG_COEF_INTERLEAVE 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_COLORSPACE_HEADERS 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_COMPOUND_ROUND 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_COMPOUND_SINGLEREF 0 CACHE NUMBER "AV1 experiment flag.")
diff --git a/configure b/configure
index 3ea2034..6b861d7 100755
--- a/configure
+++ b/configure
@@ -296,7 +296,6 @@
     tempmv_signaling
     rd_debug
     reference_buffer
-    coef_interleave
     entropy_stats
     masked_tx
     dependent_horztiles
@@ -541,7 +540,6 @@
     enabled lv_map && disable_feature mrc_tx
     enabled eob_first && enable_feature lv_map
     enabled eob_first && enable_feature ext_tx
-    enabled coef_interleave && disable_feature mrc_tx
     enabled mrc_tx && enable_feature ext_tx
     enabled txk_sel && soft_enable lv_map
     enabled ctx1d && soft_enable lv_map