Remove CONFIG_CB4X4 config flags

Since CB4X4 is adopted and without it the codec does not work,
it is better to remove it and simplify the code.

Change-Id: I51019312846928069727967e3b2bbb60f0fba80d
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index c71a571..19f8288 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -709,12 +709,9 @@
 #if CONFIG_CHROMA_SUB8X8
   const BLOCK_SIZE plane_bsize =
       AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
-#elif CONFIG_CB4X4
-  const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
 #else
-  const BLOCK_SIZE plane_bsize =
-      get_plane_block_size(AOMMAX(BLOCK_8X8, bsize), pd);
-#endif
+  const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
+#endif  // CONFIG_CHROMA_SUB8X8
 
   adapt = x->daala_enc.state.adapt;
 
@@ -1187,16 +1184,10 @@
     }
   }
 
-#if CONFIG_CB4X4
   if (!is_chroma_reference(mi_row, mi_col, mbmi->sb_type,
                            xd->plane[1].subsampling_x,
                            xd->plane[1].subsampling_y))
     return;
-#else
-  (void)xd;
-  (void)mi_row;
-  (void)mi_col;
-#endif  // CONFIG_CB4X4
 
   if (mbmi->uv_mode == UV_DC_PRED &&
       mbmi->palette_mode_info.palette_size[1] == 0) {
@@ -1635,11 +1626,7 @@
   const int is_inter = is_inter_block(mbmi);
   const int is_compound = has_second_ref(mbmi);
   int skip, ref;
-#if CONFIG_CB4X4
   const int unify_bsize = 1;
-#else
-  const int unify_bsize = 0;
-#endif
   (void)mi_row;
   (void)mi_col;
 
@@ -1704,7 +1691,7 @@
   write_is_inter(cm, xd, mbmi->segment_id, w, is_inter);
 
   if (cm->tx_mode == TX_MODE_SELECT &&
-#if CONFIG_CB4X4 && CONFIG_VAR_TX && !CONFIG_RECT_TX
+#if CONFIG_VAR_TX && !CONFIG_RECT_TX
       (bsize >= BLOCK_8X8 || (bsize > BLOCK_4X4 && is_inter)) &&
 #else
       block_signals_txsize(bsize) &&
@@ -1763,23 +1750,16 @@
         }
       }
     }
-#if CONFIG_CB4X4
     if (is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
                             xd->plane[1].subsampling_y)) {
       write_intra_uv_mode(ec_ctx, mbmi->uv_mode, mode, w);
-#else  // !CONFIG_CB4X4
-    write_intra_uv_mode(ec_ctx, mbmi->uv_mode, mode, w);
-#endif  // CONFIG_CB4X4
 
 #if CONFIG_CFL
       if (mbmi->uv_mode == UV_CFL_PRED) {
         write_cfl_alphas(ec_ctx, mbmi->cfl_alpha_idx, mbmi->cfl_alpha_signs, w);
       }
 #endif
-
-#if CONFIG_CB4X4
     }
-#endif
 
 #if CONFIG_EXT_INTRA
     write_intra_angle_info(xd, w);
@@ -2084,11 +2064,7 @@
   const MODE_INFO *const left_mi = xd->left_mi;
   const MB_MODE_INFO *const mbmi = &mi->mbmi;
   const BLOCK_SIZE bsize = mbmi->sb_type;
-#if CONFIG_CB4X4
   const int unify_bsize = 1;
-#else
-  const int unify_bsize = 0;
-#endif
   (void)mi_row;
   (void)mi_col;
 
@@ -2169,23 +2145,17 @@
     }
   }
 
-#if CONFIG_CB4X4
   if (is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
                           xd->plane[1].subsampling_y)) {
     write_intra_uv_mode(ec_ctx, mbmi->uv_mode, mbmi->mode, w);
-#else  // !CONFIG_CB4X4
-  write_intra_uv_mode(ec_ctx, mbmi->uv_mode, mbmi->mode, w);
-#endif  // CONFIG_CB4X4
 
 #if CONFIG_CFL
     if (mbmi->uv_mode == UV_CFL_PRED) {
       write_cfl_alphas(ec_ctx, mbmi->cfl_alpha_idx, mbmi->cfl_alpha_signs, w);
     }
 #endif
-
-#if CONFIG_CB4X4
   }
-#endif
+
 #if CONFIG_EXT_INTRA
   write_intra_angle_info(xd, w);
 #endif  // CONFIG_EXT_INTRA
@@ -2507,7 +2477,6 @@
     assert(*tok < tok_end);
 #endif
     for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
-#if CONFIG_CB4X4
       if (!is_chroma_reference(mi_row, mi_col, mbmi->sb_type,
                                xd->plane[plane].subsampling_x,
                                xd->plane[plane].subsampling_y)) {
@@ -2516,19 +2485,15 @@
 #endif  // !CONFIG_LV_MAP
         continue;
       }
-#endif
 #if CONFIG_VAR_TX
       const struct macroblockd_plane *const pd = &xd->plane[plane];
       BLOCK_SIZE bsize = mbmi->sb_type;
 #if CONFIG_CHROMA_SUB8X8
       const BLOCK_SIZE plane_bsize =
           AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
-#elif CONFIG_CB4X4
-      const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
 #else
-      const BLOCK_SIZE plane_bsize =
-          get_plane_block_size(AOMMAX(bsize, BLOCK_8X8), pd);
-#endif
+      const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
+#endif  // CONFIG_CHROMA_SUB8X8
 
       const int num_4x4_w =
           block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
@@ -2674,11 +2639,7 @@
   const int hbs = mi_size_wide[bsize] / 2;
   PARTITION_TYPE partition;
   BLOCK_SIZE subsize;
-#if CONFIG_CB4X4
   const int unify_bsize = 1;
-#else
-  const int unify_bsize = 0;
-#endif
 
   if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return;
 
@@ -2818,11 +2779,7 @@
 #endif  // CONFIG_EXT_PARTITION_TYPES
   const PARTITION_TYPE partition = get_partition(cm, mi_row, mi_col, bsize);
   const BLOCK_SIZE subsize = get_subsize(bsize, partition);
-#if CONFIG_CB4X4
   const int unify_bsize = 1;
-#else
-  const int unify_bsize = 0;
-#endif
 
   if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return;
 
diff --git a/av1/encoder/block.h b/av1/encoder/block.h
index c2b618a..4547c97 100644
--- a/av1/encoder/block.h
+++ b/av1/encoder/block.h
@@ -214,11 +214,7 @@
 #endif
 
   int skip;
-
-#if CONFIG_CB4X4
   int skip_chroma_rd;
-#endif
-
   int skip_cost[SKIP_CONTEXTS][2];
 
 #if CONFIG_LV_MAP
@@ -356,13 +352,11 @@
 #if CONFIG_DIST_8X8
   int using_dist_8x8;
   aom_tune_metric tune_metric;
-#if CONFIG_CB4X4
 #if CONFIG_HIGHBITDEPTH
   DECLARE_ALIGNED(16, uint16_t, decoded_8x8[8 * 8]);
 #else
   DECLARE_ALIGNED(16, uint8_t, decoded_8x8[8 * 8]);
 #endif
-#endif  // CONFIG_CB4X4
 #endif  // CONFIG_DIST_8X8
 };
 
diff --git a/av1/encoder/context_tree.c b/av1/encoder/context_tree.c
index eb33cd5..7be0225 100644
--- a/av1/encoder/context_tree.c
+++ b/av1/encoder/context_tree.c
@@ -13,10 +13,7 @@
 #include "av1/encoder/encoder.h"
 
 static const BLOCK_SIZE square[MAX_SB_SIZE_LOG2 - 1] = {
-#if CONFIG_CB4X4
-  BLOCK_4X4,
-#endif
-  BLOCK_8X8,     BLOCK_16X16, BLOCK_32X32, BLOCK_64X64,
+  BLOCK_4X4,     BLOCK_8X8, BLOCK_16X16, BLOCK_32X32, BLOCK_64X64,
 #if CONFIG_EXT_PARTITION
   BLOCK_128X128,
 #endif  // CONFIG_EXT_PARTITION
@@ -172,17 +169,12 @@
 // represents the state of our search.
 void av1_setup_pc_tree(AV1_COMMON *cm, ThreadData *td) {
   int i, j;
-#if CONFIG_CB4X4
 #if CONFIG_EXT_PARTITION
   const int tree_nodes_inc = 1024;
 #else
   const int tree_nodes_inc = 256;
 #endif  // CONFIG_EXT_PARTITION
   const int leaf_factor = 4;
-#else
-  const int tree_nodes_inc = 0;
-  const int leaf_factor = 1;
-#endif
 #if CONFIG_EXT_PARTITION
   const int leaf_nodes = 256 * leaf_factor;
   const int tree_nodes = tree_nodes_inc + 256 + 64 + 16 + 4 + 1;
@@ -195,42 +187,16 @@
   int square_index = 1;
   int nodes;
 
-#if !CONFIG_CB4X4
-  aom_free(td->leaf_tree);
-  CHECK_MEM_ERROR(cm, td->leaf_tree,
-                  aom_calloc(leaf_nodes, sizeof(*td->leaf_tree)));
-  PICK_MODE_CONTEXT *this_leaf = &td->leaf_tree[0];
-#endif
   aom_free(td->pc_tree);
   CHECK_MEM_ERROR(cm, td->pc_tree,
                   aom_calloc(tree_nodes, sizeof(*td->pc_tree)));
   this_pc = &td->pc_tree[0];
 
-#if !CONFIG_CB4X4
-  // 4x4 blocks smaller than 8x8 but in the same 8x8 block share the same
-  // context so we only need to allocate 1 for each 8x8 block.
-  for (i = 0; i < leaf_nodes; ++i) {
-#if CONFIG_EXT_PARTITION_TYPES
-    alloc_mode_context(cm, 4, PARTITION_NONE, &td->leaf_tree[i]);
-#else
-    alloc_mode_context(cm, 16, &td->leaf_tree[i]);
-#endif
-  }
-#endif
-
   // Sets up all the leaf nodes in the tree.
   for (pc_tree_index = 0; pc_tree_index < leaf_nodes; ++pc_tree_index) {
     PC_TREE *const tree = &td->pc_tree[pc_tree_index];
     tree->block_size = square[0];
-#if CONFIG_CB4X4
     alloc_tree_contexts(cm, tree, 16);
-#else
-    alloc_tree_contexts(cm, tree, 4);
-#endif
-#if !CONFIG_CB4X4
-    tree->leaf_split[0] = this_leaf++;
-    for (j = 1; j < 4; j++) tree->leaf_split[j] = tree->leaf_split[0];
-#endif
   }
 
   // Each node has 4 leaf nodes, fill each block_size level of the tree
@@ -238,11 +204,7 @@
   for (nodes = leaf_nodes >> 2; nodes > 0; nodes >>= 2) {
     for (i = 0; i < nodes; ++i) {
       PC_TREE *const tree = &td->pc_tree[pc_tree_index];
-#if CONFIG_CB4X4
       alloc_tree_contexts(cm, tree, 16 << (2 * square_index));
-#else
-      alloc_tree_contexts(cm, tree, 4 << (2 * square_index));
-#endif
       tree->block_size = square[square_index];
       for (j = 0; j < 4; j++) tree->split[j] = this_pc++;
       ++pc_tree_index;
@@ -262,15 +224,11 @@
 }
 
 void av1_free_pc_tree(ThreadData *td) {
-#if CONFIG_CB4X4
 #if CONFIG_EXT_PARTITION
   const int tree_nodes_inc = 1024;
 #else
   const int tree_nodes_inc = 256;
 #endif  // CONFIG_EXT_PARTITION
-#else
-  const int tree_nodes_inc = 0;
-#endif
 
 #if CONFIG_EXT_PARTITION
   const int tree_nodes = tree_nodes_inc + 256 + 64 + 16 + 4 + 1;
@@ -281,15 +239,4 @@
   for (i = 0; i < tree_nodes; ++i) free_tree_contexts(&td->pc_tree[i]);
   aom_free(td->pc_tree);
   td->pc_tree = NULL;
-#if !CONFIG_CB4X4
-  const int leaf_factor = 1;
-#if CONFIG_EXT_PARTITION
-  const int leaf_nodes = 256 * leaf_factor;
-#else
-  const int leaf_nodes = 64 * leaf_factor;
-#endif  // CONFIG_EXT_PARTITION
-  for (i = 0; i < leaf_nodes; ++i) free_mode_context(&td->leaf_tree[i]);
-  aom_free(td->leaf_tree);
-  td->leaf_tree = NULL;
-#endif
 }
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index ec43e5e..f0cf128 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -448,7 +448,7 @@
   const int mis = cm->mi_stride;
   const int mi_width = mi_size_wide[bsize];
   const int mi_height = mi_size_high[bsize];
-  const int unify_bsize = CONFIG_CB4X4;
+  const int unify_bsize = 1;
 
   int8_t rf_type;
 
@@ -633,12 +633,7 @@
   const BLOCK_SIZE bsize2 = get_subsize(bsize, PARTITION_SPLIT);
   const int quarter_step = mi_size_wide[bsize] / 4;
 #endif
-#if CONFIG_CB4X4
   const int unify_bsize = 1;
-#else
-  const int unify_bsize = 0;
-  assert(bsize >= BLOCK_8X8);
-#endif
 
   if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return;
 
@@ -820,7 +815,7 @@
   return av1_compute_rd_mult(cpi, segment_qindex + cm->y_dc_delta_q);
 }
 
-#if CONFIG_DIST_8X8 && CONFIG_CB4X4
+#if CONFIG_DIST_8X8
 static void dist_8x8_set_sub8x8_dst(MACROBLOCK *const x, uint8_t *dst8x8,
                                     BLOCK_SIZE bsize, int bw, int bh,
                                     int mi_row, int mi_col) {
@@ -853,7 +848,7 @@
 #endif
   }
 }
-#endif
+#endif  // CONFIG_DIST_8X8
 
 static void rd_pick_sb_modes(const AV1_COMP *const cpi, TileDataEnc *tile_data,
                              MACROBLOCK *const x, int mi_row, int mi_col,
@@ -913,11 +908,9 @@
   // Set to zero to make sure we do not use the previous encoded frame stats
   mbmi->skip = 0;
 
-#if CONFIG_CB4X4
   x->skip_chroma_rd =
       !is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
                            xd->plane[1].subsampling_y);
-#endif
 
 #if CONFIG_HIGHBITDEPTH
   if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
@@ -1614,12 +1607,7 @@
 #endif
 #endif
 
-#if CONFIG_CB4X4
   const int unify_bsize = 1;
-#else
-  const int unify_bsize = 0;
-  assert(bsize >= BLOCK_8X8);
-#endif
 
   if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return;
 
@@ -1893,7 +1881,7 @@
   BLOCK_SIZE bs_type = mib[0]->mbmi.sb_type;
   int do_partition_search = 1;
   PICK_MODE_CONTEXT *ctx_none = &pc_tree->none;
-  const int unify_bsize = CONFIG_CB4X4;
+  const int unify_bsize = 1;
 #if CONFIG_PVQ
   od_rollback_buffer pre_rdo_buf;
 #endif
@@ -2586,7 +2574,7 @@
 }
 #endif  // CONFIG_EXT_PARTITION_TYPES
 
-#if CONFIG_DIST_8X8 && CONFIG_CB4X4
+#if CONFIG_DIST_8X8
 static int64_t dist_8x8_yuv(const AV1_COMP *const cpi, MACROBLOCK *const x,
                             uint8_t *y_src_8x8) {
   MACROBLOCKD *const xd = &x->e_mbd;
@@ -2632,7 +2620,7 @@
 
   return total_dist = dist_8x8 + dist_8x8_uv;
 }
-#endif  // CONFIG_DIST_8X8 && CONFIG_CB4X4
+#endif  // CONFIG_DIST_8X8
 
 // TODO(jingning,jimbankoski,rbultje): properly skip partition types that are
 // unlikely to be selected depending on previous rate-distortion optimization
@@ -2661,7 +2649,6 @@
   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;
-#if CONFIG_CB4X4
   const int unify_bsize = 1;
   const int pl = bsize_at_least_8x8
                      ? partition_plane_context(xd, mi_row, mi_col,
@@ -2670,14 +2657,6 @@
 #endif
                                                bsize)
                      : 0;
-#else
-  const int unify_bsize = 0;
-  const int pl = partition_plane_context(xd, mi_row, mi_col,
-#if CONFIG_UNPOISON_PARTITION_CTX
-                                         has_rows, has_cols,
-#endif
-                                         bsize);
-#endif  // CONFIG_CB4X4
   const int *partition_cost =
       pl >= 0 ? x->partition_cost[pl] : x->partition_cost[0];
 
@@ -3006,7 +2985,7 @@
       }
       reached_last_index = (idx == 4);
 
-#if CONFIG_DIST_8X8 && CONFIG_CB4X4
+#if CONFIG_DIST_8X8
       if (x->using_dist_8x8 && reached_last_index &&
           sum_rdc.rdcost != INT64_MAX && bsize == BLOCK_8X8) {
         const int src_stride = x->plane[0].src.stride;
@@ -3017,7 +2996,7 @@
         sum_rdc.dist = dist_8x8;
         sum_rdc.rdcost = RDCOST(x->rdmult, sum_rdc.rate, sum_rdc.dist);
       }
-#endif  // CONFIG_DIST_8X8 && CONFIG_CB4X4
+#endif  // CONFIG_DIST_8X8
     }
 
 #if CONFIG_CFL && CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
@@ -3083,14 +3062,14 @@
                        subsize, &pc_tree->horizontal[1],
                        best_rdc.rdcost - sum_rdc.rdcost);
 
-#if CONFIG_DIST_8X8 && CONFIG_CB4X4
+#if CONFIG_DIST_8X8
       if (x->using_dist_8x8 && this_rdc.rate != INT_MAX && bsize == BLOCK_8X8) {
         update_state(cpi, td, &pc_tree->horizontal[1], mi_row + mi_step, mi_col,
                      subsize, DRY_RUN_NORMAL);
         encode_superblock(cpi, td, tp, DRY_RUN_NORMAL, mi_row + mi_step, mi_col,
                           subsize, NULL);
       }
-#endif  // CONFIG_DIST_8X8 && CONFIG_CB4X4
+#endif  // CONFIG_DIST_8X8
 
       if (this_rdc.rate == INT_MAX) {
         sum_rdc.rdcost = INT64_MAX;
@@ -3099,7 +3078,7 @@
         sum_rdc.dist += this_rdc.dist;
         sum_rdc.rdcost += this_rdc.rdcost;
       }
-#if CONFIG_DIST_8X8 && CONFIG_CB4X4
+#if CONFIG_DIST_8X8
       if (x->using_dist_8x8 && sum_rdc.rdcost != INT64_MAX &&
           bsize == BLOCK_8X8) {
         const int src_stride = x->plane[0].src.stride;
@@ -3109,7 +3088,7 @@
         sum_rdc.dist = dist_8x8;
         sum_rdc.rdcost = RDCOST(x->rdmult, sum_rdc.rate, sum_rdc.dist);
       }
-#endif  // CONFIG_DIST_8X8 && CONFIG_CB4X4
+#endif  // CONFIG_DIST_8X8
     }
 
 #if CONFIG_CFL && CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
@@ -3168,14 +3147,14 @@
                        subsize, &pc_tree->vertical[1],
                        best_rdc.rdcost - sum_rdc.rdcost);
 
-#if CONFIG_DIST_8X8 && CONFIG_CB4X4
+#if CONFIG_DIST_8X8
       if (x->using_dist_8x8 && this_rdc.rate != INT_MAX && bsize == BLOCK_8X8) {
         update_state(cpi, td, &pc_tree->vertical[1], mi_row, mi_col + mi_step,
                      subsize, DRY_RUN_NORMAL);
         encode_superblock(cpi, td, tp, DRY_RUN_NORMAL, mi_row, mi_col + mi_step,
                           subsize, NULL);
       }
-#endif  // CONFIG_DIST_8X8 && CONFIG_CB4X4
+#endif  // CONFIG_DIST_8X8
 
       if (this_rdc.rate == INT_MAX) {
         sum_rdc.rdcost = INT64_MAX;
@@ -3184,7 +3163,7 @@
         sum_rdc.dist += this_rdc.dist;
         sum_rdc.rdcost += this_rdc.rdcost;
       }
-#if CONFIG_DIST_8X8 && CONFIG_CB4X4
+#if CONFIG_DIST_8X8
       if (x->using_dist_8x8 && sum_rdc.rdcost != INT64_MAX &&
           bsize == BLOCK_8X8) {
         int64_t dist_8x8;
@@ -3193,7 +3172,7 @@
         sum_rdc.dist = dist_8x8;
         sum_rdc.rdcost = RDCOST(x->rdmult, sum_rdc.rate, sum_rdc.dist);
       }
-#endif  // CONFIG_DIST_8X8 && CONFIG_CB4X4
+#endif  // CONFIG_DIST_8X8
     }
 
 #if CONFIG_CFL && CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
@@ -3448,13 +3427,13 @@
     }
   }
 
-#if CONFIG_DIST_8X8 && CONFIG_CB4X4
+#if CONFIG_DIST_8X8
   if (x->using_dist_8x8 && best_rdc.rate < INT_MAX &&
       best_rdc.dist < INT64_MAX && bsize == BLOCK_4X4 && pc_tree->index == 3) {
     encode_sb(cpi, td, tile_info, tp, mi_row, mi_col, DRY_RUN_NORMAL, bsize,
               pc_tree, NULL);
   }
-#endif  // CONFIG_DIST_8X8 && CONFIG_CB4X4
+#endif  // CONFIG_DIST_8X8
 
   if (bsize == cm->sb_size) {
 #if !CONFIG_PVQ && !CONFIG_LV_MAP
@@ -3524,11 +3503,6 @@
     av1_fill_mode_rates(cm, x, xd->tile_ctx);
 
     if (sf->adaptive_pred_interp_filter) {
-#if !CONFIG_CB4X4
-      for (i = 0; i < leaf_nodes; ++i)
-        td->leaf_tree[i].pred_interp_filter = SWITCHABLE;
-#endif
-
       for (i = 0; i < leaf_nodes; ++i) {
         td->pc_tree[i].vertical[0].pred_interp_filter = SWITCHABLE;
         td->pc_tree[i].vertical[1].pred_interp_filter = SWITCHABLE;
@@ -4713,7 +4687,7 @@
   const UV_PREDICTION_MODE uv_mode = mbmi->uv_mode;
   (void)counts;
   const BLOCK_SIZE bsize = mbmi->sb_type;
-  const int unify_bsize = CONFIG_CB4X4;
+  const int unify_bsize = 1;
 
   if (bsize < BLOCK_8X8 && !unify_bsize) {
     int idx, idy;
@@ -4765,13 +4739,10 @@
                  mbmi->filter_intra_mode_info.filter_intra_mode[0],
                  FILTER_INTRA_MODES);
     }
-    if (mbmi->uv_mode == UV_DC_PRED
-#if CONFIG_CB4X4
-        &&
+    if (mbmi->uv_mode == UV_DC_PRED &&
         is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
-                            xd->plane[1].subsampling_y)
-#endif
-        && mbmi->palette_mode_info.palette_size[1] == 0) {
+                            xd->plane[1].subsampling_y) &&
+        mbmi->palette_mode_info.palette_size[1] == 0) {
       const int use_filter_intra_mode =
           mbmi->filter_intra_mode_info.use_filter_intra_mode[1];
       ++counts->filter_intra[1][use_filter_intra_mode];
@@ -4784,15 +4755,9 @@
 #endif  // CONFIG_FILTER_INTRA
   }
 
-#if CONFIG_CB4X4
   if (!is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
                            xd->plane[1].subsampling_y))
     return;
-#else
-  (void)mi_row;
-  (void)mi_col;
-  (void)xd;
-#endif
 #if CONFIG_ENTROPY_STATS
   ++counts->uv_mode[y_mode][uv_mode];
 #endif  // CONFIG_ENTROPY_STATS
@@ -5123,11 +5088,7 @@
   const int mi_width = mi_size_wide[bsize];
   const int mi_height = mi_size_high[bsize];
   const int is_inter = is_inter_block(mbmi);
-#if CONFIG_CB4X4
   const BLOCK_SIZE block_size = bsize;
-#else
-  const BLOCK_SIZE block_size = AOMMAX(bsize, BLOCK_8X8);
-#endif
 
 #if CONFIG_PVQ
   x->pvq_speed = 0;
@@ -5255,13 +5216,13 @@
 #endif
   }
 
-#if CONFIG_DIST_8X8 && CONFIG_CB4X4
+#if CONFIG_DIST_8X8
   if (x->using_dist_8x8 && bsize < BLOCK_8X8) {
     dist_8x8_set_sub8x8_dst(x, (uint8_t *)x->decoded_8x8, bsize,
                             block_size_wide[bsize], block_size_high[bsize],
                             mi_row, mi_col);
   }
