Commit 1099f368 authored by Daniel Kang's avatar Daniel Kang Committed by Gerrit Code Review
Browse files

clamp_mv_min_max -> vp8_clamp_mv_min_max

It's now used in more places

Change-Id: I63f8e1d827404e0b4f203bdb1df361e565d0779d
parent a513af4b
......@@ -38,10 +38,6 @@ static unsigned int do_16x16_motion_iteration
int *mvcost_hp[2] = { &dummy_cost_hp[mv_max_hp + 1], &dummy_cost_hp[mv_max_hp + 1] };
int *mvsadcost_hp[2] = { &dummy_cost_hp[mv_max_hp + 1], &dummy_cost_hp[mv_max_hp + 1] };
int col_min = (ref_mv->as_mv.col >> 3) - MAX_FULL_PEL_VAL + ((ref_mv->as_mv.col & 7) ? 1 : 0);
int row_min = (ref_mv->as_mv.row >> 3) - MAX_FULL_PEL_VAL + ((ref_mv->as_mv.row & 7) ? 1 : 0);
int col_max = (ref_mv->as_mv.col >> 3) + MAX_FULL_PEL_VAL;
int row_max = (ref_mv->as_mv.row >> 3) + MAX_FULL_PEL_VAL;
int tmp_col_min = x->mv_col_min;
int tmp_col_max = x->mv_col_max;
int tmp_row_min = x->mv_row_min;
......@@ -57,15 +53,7 @@ static unsigned int do_16x16_motion_iteration
further_steps = 0;
}
/* Get intersection of UMV window and valid MV window to reduce # of checks in diamond search. */
if (x->mv_col_min < col_min)
x->mv_col_min = col_min;
if (x->mv_col_max > col_max)
x->mv_col_max = col_max;
if (x->mv_row_min < row_min)
x->mv_row_min = row_min;
if (x->mv_row_max > row_max)
x->mv_row_max = row_max;
vp8_clamp_mv_min_max(x, ref_mv);
ref_full.as_mv.col = ref_mv->as_mv.col >> 3;
ref_full.as_mv.row = ref_mv->as_mv.row >> 3;
......
......@@ -9,6 +9,7 @@
*/
#include "vp8/encoder/onyx_int.h"
#include "mcomp.h"
#include "vpx_mem/vpx_mem.h"
#include "vpx_ports/config.h"
......@@ -22,6 +23,25 @@ static int mv_ref_ct [31] [4] [2];
static int mv_mode_cts [4] [2];
#endif
void vp8_clamp_mv_min_max(MACROBLOCK *x, int_mv *ref_mv) {
int col_min = (ref_mv->as_mv.col >> 3) - MAX_FULL_PEL_VAL +
((ref_mv->as_mv.col & 7) ? 1 : 0);
int row_min = (ref_mv->as_mv.row >> 3) - MAX_FULL_PEL_VAL +
((ref_mv->as_mv.row & 7) ? 1 : 0);
int col_max = (ref_mv->as_mv.col >> 3) + MAX_FULL_PEL_VAL;
int row_max = (ref_mv->as_mv.row >> 3) + MAX_FULL_PEL_VAL;
/* Get intersection of UMV window and valid MV window to reduce # of checks in diamond search. */
if (x->mv_col_min < col_min)
x->mv_col_min = col_min;
if (x->mv_col_max > col_max)
x->mv_col_max = col_max;
if (x->mv_row_min < row_min)
x->mv_row_min = row_min;
if (x->mv_row_max > row_max)
x->mv_row_max = row_max;
}
int vp8_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvcost[2],
int Weight, int ishp) {
// MV costing is based on the distribution of vectors in the previous frame
......
......@@ -25,6 +25,7 @@ extern void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]);
#define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS)) - 1) // Max full pel mv specified in 1 pel units
#define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS-1)) // Maximum size of the first step in full pel units
extern void vp8_clamp_mv_min_max(MACROBLOCK *x, int_mv *ref_mv);
extern int vp8_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvcost[2],
int Weight, int ishp);
extern void vp8_init_dsmotion_compensation(MACROBLOCK *x, int stride);
......
......@@ -2017,23 +2017,6 @@ void vp8_cal_step_param(int sr, int *sp) {
*sp = MAX_MVSEARCH_STEPS - 1 - step;
}
static void clamp_mv_min_max(MACROBLOCK *x, int_mv *best_ref_mv) {
int col_min = (best_ref_mv->as_mv.col >> 3) - MAX_FULL_PEL_VAL + ((best_ref_mv->as_mv.col & 7) ? 1 : 0);
int row_min = (best_ref_mv->as_mv.row >> 3) - MAX_FULL_PEL_VAL + ((best_ref_mv->as_mv.row & 7) ? 1 : 0);
int col_max = (best_ref_mv->as_mv.col >> 3) + MAX_FULL_PEL_VAL;
int row_max = (best_ref_mv->as_mv.row >> 3) + MAX_FULL_PEL_VAL;
/* Get intersection of UMV window and valid MV window to reduce # of checks in diamond search. */
if (x->mv_col_min < col_min)
x->mv_col_min = col_min;
if (x->mv_col_max > col_max)
x->mv_col_max = col_max;
if (x->mv_row_min < row_min)
x->mv_row_min = row_min;
if (x->mv_row_max > row_max)
x->mv_row_max = row_max;
}
static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x,
int_mv *best_ref_mv, int_mv *second_best_ref_mv, int64_t best_rd,
int *mdcounts, int *returntotrate,
......@@ -2074,7 +2057,7 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x,
int tmp_row_min = x->mv_row_min;
int tmp_row_max = x->mv_row_max;
clamp_mv_min_max(x, best_ref_mv);
vp8_clamp_mv_min_max(x, best_ref_mv);
/* Get 8x8 result */
bsi.sv_mvp[0].as_int = bsi.mvs[0].as_int;
......@@ -3139,7 +3122,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
int tmp_row_min = x->mv_row_min;
int tmp_row_max = x->mv_row_max;
clamp_mv_min_max(x, &best_ref_mv);
vp8_clamp_mv_min_max(x, &best_ref_mv);
if (!saddone) {
vp8_cal_sad(cpi, xd, x, recon_yoffset, &near_sadidx[0]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment