Cleanup remnants of NCOBMC

Change-Id: I1e71848e9d6bc592a6d4a12051d513eb07b4acd1
diff --git a/av1/common/enums.h b/av1/common/enums.h
index 06cad9e..1d24ee7 100644
--- a/av1/common/enums.h
+++ b/av1/common/enums.h
@@ -22,8 +22,6 @@
 
 #undef MAX_SB_SIZE
 
-#define NC_MODE_INFO 0
-
 // Max superblock size
 #if CONFIG_EXT_PARTITION
 #define MAX_SB_SIZE_LOG2 7
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 395de75..1c643d4 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -574,77 +574,6 @@
   aom_merge_corrupted_flag(&xd->corrupted, reader_corrupted_flag);
 }
 
-#if NC_MODE_INFO
-static void detoken_and_recon_sb(AV1Decoder *const pbi, MACROBLOCKD *const xd,
-                                 int mi_row, int mi_col, aom_reader *r,
-                                 BLOCK_SIZE bsize) {
-  AV1_COMMON *const cm = &pbi->common;
-  const int hbs = mi_size_wide[bsize] >> 1;
-#if CONFIG_EXT_PARTITION_TYPES
-  BLOCK_SIZE bsize2 = get_subsize(bsize, PARTITION_SPLIT);
-#endif
-  PARTITION_TYPE partition;
-  BLOCK_SIZE subsize;
-  const int has_rows = (mi_row + hbs) < cm->mi_rows;
-  const int has_cols = (mi_col + hbs) < cm->mi_cols;
-
-  if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return;
-
-  partition = get_partition(cm, mi_row, mi_col, bsize);
-  subsize = subsize_lookup[partition][bsize];
-
-  switch (partition) {
-    case PARTITION_NONE:
-      decode_token_and_recon_block(pbi, xd, mi_row, mi_col, r, bsize);
-      break;
-    case PARTITION_HORZ:
-      decode_token_and_recon_block(pbi, xd, mi_row, mi_col, r, subsize);
-      if (has_rows)
-        decode_token_and_recon_block(pbi, xd, mi_row + hbs, mi_col, r, subsize);
-      break;
-    case PARTITION_VERT:
-      decode_token_and_recon_block(pbi, xd, mi_row, mi_col, r, subsize);
-      if (has_cols)
-        decode_token_and_recon_block(pbi, xd, mi_row, mi_col + hbs, r, subsize);
-      break;
-    case PARTITION_SPLIT:
-      detoken_and_recon_sb(pbi, xd, mi_row, mi_col, r, subsize);
-      detoken_and_recon_sb(pbi, xd, mi_row, mi_col + hbs, r, subsize);
-      detoken_and_recon_sb(pbi, xd, mi_row + hbs, mi_col, r, subsize);
-      detoken_and_recon_sb(pbi, xd, mi_row + hbs, mi_col + hbs, r, subsize);
-      break;
-#if CONFIG_EXT_PARTITION_TYPES
-#if CONFIG_EXT_PARTITION_TYPES_AB
-#error NC_MODE_INFO+MOTION_VAR not yet supported for new HORZ/VERT_AB partitions
-#endif
-    case PARTITION_HORZ_A:
-      decode_token_and_recon_block(pbi, xd, mi_row, mi_col, r, bsize2);
-      decode_token_and_recon_block(pbi, xd, mi_row, mi_col + hbs, r, bsize2);
-      decode_token_and_recon_block(pbi, xd, mi_row + hbs, mi_col, r, subsize);
-      break;
-    case PARTITION_HORZ_B:
-      decode_token_and_recon_block(pbi, xd, mi_row, mi_col, r, subsize);
-      decode_token_and_recon_block(pbi, xd, mi_row + hbs, mi_col, r, bsize2);
-      decode_token_and_recon_block(pbi, xd, mi_row + hbs, mi_col + hbs, r,
-                                   bsize2);
-      break;
-    case PARTITION_VERT_A:
-      decode_token_and_recon_block(pbi, xd, mi_row, mi_col, r, bsize2);
-      decode_token_and_recon_block(pbi, xd, mi_row + hbs, mi_col, r, bsize2);
-      decode_token_and_recon_block(pbi, xd, mi_row, mi_col + hbs, r, subsize);
-      break;
-    case PARTITION_VERT_B:
-      decode_token_and_recon_block(pbi, xd, mi_row, mi_col, r, subsize);
-      decode_token_and_recon_block(pbi, xd, mi_row, mi_col + hbs, r, bsize2);
-      decode_token_and_recon_block(pbi, xd, mi_row + hbs, mi_col + hbs, r,
-                                   bsize2);
-      break;
-#endif
-    default: assert(0 && "Invalid partition type");
-  }
-}
-#endif
-
 static void decode_block(AV1Decoder *const pbi, MACROBLOCKD *const xd,
                          int mi_row, int mi_col, aom_reader *r,
 #if CONFIG_EXT_PARTITION_TYPES
@@ -657,9 +586,7 @@
 #endif
                     bsize);
 