-#endif
+#endif  // CONFIG_DIST_8X8
 
   if (!dry_run) {
 #if CONFIG_VAR_TX
@@ -5271,11 +5232,11 @@
     TX_SIZE tx_size = mbmi->tx_size;
 #endif
     if (cm->tx_mode == TX_MODE_SELECT && !xd->lossless[mbmi->segment_id] &&
-#if CONFIG_CB4X4 && (CONFIG_VAR_TX || CONFIG_EXT_TX) && CONFIG_RECT_TX
+#if (CONFIG_VAR_TX || CONFIG_EXT_TX) && CONFIG_RECT_TX
         mbmi->sb_type > BLOCK_4X4 &&
 #else
         mbmi->sb_type >= BLOCK_8X8 &&
-#endif
+#endif  // (CONFIG_VAR_TX || CONFIG_EXT_TX) && CONFIG_RECT_TX
         !(is_inter && (mbmi->skip || seg_skip))) {
 #if CONFIG_VAR_TX
       if (is_inter) {
@@ -5353,14 +5314,8 @@
   }
 
 #if CONFIG_VAR_TX
-  if (cm->tx_mode == TX_MODE_SELECT &&
-#if CONFIG_CB4X4
-      mbmi->sb_type > BLOCK_4X4 &&
-#else
-      mbmi->sb_type >= BLOCK_8X8 &&
-#endif
-      is_inter && !(mbmi->skip || seg_skip) &&
-      !xd->lossless[mbmi->segment_id]) {
+  if (cm->tx_mode == TX_MODE_SELECT && mbmi->sb_type > BLOCK_4X4 && is_inter &&
+      !(mbmi->skip || seg_skip) && !xd->lossless[mbmi->segment_id]) {
     if (dry_run) tx_partition_set_contexts(cm, xd, bsize, mi_row, mi_col);
   } else {
     TX_SIZE tx_size = mbmi->tx_size;
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index aeff5b6..6a88714 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -917,7 +917,6 @@
   if (x->skip) return;
 
   for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
-#if CONFIG_CB4X4
     const int subsampling_x = xd->plane[plane].subsampling_x;
     const int subsampling_y = xd->plane[plane].subsampling_y;
 
@@ -926,10 +925,6 @@
       continue;
 
     bsize = scale_chroma_bsize(bsize, subsampling_x, subsampling_y);
-#else
-    (void)mi_row;
-    (void)mi_col;
-#endif
 
 #if CONFIG_VAR_TX
     // TODO(jingning): Clean this up.
@@ -1102,15 +1097,10 @@
     cm, x, NULL, &xd->mi[0]->mbmi.skip, ta, tl, enable_optimize_b
   };
 
-#if CONFIG_CB4X4
   if (!is_chroma_reference(mi_row, mi_col, bsize,
                            xd->plane[plane].subsampling_x,
                            xd->plane[plane].subsampling_y))
     return;
-#else
-  (void)mi_row;
-  (void)mi_col;
-#endif
 
   if (enable_optimize_b) {
     const struct macroblockd_plane *const pd = &xd->plane[plane];
diff --git a/av1/encoder/encodemv.c b/av1/encoder/encodemv.c
index f8a5469..fd1d13e 100644
--- a/av1/encoder/encodemv.c
+++ b/av1/encoder/encodemv.c
@@ -381,11 +381,7 @@
   const MODE_INFO *mi = xd->mi[0];
   const MB_MODE_INFO *const mbmi = &mi->mbmi;
   const MB_MODE_INFO_EXT *mbmi_ext = td->mb.mbmi_ext;
-#if CONFIG_CB4X4
   const int unify_bsize = 1;
-#else
-  const int unify_bsize = 0;
-#endif
 #if CONFIG_AMVR
   MvSubpelPrecision precision = 1;
   if (xd->cur_frame_mv_precision_level) {
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index b70c859..41fc6b8 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -4640,7 +4640,6 @@
 #endif
 #endif  // CONFIG_LPF_SB
   {
-#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_CB4X4
 #if CONFIG_LPF_SB
     av1_loop_filter_frame(cm->frame_to_show, cm, xd, lf->filter_level, 0, 0, 0,
                           0);
@@ -4657,14 +4656,6 @@
     av1_loop_filter_frame(cm->frame_to_show, cm, xd, lf->filter_level, 0, 0);
 #endif  // CONFIG_LOOPFILTER_LEVEL
 #endif  // CONFIG_LPF_SB
-#else
-    if (cpi->num_workers > 1)
-      av1_loop_filter_frame_mt(cm->frame_to_show, cm, xd->plane,
-                               lf->filter_level, 0, 0, cpi->workers,
-                               cpi->num_workers, &cpi->lf_row_sync);
-    else
-      av1_loop_filter_frame(cm->frame_to_show, cm, xd, lf->filter_level, 0, 0);
-#endif
   }
 #endif  // CONFIG_INTRABC
 
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index d708eeb..919abd7 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -339,9 +339,6 @@
   MACROBLOCK mb;
   RD_COUNTS rd_counts;
   FRAME_COUNTS *counts;
-#if !CONFIG_CB4X4
-  PICK_MODE_CONTEXT *leaf_tree;
-#endif
   PC_TREE *pc_tree;
   PC_TREE *pc_root[MAX_MIB_SIZE_LOG2 - MIN_MIB_SIZE_LOG2 + 1];
 #if CONFIG_MOTION_VAR
@@ -720,13 +717,8 @@
 // Get the allocated token size for a tile. It does the same calculation as in
 // the frame token allocation.
 static INLINE unsigned int allocated_tokens(TileInfo tile) {
-#if CONFIG_CB4X4
   int tile_mb_rows = (tile.mi_row_end - tile.mi_row_start + 2) >> 2;
   int tile_mb_cols = (tile.mi_col_end - tile.mi_col_start + 2) >> 2;
-#else
-  int tile_mb_rows = (tile.mi_row_end - tile.mi_row_start + 1) >> 1;
-  int tile_mb_cols = (tile.mi_col_end - tile.mi_col_start + 1) >> 1;
-#endif
 
   return get_token_alloc(tile_mb_rows, tile_mb_cols);
 }
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index 15b6d09..bbb20d8 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -469,12 +469,9 @@
 #if CONFIG_CHROMA_SUB8X8
   const BLOCK_SIZE plane_bsize =
       AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
-#elif CONFIG_CB4X4
-  const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
 #else
-  const BLOCK_SIZE plane_bsize =
-      get_plane_block_size(AOMMAX(bsize, BLOCK_8X8), pd);
-#endif
+  const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
+#endif  // CONFIG_CHROMA_SUB8X8
   const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane);
   const int max_blocks_high = max_block_high(xd, plane_bsize, plane);
   const TX_SIZE tx_size = av1_get_tx_size(plane, xd);
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index edc9b1d..1ea99d6 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -81,10 +81,7 @@
                         aom_memalign(32, sizeof(*thread_data->td)));
         av1_zero(*thread_data->td);
 
-// Set up pc_tree.
-#if !CONFIG_CB4X4
-        thread_data->td->leaf_tree = NULL;
-#endif
+        // Set up pc_tree.
         thread_data->td->pc_tree = NULL;
         av1_setup_pc_tree(cm, thread_data->td);
 
diff --git a/av1/encoder/picklpf.c b/av1/encoder/picklpf.c
index b6b427d..35276d7 100644
--- a/av1/encoder/picklpf.c
+++ b/av1/encoder/picklpf.c
@@ -123,18 +123,8 @@
   AV1_COMMON *const cm = &cpi->common;
   int filt_err;
 
-#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_CB4X4
   av1_loop_filter_frame(cm->frame_to_show, cm, &cpi->td.mb.e_mbd, filt_level, 1,
                         partial_frame, mi_row, mi_col);
-#else
-  if (cpi->num_workers > 1)
-    av1_loop_filter_frame_mt(cm->frame_to_show, cm, cpi->td.mb.e_mbd.plane,
-                             filt_level, 1, partial_frame, cpi->workers,
-                             cpi->num_workers, &cpi->lf_row_sync);
-  else
-    av1_loop_filter_frame(cm->frame_to_show, cm, &cpi->td.mb.e_mbd, filt_level,
-                          1, partial_frame);
-#endif
 
 #if CONFIG_HIGHBITDEPTH
   if (cm->use_highbitdepth) {
@@ -252,7 +242,6 @@
   AV1_COMMON *const cm = &cpi->common;
   int64_t filt_err;
 
-#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_CB4X4
 #if CONFIG_LOOPFILTER_LEVEL
   assert(plane >= 0 && plane <= 2);
   int filter_level[2] = { filt_level, filt_level };
@@ -265,15 +254,6 @@
   av1_loop_filter_frame(cm->frame_to_show, cm, &cpi->td.mb.e_mbd, filt_level, 1,
                         partial_frame);
 #endif  // CONFIG_LOOPFILTER_LEVEL
-#else
-  if (cpi->num_workers > 1)
-    av1_loop_filter_frame_mt(cm->frame_to_show, cm, cpi->td.mb.e_mbd.plane,
-                             filt_level, 1, partial_frame, cpi->workers,
-                             cpi->num_workers, &cpi->lf_row_sync);
-  else
-    av1_loop_filter_frame(cm->frame_to_show, cm, &cpi->td.mb.e_mbd, filt_level,
-                          1, partial_frame);
-#endif
 
   int highbd = 0;
 #if CONFIG_HIGHBITDEPTH
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index 6053f54..a5fed79 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -565,25 +565,10 @@
       const int t = q * rd_thresh_block_size_factor[bsize];
       const int thresh_max = INT_MAX / t;
 
-#if CONFIG_CB4X4
       for (i = 0; i < MAX_MODES; ++i)
         rd->threshes[segment_id][bsize][i] = rd->thresh_mult[i] < thresh_max
                                                  ? rd->thresh_mult[i] * t / 4
                                                  : INT_MAX;
-#else
-      if (bsize >= BLOCK_8X8) {
-        for (i = 0; i < MAX_MODES; ++i)
-          rd->threshes[segment_id][bsize][i] = rd->thresh_mult[i] < thresh_max
-                                                   ? rd->thresh_mult[i] * t / 4
-                                                   : INT_MAX;
-      } else {
-        for (i = 0; i < MAX_REFS; ++i)
-          rd->threshes[segment_id][bsize][i] =
-              rd->thresh_mult_sub8x8[i] < thresh_max
-                  ? rd->thresh_mult_sub8x8[i] * t / 4
-                  : INT_MAX;
-      }
-#endif
     }
   }
 }
@@ -1489,11 +1474,7 @@
                                int (*factor_buf)[MAX_MODES], int rd_thresh,
                                int bsize, int best_mode_index) {
   if (rd_thresh > 0) {
-#if CONFIG_CB4X4
     const int top_mode = MAX_MODES;
-#else
-    const int top_mode = bsize < BLOCK_8X8 ? MAX_REFS : MAX_MODES;
-#endif
     int mode;
     for (mode = 0; mode < top_mode; ++mode) {
       const BLOCK_SIZE min_size = AOMMAX(bsize - 1, BLOCK_4X4);
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index f96be6d..0e2e31e 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -1522,9 +1522,7 @@
     int rate;
     int64_t dist;
 
-#if CONFIG_CB4X4
     if (x->skip_chroma_rd && plane) continue;
-#endif  // CONFIG_CB4X4
 
     // TODO(geza): Write direct sse functions that do not compute
     // variance as well.
@@ -1803,12 +1801,9 @@
 #if CONFIG_CHROMA_SUB8X8
   const BLOCK_SIZE plane_bsize =
       AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
-#elif CONFIG_CB4X4
+#else
   const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
-#else   // CONFIG_CB4X4
-  const BLOCK_SIZE plane_bsize =
-      get_plane_block_size(AOMMAX(BLOCK_8X8, bsize), pd);
-#endif  // CONFIG_CB4X4
+#endif  // CONFIG_CHROMA_SUB8X8
 
   TXB_CTX txb_ctx;
   get_txb_ctx(plane_bsize, tx_size, plane, a, l, &txb_ctx);
@@ -2898,10 +2893,10 @@
           *rd_stats = this_rd_stats;
         }
       }
-#if CONFIG_CB4X4 && !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
+#if !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
       const int is_inter = is_inter_block(mbmi);
       if (mbmi->sb_type < BLOCK_8X8 && is_inter) break;
-#endif  // CONFIG_CB4X4 && !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
+#endif  // !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
     }
 #if CONFIG_LGT_FROM_PRED
     const TX_SIZE rect_tx_size = max_txsize_rect_lookup[bs];
