shithub: libvpx

Download patch

ref: 6ff4f19269d34df887673baeeaba1cb417a6a2af
parent: ede392d7651ffb6c27a19807a14886c910838bb9
author: Yunqing Wang <yunqingwang@google.com>
date: Thu Dec 19 06:20:56 EST 2013

Remove a unused sub-pixel search

The original iterative search was replaced by subpel_tree search,
and was not used anymore.

Change-Id: I998b38e1cb0ee359a08b2410d0766dbf183ab071

--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -270,104 +270,6 @@
     }                                                   \
   }
 
-int vp9_find_best_sub_pixel_iterative(MACROBLOCK *x,
-                                      MV *bestmv, const MV *ref_mv,
-                                      int allow_hp,
-                                      int error_per_bit,
-                                      const vp9_variance_fn_ptr_t *vfp,
-                                      int forced_stop,
-                                      int iters_per_step,
-                                      int *mvjcost, int *mvcost[2],
-                                      int *distortion,
-                                      unsigned int *sse1) {
-  uint8_t *z = x->plane[0].src.buf;
-  int src_stride = x->plane[0].src.stride;
-  MACROBLOCKD *xd = &x->e_mbd;
-
-  unsigned int besterr = INT_MAX;
-  unsigned int sse;
-  unsigned int whichdir;
-  unsigned int halfiters = iters_per_step;
-  unsigned int quarteriters = iters_per_step;
-  unsigned int eighthiters = iters_per_step;
-  int thismse;
-
-  const int y_stride = xd->plane[0].pre[0].stride;
-  const int offset = bestmv->row * y_stride + bestmv->col;
-  uint8_t *y = xd->plane[0].pre[0].buf + offset;
-
-  int rr = ref_mv->row;
-  int rc = ref_mv->col;
-  int br = bestmv->row * 8;
-  int bc = bestmv->col * 8;
-  int hstep = 4;
-  const int minc = MAX(x->mv_col_min * 8, ref_mv->col - MV_MAX);
-  const int maxc = MIN(x->mv_col_max * 8, ref_mv->col + MV_MAX);
-  const int minr = MAX(x->mv_row_min * 8, ref_mv->row - MV_MAX);
-  const int maxr = MIN(x->mv_row_max * 8, ref_mv->row + MV_MAX);
-
-  int tr = br;
-  int tc = bc;
-
-  // central mv
-  bestmv->row <<= 3;
-  bestmv->col <<= 3;
-
-  // calculate central point error
-  besterr = vfp->vf(y, y_stride, z, src_stride, sse1);
-  *distortion = besterr;
-  besterr += mv_err_cost(bestmv, ref_mv, mvjcost, mvcost, error_per_bit);
-
-  // TODO(jbb): Each subsequent iteration checks at least one point in
-  // common with the last iteration could be 2 if diagonal is selected.
-  while (halfiters--) {
-    // 1/2 pel
-    FIRST_LEVEL_CHECKS;
-    // no reason to check the same one again.
-    if (tr == br && tc == bc)
-      break;
-    tr = br;
-    tc = bc;
-  }
-
-  // TODO(yaowu): Each subsequent iteration checks at least one point in common
-  // with the last iteration could be 2 if diagonal is selected.
-
-  // Note forced_stop: 0 - full, 1 - qtr only, 2 - half only
-  if (forced_stop != 2) {
-    hstep >>= 1;
-    while (quarteriters--) {
-      FIRST_LEVEL_CHECKS;
-      // no reason to check the same one again.
-      if (tr == br && tc == bc)
-        break;
-      tr = br;
-      tc = bc;
-    }
-  }
-
-  if (allow_hp && vp9_use_mv_hp(ref_mv) && forced_stop == 0) {
-    hstep >>= 1;
-    while (eighthiters--) {
-      FIRST_LEVEL_CHECKS;
-      // no reason to check the same one again.
-      if (tr == br && tc == bc)
-        break;
-      tr = br;
-      tc = bc;
-    }
-  }
-
-  bestmv->row = br;
-  bestmv->col = bc;
-
-  if ((abs(bestmv->col - ref_mv->col) > (MAX_FULL_PEL_VAL << 3)) ||
-      (abs(bestmv->row - ref_mv->row) > (MAX_FULL_PEL_VAL << 3)))
-    return INT_MAX;
-
-  return besterr;
-}
-
 int vp9_find_best_sub_pixel_tree(MACROBLOCK *x,
                                  MV *bestmv, const MV *ref_mv,
                                  int allow_hp,
@@ -459,109 +361,6 @@
 #define DIST(r, c) \
     vfp->svaf(PRE(r, c), y_stride, SP(c), SP(r), \
               z, src_stride, &sse, second_pred)
-
-int vp9_find_best_sub_pixel_comp_iterative(MACROBLOCK *x,
-                                           MV *bestmv, const MV *ref_mv,
-                                           int allow_hp,
-                                           int error_per_bit,
-                                           const vp9_variance_fn_ptr_t *vfp,
-                                           int forced_stop,
-                                           int iters_per_step,
-                                           int *mvjcost, int *mvcost[2],
-                                           int *distortion,
-                                           unsigned int *sse1,
-                                           const uint8_t *second_pred,
-                                           int w, int h) {
-  uint8_t *const z = x->plane[0].src.buf;
-  const int src_stride = x->plane[0].src.stride;
-  MACROBLOCKD *const xd = &x->e_mbd;
-
-  unsigned int besterr = INT_MAX;
-  unsigned int sse;
-  unsigned int whichdir;
-  unsigned int halfiters = iters_per_step;
-  unsigned int quarteriters = iters_per_step;
-  unsigned int eighthiters = iters_per_step;
-  int thismse;
-
-  DECLARE_ALIGNED_ARRAY(16, uint8_t, comp_pred, 64 * 64);
-  const int y_stride = xd->plane[0].pre[0].stride;
-  const int offset = bestmv->row * y_stride + bestmv->col;
-  uint8_t *const y = xd->plane[0].pre[0].buf + offset;
-
-  int rr = ref_mv->row;
-  int rc = ref_mv->col;
-  int br = bestmv->row * 8;
-  int bc = bestmv->col * 8;
-  int hstep = 4;
-  const int minc = MAX(x->mv_col_min * 8, ref_mv->col - MV_MAX);
-  const int maxc = MIN(x->mv_col_max * 8, ref_mv->col + MV_MAX);
-  const int minr = MAX(x->mv_row_min * 8, ref_mv->row - MV_MAX);
-  const int maxr = MIN(x->mv_row_max * 8, ref_mv->row + MV_MAX);
-
-  int tr = br;
-  int tc = bc;
-
-  // central mv
-  bestmv->row *= 8;
-  bestmv->col *= 8;
-
-  // calculate central point error
-  // TODO(yunqingwang): central pointer error was already calculated in full-
-  // pixel search, and can be passed in this function.
-  comp_avg_pred(comp_pred, second_pred, w, h, y, y_stride);
-  besterr = vfp->vf(comp_pred, w, z, src_stride, sse1);
-  *distortion = besterr;
-  besterr += mv_err_cost(bestmv, ref_mv, mvjcost, mvcost, error_per_bit);
-
-  // Each subsequent iteration checks at least one point in
-  // common with the last iteration could be 2 ( if diag selected)
-  while (halfiters--) {
-    // 1/2 pel
-    FIRST_LEVEL_CHECKS;
-    // no reason to check the same one again.
-    if (tr == br && tc == bc)
-      break;
-    tr = br;
-    tc = bc;
-  }
-
-  // Each subsequent iteration checks at least one point in common with
-  // the last iteration could be 2 ( if diag selected) 1/4 pel
-
-  // Note forced_stop: 0 - full, 1 - qtr only, 2 - half only
-  if (forced_stop != 2) {
-    hstep >>= 1;
-    while (quarteriters--) {
-      FIRST_LEVEL_CHECKS;
-      // no reason to check the same one again.
-      if (tr == br && tc == bc)
-        break;
-      tr = br;
-      tc = bc;
-    }
-  }
-
-  if (allow_hp && vp9_use_mv_hp(ref_mv) && forced_stop == 0) {
-    hstep >>= 1;
-    while (eighthiters--) {
-      FIRST_LEVEL_CHECKS;
-      // no reason to check the same one again.
-      if (tr == br && tc == bc)
-        break;
-      tr = br;
-      tc = bc;
-    }
-  }
-  bestmv->row = br;
-  bestmv->col = bc;
-
-  if ((abs(bestmv->col - ref_mv->col) > (MAX_FULL_PEL_VAL << 3)) ||
-      (abs(bestmv->row - ref_mv->row) > (MAX_FULL_PEL_VAL << 3)))
-    return INT_MAX;
-
-  return besterr;
-}
 
 int vp9_find_best_sub_pixel_comp_tree(MACROBLOCK *x,
                                       MV *bestmv, const MV *ref_mv,
--- a/vp9/encoder/vp9_mcomp.h
+++ b/vp9/encoder/vp9_mcomp.h
@@ -84,7 +84,7 @@
     int *mvcost[2],
     int *distortion,
     unsigned int *sse);
-extern fractional_mv_step_fp vp9_find_best_sub_pixel_iterative;
+
 extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree;
 
 typedef int (fractional_mv_step_comp_fp) (
@@ -99,7 +99,7 @@
     int *distortion, unsigned int *sse1,
     const uint8_t *second_pred,
     int w, int h);
-extern fractional_mv_step_comp_fp vp9_find_best_sub_pixel_comp_iterative;
+
 extern fractional_mv_step_comp_fp vp9_find_best_sub_pixel_comp_tree;
 
 typedef int (*vp9_full_search_fn_t)(MACROBLOCK *x,
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -866,10 +866,7 @@
     cpi->mb.fwd_txm4x4 = vp9_fwht4x4;
   }
 
-  if (cpi->sf.subpel_search_method == SUBPEL_ITERATIVE) {
-    cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_iterative;
-    cpi->find_fractional_mv_step_comp = vp9_find_best_sub_pixel_comp_iterative;
-  } else if (cpi->sf.subpel_search_method == SUBPEL_TREE) {
+  if (cpi->sf.subpel_search_method == SUBPEL_TREE) {
     cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree;
     cpi->find_fractional_mv_step_comp = vp9_find_best_sub_pixel_comp_tree;
   }
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -216,8 +216,7 @@
 } MODE_SEARCH_SKIP_LOGIC;
 
 typedef enum {
-  SUBPEL_ITERATIVE = 0,
-  SUBPEL_TREE = 1,
+  SUBPEL_TREE = 0,
   // Other methods to come
 } SUBPEL_SEARCH_METHODS;