av1/encoder/mcomp.c
// Runs an limited range exhaustive mesh search using a pattern set
// according to the encode speed profile.
Runs an limited range exhaustive mesh search using a pattern set
according to the encode speed profile.
Runs an limited range exhaustive mesh search using a pattern set according to the encode speed profile .
static int full_pixel_exhaustive(
    const MACROBLOCK *x, const FULLPEL_MV start_mv, int sadpb, int *cost_list,
    const aom_variance_fn_ptr_t *fn_ptr, const MV *ref_mv, FULLPEL_MV *best_mv,
    FULLPEL_MV *second_best_mv,
    const struct MESH_PATTERN *const mesh_patterns) {
  FULLPEL_MV full_ref_mv = get_fullmv_from_mv(ref_mv);
  int bestsme;
  int i;
  int interval = mesh_patterns[0].interval;
  int range = mesh_patterns[0].range;
  int baseline_interval_divisor;
  *best_mv = start_mv;
  if ((range < MIN_RANGE) || (range > MAX_RANGE) || (interval < MIN_INTERVAL) ||
      (interval > range))
    return INT_MAX;
  baseline_interval_divisor = range / interval;
  range = AOMMAX(range, (5 * AOMMAX(abs(best_mv->row), abs(best_mv->col))) / 4);
  range = AOMMIN(range, MAX_RANGE);
  interval = AOMMAX(interval, range / baseline_interval_divisor);
  bestsme = exhuastive_mesh_search(x, &full_ref_mv, best_mv, second_best_mv,
                                   range, interval, sadpb, fn_ptr, *best_mv);
  if ((interval > MIN_INTERVAL) && (range > MIN_RANGE)) {
    for (i = 1; i < MAX_MESH_STEP; ++i) {
      bestsme = exhuastive_mesh_search(
          x, &full_ref_mv, best_mv, second_best_mv, mesh_patterns[i].range,
          mesh_patterns[i].interval, sadpb, fn_ptr, *best_mv);
      if (mesh_patterns[i].interval == 1) break;
    }
  }
  if (bestsme < INT_MAX)
    bestsme = av1_get_mvpred_var(x, best_mv, ref_mv, fn_ptr);
  if (cost_list) {
    if (USE_SAD_COSTLIST) {
      const int costlist_has_sad = 0;
      calc_int_sad_list(x, ref_mv, sadpb, fn_ptr, best_mv, cost_list,
                        costlist_has_sad);
    } else {
      calc_int_cost_list(x, ref_mv, fn_ptr, best_mv, cost_list);
    }
  }
  return bestsme;
}
static int full_pixel_exhaustive ( const MACROBLOCK * x , const FULLPEL_MV start_mv , int sadpb , int * cost_list , const aom_variance_fn_ptr_t * fn_ptr , const MV * ref_mv , FULLPEL_MV * best_mv , FULLPEL_MV * second_best_mv , const struct MESH_PATTERN * const mesh_patterns ) { FULLPEL_MV full_ref_mv = get_fullmv_from_mv ( ref_mv ) ; int bestsme ; int i ; int interval = mesh_patterns [ 0 ] . interval ; int range = mesh_patterns [ 0 ] . range ; int baseline_interval_divisor ; * best_mv = start_mv ; if ( ( range < MIN_RANGE ) || ( range > MAX_RANGE ) || ( interval < MIN_INTERVAL ) || ( interval > range ) ) return INT_MAX ; baseline_interval_divisor = range / interval ; range = AOMMAX ( range , ( 5 * AOMMAX ( abs ( best_mv -> row ) , abs ( best_mv -> col ) ) ) / 4 ) ; range = AOMMIN ( range , MAX_RANGE ) ; interval = AOMMAX ( interval , range / baseline_interval_divisor ) ; bestsme = exhuastive_mesh_search ( x , & full_ref_mv , best_mv , second_best_mv , range , interval , sadpb , fn_ptr , * best_mv ) ; if ( ( interval > MIN_INTERVAL ) && ( range > MIN_RANGE ) ) { for ( i = 1 ; i < MAX_MESH_STEP ; ++ i ) { bestsme = exhuastive_mesh_search ( x , & full_ref_mv , best_mv , second_best_mv , mesh_patterns [ i ] . range , mesh_patterns [ i ] . interval , sadpb , fn_ptr , * best_mv ) ; if ( mesh_patterns [ i ] . interval == 1 ) break ; } } if ( bestsme < INT_MAX ) bestsme = av1_get_mvpred_var ( x , best_mv , ref_mv , fn_ptr ) ; if ( cost_list ) { if ( USE_SAD_COSTLIST ) { const int costlist_has_sad = 0 ; calc_int_sad_list ( x , ref_mv , sadpb , fn_ptr , best_mv , cost_list , costlist_has_sad ) ; } else { calc_int_cost_list ( x , ref_mv , fn_ptr , best_mv , cost_list ) ; } } return bestsme ; }
Runs an limited range exhaustive mesh search using a pattern set
according to the encode speed profile.
Runs an limited range exhaustive mesh search using a pattern set according to the encode speed profile .
// Trap illegal values for interval and range for this function. // Check size of proposed first range against magnitude of the centre // value used as a starting point. // initial search // Progressive searches with range and step size decreasing each time // till we reach a step size of 1. Then break out. // First pass with coarser step and longer range // Return cost list.