@@ -2964,10 +2959,10 @@
           *rd_stats = this_rd_stats;
         }
       }
-#if CONFIG_CB4X4 && !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
+#if !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
       const int is_inter = is_inter_block(mbmi);
       if (mbmi->sb_type < BLOCK_8X8 && is_inter) break;
-#endif  // CONFIG_CB4X4 && !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
+#endif  // !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
     }
 #if CONFIG_LGT_FROM_PRED
     if (is_lgt_allowed(mbmi->mode, tx_size) && !cm->reduced_tx_set_used) {
@@ -3053,10 +3048,10 @@
         best_rd = rd;
         *rd_stats = this_rd_stats;
       }
-#if CONFIG_CB4X4 && !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
+#if !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
       const int is_inter = is_inter_block(mbmi);
       if (mbmi->sb_type < BLOCK_8X8 && is_inter) break;
-#endif  // CONFIG_CB4X4 && !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
+#endif  // !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
     }
 #if CONFIG_LGT_FROM_PRED
     mbmi->use_lgt = 1;
@@ -3726,15 +3721,9 @@
         assert(IMPLIES(tx_size == TX_4X8 || tx_size == TX_8X4,
                        block == 0 || block == 2));
         xd->mi[0]->bmi[block_raster_idx].as_mode = mode;
-        av1_predict_intra_block(cm, xd, pd->width, pd->height,
-                                txsize_to_bsize[tx_size], mode, dst, dst_stride,
-                                dst, dst_stride,
-#if CONFIG_CB4X4
-                                2 * (col + idx), 2 * (row + idy),
-#else
-                                col + idx, row + idy,
-#endif  // CONFIG_CB4X4
-                                0);
+        av1_predict_intra_block(
+            cm, xd, pd->width, pd->height, txsize_to_bsize[tx_size], mode, dst,
+            dst_stride, dst, dst_stride, 2 * (col + idx), 2 * (row + idy), 0);
 #if !CONFIG_PVQ
         aom_subtract_block(tx_height, tx_width, src_diff, 8, src, src_stride,
                            dst, dst_stride);