-#if !(NC_MODE_INFO)
   decode_token_and_recon_block(pbi, xd, mi_row, mi_col, r, bsize);
-#endif
 }
 
 static PARTITION_TYPE read_partition(MACROBLOCKD *xd, int mi_row, int mi_col,
@@ -2259,10 +2186,6 @@
 #endif
           decode_partition(pbi, &td->xd, mi_row, mi_col, &td->bit_reader,
                            cm->sb_size);
-#if NC_MODE_INFO
-          detoken_and_recon_sb(pbi, &td->xd, mi_row, mi_col, &td->bit_reader,
-                               cm->sb_size);
-#endif
 #if CONFIG_LPF_SB
           if (USE_LOOP_FILTER_SUPERBLOCK) {
             // apply deblocking filtering right after each superblock is decoded
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 5485849..7114830 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -2133,86 +2133,13 @@
   }
 }
 
-#if NC_MODE_INFO
-static void write_tokens_sb(AV1_COMP *cpi, const TileInfo *const tile,
-                            aom_writer *w, const TOKENEXTRA **tok,
-                            const TOKENEXTRA *const tok_end, int mi_row,
-                            int mi_col, BLOCK_SIZE bsize) {
-  const AV1_COMMON *const cm = &cpi->common;
-  const int hbs = mi_size_wide[bsize] / 2;
-  PARTITION_TYPE partition;
-  BLOCK_SIZE subsize;
-
-  if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return;
-
-  partition = get_partition(cm, mi_row, mi_col, bsize);
-  subsize = get_subsize(bsize, partition);
-
-  switch (partition) {
-    case PARTITION_NONE:
-      write_tokens_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
-      break;
-    case PARTITION_HORZ:
-      write_tokens_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
-      if (mi_row + hbs < cm->mi_rows)
-        write_tokens_b(cpi, tile, w, tok, tok_end, mi_row + hbs, mi_col);
-      break;
-    case PARTITION_VERT:
-      write_tokens_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
-      if (mi_col + hbs < cm->mi_cols)
-        write_tokens_b(cpi, tile, w, tok, tok_end, mi_row, mi_col + hbs);
-      break;
-    case PARTITION_SPLIT:
-      write_tokens_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col, subsize);
-      write_tokens_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col + hbs,
-                      subsize);
-      write_tokens_sb(cpi, tile, w, tok, tok_end, mi_row + hbs, mi_col,
-                      subsize);
-      write_tokens_sb(cpi, tile, w, tok, tok_end, mi_row + hbs, mi_col + hbs,
-                      subsize);
-      break;
-#if CONFIG_EXT_PARTITION_TYPES
-#if CONFIG_EXT_PARTITION_TYPES_AB
-#error NC_MODE_INFO+MOTION_VAR not yet supported for new HORZ/VERT_AB partitions
-#endif
-    case PARTITION_HORZ_A:
-      write_tokens_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
-      write_tokens_b(cpi, tile, w, tok, tok_end, mi_row, mi_col + hbs);
-      write_tokens_b(cpi, tile, w, tok, tok_end, mi_row + hbs, mi_col);
-      break;
-    case PARTITION_HORZ_B:
-      write_tokens_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
-      write_tokens_b(cpi, tile, w, tok, tok_end, mi_row + hbs, mi_col);
-      write_tokens_b(cpi, tile, w, tok, tok_end, mi_row + hbs, mi_col + hbs);
-      break;
-    case PARTITION_VERT_A:
-      write_tokens_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
-      write_tokens_b(cpi, tile, w, tok, tok_end, mi_row + hbs, mi_col);
-      write_tokens_b(cpi, tile, w, tok, tok_end, mi_row, mi_col + hbs);
-      break;
-    case PARTITION_VERT_B:
-      write_tokens_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
-      write_tokens_b(cpi, tile, w, tok, tok_end, mi_row, mi_col + hbs);
-      write_tokens_b(cpi, tile, w, tok, tok_end, mi_row + hbs, mi_col + hbs);
-      break;
-#endif  // CONFIG_EXT_PARTITION_TYPES
-    default: assert(0);
-  }
-}
-#endif
-
 static void write_modes_b(AV1_COMP *cpi, const TileInfo *const tile,
                           aom_writer *w, const TOKENEXTRA **tok,
                           const TOKENEXTRA *const tok_end, int mi_row,
                           int mi_col) {
   write_mbmi_b(cpi, tile, w, mi_row, mi_col);
 
-#if NC_MODE_INFO
-  (void)tok;
-  (void)tok_end;
-#else
   write_tokens_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
-#endif
 }
 
 static void write_partition(const AV1_COMMON *const cm,
@@ -2483,9 +2410,6 @@
 
     for (mi_col = mi_col_start; mi_col < mi_col_end; mi_col += cm->mib_size) {
       write_modes_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col, cm->sb_size);
-#if NC_MODE_INFO
-      write_tokens_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col, cm->sb_size);
-#endif
     }
   }
 }
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 32fa72a..d68444c 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -627,122 +627,6 @@
   av1_copy_frame_mvs(cm, mi, mi_row, mi_col, x_mis, y_mis);
 }
 
