Remove sadperbit4

Change-Id: If4240bc6eb2a33be0acf78ece09faac8b41eae62
diff --git a/av1/encoder/block.h b/av1/encoder/block.h
index 1a31d6e..38b7e71 100644
--- a/av1/encoder/block.h
+++ b/av1/encoder/block.h
@@ -252,10 +252,7 @@
   int errorperbit;
   // The equivalend SAD error of one (whole) bit at the current quantizer
   // for large blocks.
-  int sadperbit16;
-  // The equivalent SAD error of one (whole) bit at the current quantizer
-  // for sub-8x8 blocks.
-  int sadperbit4;
+  int sadperbit;
   int rdmult;
   int mb_energy;
   int sb_energy_level;
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index 4c793be..d39b45a 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -232,10 +232,10 @@
   int step_param = 3 + sr;
   int cost_list[5];
 
-  tmp_err = av1_full_pixel_search(
-      cpi, x, bsize, start_mv, step_param, NSTEP, 0, x->sadperbit16,
-      cond_cost_list(cpi, cost_list), ref_mv, 0, &cpi->ss_cfg[SS_CFG_FPF],
-      &x->best_mv.as_fullmv, NULL);
+  tmp_err = av1_full_pixel_search(cpi, x, bsize, start_mv, step_param, NSTEP, 0,
+                                  x->sadperbit, cond_cost_list(cpi, cost_list),
+                                  ref_mv, 0, &cpi->ss_cfg[SS_CFG_FPF],
+                                  &x->best_mv.as_fullmv, NULL);
 
   if (tmp_err < INT_MAX) {
     tmp_err = av1_get_mvpred_sse(x, &x->best_mv.as_fullmv, ref_mv, &v_fn_ptr) +
diff --git a/av1/encoder/motion_search_facade.c b/av1/encoder/motion_search_facade.c
index c8857e7..d163c02 100644
--- a/av1/encoder/motion_search_facade.c
+++ b/av1/encoder/motion_search_facade.c
@@ -123,7 +123,7 @@
   else
     start_mv = get_fullmv_from_mv(&ref_mv);
 
-  const int sadpb = x->sadperbit16;
+  const int sadpb = x->sadperbit;
   int cost_list[5];
   int_mv second_best_mv;
   x->best_mv.as_int = second_best_mv.as_int = INVALID_MV;
@@ -296,7 +296,7 @@
   int_mv *best_int_mv = &x->best_mv;
 
   const int search_range = SEARCH_RANGE_8P;
-  const int sadpb = x->sadperbit16;
+  const int sadpb = x->sadperbit;
   // Allow joint search multiple times iteratively for each reference frame
   // and break out of the search loop if it couldn't find a better mv.
   for (ite = 0; ite < 4; ite++) {
@@ -481,7 +481,7 @@
   }
 
   int bestsme = INT_MAX;
-  int sadpb = x->sadperbit16;
+  int sadpb = x->sadperbit;
   int_mv *best_int_mv = &x->best_mv;
   int search_range = SEARCH_RANGE_8P;
 
@@ -691,7 +691,7 @@
   const FullMvLimits tmp_mv_limits = x->mv_limits;
   const SEARCH_METHODS search_methods = cpi->sf.mv_sf.search_method;
   const int do_mesh_search = 0;
-  const int sadpb = x->sadperbit16;
+  const int sadpb = x->sadperbit;
   int cost_list[5];
   const int ref_idx = 0;
   int var;
diff --git a/av1/encoder/nonrd_pickmode.c b/av1/encoder/nonrd_pickmode.c
index e807fd0..48ca53c 100644
--- a/av1/encoder/nonrd_pickmode.c
+++ b/av1/encoder/nonrd_pickmode.c
@@ -125,7 +125,7 @@
   MB_MODE_INFO *mi = xd->mi[0];
   struct buf_2d backup_yv12[MAX_MB_PLANE] = { { 0, 0, 0, 0, 0 } };
   int step_param = cpi->mv_step_param;
-  const int sadpb = x->sadperbit16;
+  const int sadpb = x->sadperbit;
   FULLPEL_MV start_mv;
   const int ref = mi->ref_frame[0];
   const MV ref_mv = av1_get_ref_mv(x, mi->ref_mv_idx).as_mv;
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index d5a1b42..5b4b730 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -312,14 +312,11 @@
 }
 
 // Values are now correlated to quantizer.
-static int sad_per_bit16lut_8[QINDEX_RANGE];
-static int sad_per_bit4lut_8[QINDEX_RANGE];
-static int sad_per_bit16lut_10[QINDEX_RANGE];
-static int sad_per_bit4lut_10[QINDEX_RANGE];
-static int sad_per_bit16lut_12[QINDEX_RANGE];
-static int sad_per_bit4lut_12[QINDEX_RANGE];
+static int sad_per_bit_lut_8[QINDEX_RANGE];
+static int sad_per_bit_lut_10[QINDEX_RANGE];
+static int sad_per_bit_lut_12[QINDEX_RANGE];
 