@@ -3744,27 +3733,15 @@
         const SCAN_ORDER *scan_order =
             get_scan(cm, tx_size, tx_type, &xd->mi[0]->mbmi);
         const int coeff_ctx = combine_entropy_contexts(tempa[idx], templ[idy]);
-#if CONFIG_CB4X4
         block = 4 * block;
-#endif  // CONFIG_CB4X4
 #if !CONFIG_PVQ
 #if DISABLE_TRELLISQ_SEARCH
-        av1_xform_quant(cm, x, 0, block,
-#if CONFIG_CB4X4
-                        2 * (row + idy), 2 * (col + idx),
-#else
-                        row + idy, col + idx,
-#endif  // CONFIG_CB4X4
+        av1_xform_quant(cm, x, 0, block, 2 * (row + idy), 2 * (col + idx),
                         BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_B);
 #else
         const AV1_XFORM_QUANT xform_quant =
             is_lossless ? AV1_XFORM_QUANT_B : AV1_XFORM_QUANT_FP;
-        av1_xform_quant(cm, x, 0, block,
-#if CONFIG_CB4X4
-                        2 * (row + idy), 2 * (col + idx),
-#else
-                        row + idy, col + idx,
-#endif  // CONFIG_CB4X4
+        av1_xform_quant(cm, x, 0, block, 2 * (row + idy), 2 * (col + idx),
                         BLOCK_8X8, tx_size, coeff_ctx, xform_quant);
 
         av1_optimize_b(cm, x, 0, 0, 0, block, BLOCK_8X8, tx_size, tempa + idx,
@@ -3787,12 +3764,7 @@
 #else
         (void)scan_order;
 
-        av1_xform_quant(cm, x, 0, block,
-#if CONFIG_CB4X4
-                        2 * (row + idy), 2 * (col + idx),
-#else
-                        row + idy, col + idx,
-#endif  // CONFIG_CB4X4
+        av1_xform_quant(cm, x, 0, block, 2 * (row + idy), 2 * (col + idx),
                         BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP);
 
         ratey += x->rate;
@@ -4582,12 +4554,10 @@
 
   if (ref_best_rd < 0) is_cost_valid = 0;
 
-#if CONFIG_CB4X4
   if (x->skip_chroma_rd) return is_cost_valid;
 
   bsize = scale_chroma_bsize(bsize, xd->plane[1].subsampling_x,
                              xd->plane[1].subsampling_y);
-#endif  // CONFIG_CB4X4
 
 #if !CONFIG_PVQ
   if (is_inter_block(mbmi) && is_cost_valid) {
@@ -5809,11 +5779,9 @@
 
   av1_init_rd_stats(rd_stats);
 
-#if CONFIG_CB4X4
   if (x->skip_chroma_rd) return is_cost_valid;
   bsize = scale_chroma_bsize(mbmi->sb_type, xd->plane[1].subsampling_x,
                              xd->plane[1].subsampling_y);
-#endif  // CONFIG_CB4X4
 
 #if CONFIG_EXT_TX && CONFIG_RECT_TX
   if (is_rect_tx(mbmi->tx_size)) {
@@ -6519,7 +6487,6 @@
   // Use an estimated rd for uv_intra based on DC_PRED if the
   // appropriate speed flag is set.
   init_sbuv_mode(mbmi);
-#if CONFIG_CB4X4
   if (x->skip_chroma_rd) {
     *rate_uv = 0;
     *rate_uv_tokenonly = 0;
@@ -6534,14 +6501,6 @@
   // Only store reconstructed luma when there's chroma RDO. When there's no
   // chroma RDO, the reconstructed luma will be stored in encode_superblock().
   xd->cfl->store_y = !x->skip_chroma_rd;
-#endif  // CONFIG_CFL
-#else
-  bsize = bsize < BLOCK_8X8 ? BLOCK_8X8 : bsize;
-#if CONFIG_CFL
-  xd->cfl->store_y = 1;
-#endif  // CONFIG_CFL
-#endif  // CONFIG_CB4X4
-#if CONFIG_CFL
   if (xd->cfl->store_y) {
     // Perform one extra call to txfm_rd_in_plane(), with the values chosen
     // during luma RDO, so we can store reconstructed luma values
@@ -6818,10 +6777,7 @@
 #else
   DECLARE_ALIGNED(16, uint8_t, second_pred[MAX_SB_SQUARE]);
 #endif  // CONFIG_HIGHBITDEPTH
-
-#if CONFIG_CB4X4
   (void)ref_mv_sub8x8;
-#endif  // CONFIG_CB4X4
 
 #if CONFIG_COMPOUND_SINGLEREF
   for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref)
@@ -6829,12 +6785,7 @@
   for (ref = 0; ref < 2; ++ref)
 #endif  // CONFIG_COMPOUND_SINGLEREF
   {
-#if !CONFIG_CB4X4
-    if (bsize < BLOCK_8X8 && ref_mv_sub8x8 != NULL)
-      ref_mv[ref].as_int = ref_mv_sub8x8[ref]->as_int;
-    else
-#endif  // !CONFIG_CB4X4
-      ref_mv[ref] = x->mbmi_ext->ref_mvs[refs[ref]][0];
+    ref_mv[ref] = x->mbmi_ext->ref_mvs[refs[ref]][0];
 
     if (scaled_ref_frame[ref]) {
       int i;
@@ -7071,18 +7022,9 @@
                                   x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
     } else {
 #endif  // CONFIG_COMPOUND_SINGLEREF
-#if !CONFIG_CB4X4
-      if (bsize >= BLOCK_8X8)
-#endif  // !CONFIG_CB4X4
-        *rate_mv += av1_mv_bit_cost(&frame_mv[refs[ref]].as_mv,
-                                    &x->mbmi_ext->ref_mvs[refs[ref]][0].as_mv,
-                                    x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
-#if !CONFIG_CB4X4
-      else
-        *rate_mv += av1_mv_bit_cost(&frame_mv[refs[ref]].as_mv,
-                                    &ref_mv_sub8x8[ref]->as_mv, x->nmvjointcost,
-                                    x->mvcost, MV_COST_WEIGHT);
-#endif  // !CONFIG_CB4X4
+      *rate_mv += av1_mv_bit_cost(&frame_mv[refs[ref]].as_mv,
+                                  &x->mbmi_ext->ref_mvs[refs[ref]][0].as_mv,
+                                  x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
 #if CONFIG_COMPOUND_SINGLEREF
     }
 #endif  // CONFIG_COMPOUND_SINGLEREF
@@ -7363,17 +7305,11 @@
                         &frame_nearest_mv[ref_frame],
                         &frame_near_mv[ref_frame]);
 #endif
-// Further refinement that is encode side only to test the top few candidates
-// in full and choose the best as the centre point for subsequent searches.
-// The current implementation doesn't support scaling.
-#if CONFIG_CB4X4
+  // Further refinement that is encode side only to test the top few candidates
+  // in full and choose the best as the centre point for subsequent searches.
+  // The current implementation doesn't support scaling.
   av1_mv_pred(cpi, x, yv12_mb[ref_frame][0].buf, yv12->y_stride, ref_frame,
               block_size);
-#else
-  if (!av1_is_scaled(sf) && block_size >= BLOCK_8X8)
-    av1_mv_pred(cpi, x, yv12_mb[ref_frame][0].buf, yv12->y_stride, ref_frame,
-                block_size);
-#endif  // CONFIG_CB4X4
 }
 
 static void single_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
@@ -7934,7 +7870,6 @@
   int_mv frame_comp_mv[TOTAL_REFS_PER_FRAME];
 #endif  // CONFIG_COMPOUND_SINGLEREF
   MV_REFERENCE_FRAME rf[2] = { mbmi->ref_frame[0], mbmi->ref_frame[1] };
-  assert(bsize >= BLOCK_8X8 || CONFIG_CB4X4);
 
   frame_mv[rf[0]].as_int = cur_mv[0].as_int;
 #if CONFIG_COMPOUND_SINGLEREF
@@ -10082,7 +10017,7 @@
   int y_skip = 0, uv_skip = 0;
   int64_t dist_y = 0, dist_uv = 0;
   TX_SIZE max_uv_tx_size;
-  const int unify_bsize = CONFIG_CB4X4;
+  const int unify_bsize = 1;
 
   (void)cm;
 
@@ -10106,13 +10041,9 @@
 
   if (intra_yrd < best_rd) {
 #if CONFIG_CFL
-#if CONFIG_CB4X4
     // Only store reconstructed luma when there's chroma RDO. When there's no
     // chroma RDO, the reconstructed luma will be stored in encode_superblock().
     xd->cfl->store_y = !x->skip_chroma_rd;
-#else
-    xd->cfl->store_y = 1;
-#endif  // CONFIG_CB4X4
     if (xd->cfl->store_y) {
       // Perform one extra call to txfm_rd_in_plane(), with the values chosen
       // during luma RDO, so we can store reconstructed luma values
@@ -10126,14 +10057,9 @@
     max_uv_tx_size = uv_txsize_lookup[bsize][mbmi->tx_size][pd[1].subsampling_x]
                                      [pd[1].subsampling_y];
     init_sbuv_mode(mbmi);
-#if CONFIG_CB4X4
     if (!x->skip_chroma_rd)
       rd_pick_intra_sbuv_mode(cpi, x, &rate_uv, &rate_uv_tokenonly, &dist_uv,
                               &uv_skip, bsize, max_uv_tx_size);
-#else
-    rd_pick_intra_sbuv_mode(cpi, x, &rate_uv, &rate_uv_tokenonly, &dist_uv,
-                            &uv_skip, AOMMAX(BLOCK_8X8, bsize), max_uv_tx_size);
-#endif  // CONFIG_CB4X4
 
     if (y_skip && (uv_skip || x->skip_chroma_rd)) {
       rd_cost->rate = rate_y + rate_uv - rate_y_tokenonly - rate_uv_tokenonly +
@@ -11139,14 +11065,9 @@
       }
 #endif  // CONFIG_FILTER_INTRA
 
-#if CONFIG_CB4X4
       rate2 = rate_y + intra_mode_cost[mbmi->mode];
       if (!x->skip_chroma_rd)
         rate2 += rate_uv + x->intra_uv_mode_cost[mbmi->mode][mbmi->uv_mode];
-#else
-      rate2 = rate_y + intra_mode_cost[mbmi->mode] + rate_uv +
-              x->intra_uv_mode_cost[mbmi->mode][mbmi->uv_mode];
-#endif  // CONFIG_CB4X4
 
       if (try_palette && mbmi->mode == DC_PRED) {
         rate2 += x->palette_y_mode_cost[bsize - BLOCK_8X8][palette_ctx][0];
@@ -12683,11 +12604,9 @@
   int64_t this_rd;
   int ref;
 
-#if CONFIG_CB4X4
   x->skip_chroma_rd =
       !is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
                            xd->plane[1].subsampling_y);
-#endif
 
   set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]);
   for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) {
diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c
index d384d37..ff28a2f 100644
--- a/av1/encoder/tokenize.c
+++ b/av1/encoder/tokenize.c
@@ -722,7 +722,6 @@
 #endif
 
   for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
-#if CONFIG_CB4X4
     if (!is_chroma_reference(mi_row, mi_col, bsize,
                              xd->plane[plane].subsampling_x,
                              xd->plane[plane].subsampling_y)) {
@@ -734,7 +733,6 @@
 #endif
       continue;
     }
-#endif
     const struct macroblockd_plane *const pd = &xd->plane[plane];
 #if CONFIG_CHROMA_SUB8X8
     const BLOCK_SIZE plane_bsize =
@@ -806,7 +804,6 @@
     int plane;
 
     for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
-#if CONFIG_CB4X4
       if (!is_chroma_reference(mi_row, mi_col, bsize,
                                xd->plane[plane].subsampling_x,
                                xd->plane[plane].subsampling_y)) {
@@ -816,10 +813,6 @@
 #endif
         continue;
       }
-#else
-      (void)mi_row;
-      (void)mi_col;
-#endif
       av1_foreach_transformed_block_in_plane(xd, bsize, plane, tokenize_b,
                                              &arg);
 #if !CONFIG_PVQ
@@ -833,30 +826,20 @@
   else if (dry_run == DRY_RUN_NORMAL) {
     int plane;
     for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
-#if CONFIG_CB4X4
       if (!is_chroma_reference(mi_row, mi_col, bsize,
                                xd->plane[plane].subsampling_x,
                                xd->plane[plane].subsampling_y))
         continue;
-#else
-      (void)mi_row;
-      (void)mi_col;
-#endif
       av1_foreach_transformed_block_in_plane(xd, bsize, plane,
                                              set_entropy_context_b, &arg);
     }
   } else if (dry_run == DRY_RUN_COSTCOEFFS) {
     int plane;
     for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
-#if CONFIG_CB4X4
       if (!is_chroma_reference(mi_row, mi_col, bsize,
                                xd->plane[plane].subsampling_x,
                                xd->plane[plane].subsampling_y))
         continue;
-#else
-      (void)mi_row;
-      (void)mi_col;
-#endif
       av1_foreach_transformed_block_in_plane(xd, bsize, plane, cost_coeffs_b,
                                              &arg);
     }