-#if NC_MODE_INFO
-static void set_mode_info_b(const AV1_COMP *const cpi, TileDataEnc *tile_data,
-                            ThreadData *td, int mi_row, int mi_col,
-                            BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx) {
-  const TileInfo *const tile = &tile_data->tile_info;
-  MACROBLOCK *const x = &td->mb;
-  set_offsets(cpi, tile, x, mi_row, mi_col, bsize);
-  update_state(cpi, tile_data, td, ctx, mi_row, mi_col, bsize, 1);
-}
-
-static void set_mode_info_sb(const AV1_COMP *const cpi, ThreadData *td,
-                             TileDataEnc *tile_data, TOKENEXTRA **tp,
-                             int mi_row, int mi_col, BLOCK_SIZE bsize,
-                             PC_TREE *pc_tree) {
-  const AV1_COMMON *const cm = &cpi->common;
-  const int hbs = mi_size_wide[bsize] / 2;
-  const PARTITION_TYPE partition = pc_tree->partitioning;
-  BLOCK_SIZE subsize = get_subsize(bsize, partition);
-#if CONFIG_EXT_PARTITION_TYPES
-  const BLOCK_SIZE bsize2 = get_subsize(bsize, PARTITION_SPLIT);
-  const int quarter_step = mi_size_wide[bsize] / 4;
-#endif
-
-  if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return;
-
-  switch (partition) {
-    case PARTITION_NONE:
-      set_mode_info_b(cpi, tile_data, td, mi_row, mi_col, subsize,
-                      &pc_tree->none);
-      break;
-    case PARTITION_VERT:
-      set_mode_info_b(cpi, tile_data, td, mi_row, mi_col, subsize,
-                      &pc_tree->vertical[0]);
-      if (mi_col + hbs < cm->mi_cols) {
-        set_mode_info_b(cpi, tile_data, td, mi_row, mi_col + hbs, subsize,
-                        &pc_tree->vertical[1]);
-      }
-      break;
-    case PARTITION_HORZ:
-      set_mode_info_b(cpi, tile_data, td, mi_row, mi_col, subsize,
-                      &pc_tree->horizontal[0]);
-      if (mi_row + hbs < cm->mi_rows) {
-        set_mode_info_b(cpi, tile_data, td, mi_row + hbs, mi_col, subsize,
-                        &pc_tree->horizontal[1]);
-      }
-      break;
-    case PARTITION_SPLIT:
-      set_mode_info_sb(cpi, td, tile_data, tp, mi_row, mi_col, subsize,
-                       pc_tree->split[0]);
-      set_mode_info_sb(cpi, td, tile_data, tp, mi_row, mi_col + hbs, subsize,
-                       pc_tree->split[1]);
-      set_mode_info_sb(cpi, td, tile_data, tp, mi_row + hbs, mi_col, subsize,
-                       pc_tree->split[2]);
-      set_mode_info_sb(cpi, td, tile_data, tp, mi_row + hbs, mi_col + hbs,
-                       subsize, pc_tree->split[3]);
-      break;
-#if CONFIG_EXT_PARTITION_TYPES
-#if CONFIG_EXT_PARTITION_TYPES_AB
-#error NC_MODE_INFO+MOTION_VAR not yet supported for new HORZ/VERT_AB partitions
-#endif
-    case PARTITION_HORZ_A:
-      set_mode_info_b(cpi, tile_data, td, mi_row, mi_col, bsize2,
-                      &pc_tree->horizontala[0]);
-      set_mode_info_b(cpi, tile_data, td, mi_row, mi_col + hbs, bsize2,
-                      &pc_tree->horizontala[1]);
-      set_mode_info_b(cpi, tile_data, td, mi_row + hbs, mi_col, subsize,
-                      &pc_tree->horizontala[2]);
-      break;
-    case PARTITION_HORZ_B:
-      set_mode_info_b(cpi, tile_data, td, mi_row, mi_col, subsize,
-                      &pc_tree->horizontalb[0]);
-      set_mode_info_b(cpi, tile_data, td, mi_row + hbs, mi_col, bsize2,
-                      &pc_tree->horizontalb[1]);
-      set_mode_info_b(cpi, tile_data, td, mi_row + hbs, mi_col + hbs, bsize2,
-                      &pc_tree->horizontalb[2]);
-      break;
-    case PARTITION_VERT_A:
-      set_mode_info_b(cpi, tile_data, td, mi_row, mi_col, bsize2,
-                      &pc_tree->verticala[0]);
-      set_mode_info_b(cpi, tile_data, td, mi_row + hbs, mi_col, bsize2,
-                      &pc_tree->verticala[1]);
-      set_mode_info_b(cpi, tile_data, td, mi_row, mi_col + hbs, subsize,
-                      &pc_tree->verticala[2]);
-      break;
-    case PARTITION_VERT_B:
-      set_mode_info_b(cpi, tile_data, td, mi_row, mi_col, subsize,
-                      &pc_tree->verticalb[0]);
-      set_mode_info_b(cpi, tile_data, td, mi_row, mi_col + hbs, bsize2,
-                      &pc_tree->verticalb[1]);
-      set_mode_info_b(cpi, tile_data, td, mi_row + hbs, mi_col + hbs, bsize2,
-                      &pc_tree->verticalb[2]);
-      break;
-    case PARTITION_HORZ_4:
-      for (int i = 0; i < 4; ++i) {
-        int this_mi_row = mi_row + i * quarter_step;
-        if (i > 0 && this_mi_row >= cm->mi_rows) break;
-
-        set_mode_info_b(cpi, tile_data, td, this_mi_row, mi_col, subsize,
-                        &pc_tree->horizontal4[i]);
-      }
-      break;
-    case PARTITION_VERT_4:
-      for (int i = 0; i < 4; ++i) {
-        int this_mi_col = mi_col + i * quarter_step;
-        if (i > 0 && this_mi_col >= cm->mi_cols) break;
-
-        set_mode_info_b(cpi, tile_data, td, mi_row, this_mi_col, subsize,
-                        &pc_tree->vertical4[i]);
-      }
-      break;
-#endif  // CONFIG_EXT_PARTITION_TYPES
-    default: assert(0 && "Invalid partition type."); break;
-  }
-}
-#endif
-
 void av1_setup_src_planes(MACROBLOCK *x, const YV12_BUFFER_CONFIG *src,
                           int mi_row, int mi_col) {
   uint8_t *const buffers[3] = { src->y_buffer, src->u_buffer, src->v_buffer };
@@ -3170,10 +3054,6 @@
   if (best_rdc.rate < INT_MAX && best_rdc.dist < INT64_MAX &&
       pc_tree->index != 3) {
     if (bsize == cm->sb_size) {
-#if NC_MODE_INFO
-      set_mode_info_sb(cpi, td, tile_data, tp, mi_row, mi_col, bsize, pc_tree);
-#endif
-
 #if CONFIG_LV_MAP
       x->cb_offset = 0;
 #endif