-static void init_me_luts_bd(int *bit16lut, int *bit4lut, int range,
+static void init_me_luts_bd(int *bit16lut, int range,
                             aom_bit_depth_t bit_depth) {
   int i;
   // Initialize the sad lut tables using a formulaic calculation for now.
@@ -328,17 +325,13 @@
   for (i = 0; i < range; i++) {
     const double q = av1_convert_qindex_to_q(i, bit_depth);
     bit16lut[i] = (int)(0.0418 * q + 2.4107);
-    bit4lut[i] = (int)(0.063 * q + 2.742);
   }
 }
 
 void av1_init_me_luts(void) {
-  init_me_luts_bd(sad_per_bit16lut_8, sad_per_bit4lut_8, QINDEX_RANGE,
-                  AOM_BITS_8);
-  init_me_luts_bd(sad_per_bit16lut_10, sad_per_bit4lut_10, QINDEX_RANGE,
-                  AOM_BITS_10);
-  init_me_luts_bd(sad_per_bit16lut_12, sad_per_bit4lut_12, QINDEX_RANGE,
-                  AOM_BITS_12);
+  init_me_luts_bd(sad_per_bit_lut_8, QINDEX_RANGE, AOM_BITS_8);
+  init_me_luts_bd(sad_per_bit_lut_10, QINDEX_RANGE, AOM_BITS_10);
+  init_me_luts_bd(sad_per_bit_lut_12, QINDEX_RANGE, AOM_BITS_12);
 }
 
 static const int rd_boost_factor[16] = { 64, 32, 32, 32, 24, 16, 12, 12,
@@ -446,18 +439,9 @@
 
 void av1_initialize_me_consts(const AV1_COMP *cpi, MACROBLOCK *x, int qindex) {
   switch (cpi->common.seq_params.bit_depth) {
-    case AOM_BITS_8:
-      x->sadperbit16 = sad_per_bit16lut_8[qindex];
-      x->sadperbit4 = sad_per_bit4lut_8[qindex];
-      break;
-    case AOM_BITS_10:
-      x->sadperbit16 = sad_per_bit16lut_10[qindex];
-      x->sadperbit4 = sad_per_bit4lut_10[qindex];
-      break;
-    case AOM_BITS_12:
-      x->sadperbit16 = sad_per_bit16lut_12[qindex];
-      x->sadperbit4 = sad_per_bit4lut_12[qindex];
-      break;
+    case AOM_BITS_8: x->sadperbit = sad_per_bit_lut_8[qindex]; break;
+    case AOM_BITS_10: x->sadperbit = sad_per_bit_lut_10[qindex]; break;
+    case AOM_BITS_12: x->sadperbit = sad_per_bit_lut_12[qindex]; break;
     default:
       assert(0 && "bit_depth should be AOM_BITS_8, AOM_BITS_10 or AOM_BITS_12");
   }
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index ec10fd7..a68cd84 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -2734,7 +2734,7 @@
 
     int step_param = cpi->mv_step_param;
     FULLPEL_MV start_mv = get_fullmv_from_mv(&dv_ref.as_mv);
-    const int sadpb = x->sadperbit16;
+    const int sadpb = x->sadperbit;
     int cost_list[5];
     int bestsme = av1_full_pixel_search(
         cpi, x, bsize, start_mv, step_param, cpi->sf.mv_sf.search_method, 0,
diff --git a/av1/encoder/temporal_filter.c b/av1/encoder/temporal_filter.c
index 61341e3..1b8a901 100644
--- a/av1/encoder/temporal_filter.c
+++ b/av1/encoder/temporal_filter.c
@@ -89,7 +89,7 @@
   const int do_reset_fractional_mv = 1;
   SUBPEL_MOTION_SEARCH_PARAMS ms_params;
 
-  const int sadperbit16 = mb->sadperbit16;
+  const int sadperbit = mb->sadperbit;
   const search_site_config ss_cfg = cpi->ss_cfg[SS_CFG_LOOKAHEAD];
   const SEARCH_METHODS full_search_method = NSTEP;
   const int step_param = av1_init_search_range(
@@ -123,7 +123,7 @@
   int block_error = INT_MAX;
   mb->mv_cost_type = mv_cost_type;
   av1_full_pixel_search(cpi, mb, block_size, start_mv, step_param,
-                        full_search_method, 1, sadperbit16,
+                        full_search_method, 1, sadperbit,
                         cond_cost_list(cpi, cost_list), &baseline_mv, 0,
                         &ss_cfg, &mb->best_mv.as_fullmv, NULL);
   // Since we are merely refining the result from full pixel search, we don't
@@ -165,7 +165,7 @@
         av1_set_mv_search_range(&mb->mv_limits, &baseline_mv);
         mb->mv_cost_type = mv_cost_type;
         av1_full_pixel_search(cpi, mb, subblock_size, start_mv, step_param,
-                              full_search_method, 1, sadperbit16,
+                              full_search_method, 1, sadperbit,
                               cond_cost_list(cpi, cost_list), &baseline_mv, 0,
                               &ss_cfg, &mb->best_mv.as_fullmv, NULL);
         // Since we are merely refining the result from full pixel search, we
diff --git a/av1/encoder/tpl_model.c b/av1/encoder/tpl_model.c
index 893e258..f90fe27 100644
--- a/av1/encoder/tpl_model.c
+++ b/av1/encoder/tpl_model.c
@@ -129,7 +129,7 @@
   TPL_SPEED_FEATURES *tpl_sf = &cpi->sf.tpl_sf;
   const SEARCH_METHODS search_method = mv_sf->search_method;
   int step_param;
-  int sadpb = x->sadperbit16;
+  int sadpb = x->sadperbit;
   uint32_t bestsme = UINT_MAX;
   int distortion;
   uint32_t sse;