Commit 80c3bbf6 authored by Yunqing Wang's avatar Yunqing Wang Committed by Code Review
Browse files

Merge "Bug fix in motion vector limit calculation"

parents 3e4a80cc b7480454
......@@ -286,8 +286,8 @@ int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
bestmv->as_mv.row = br << 1;
bestmv->as_mv.col = bc << 1;
if ((abs(bestmv->as_mv.col - ref_mv->as_mv.col) > MAX_FULL_PEL_VAL) ||
(abs(bestmv->as_mv.row - ref_mv->as_mv.row) > MAX_FULL_PEL_VAL))
if ((abs(bestmv->as_mv.col - ref_mv->as_mv.col) > (MAX_FULL_PEL_VAL<<3)) ||
(abs(bestmv->as_mv.row - ref_mv->as_mv.row) > (MAX_FULL_PEL_VAL<<3)))
return INT_MAX;
return besterr;
......
......@@ -22,7 +22,7 @@ extern void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]);
#define MAX_MVSEARCH_STEPS 8 // The maximum number of steps in a step search given the largest allowed initial step
#define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS+3)) - 8) // Max full pel mv specified in 1/8 pel units
#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 print_mode_context(void);
......
......@@ -588,10 +588,10 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
/* adjust mvp to make sure it is within MV range */
vp8_clamp_mv(&mvp,
best_ref_mv.as_mv.col - MAX_FULL_PEL_VAL,
best_ref_mv.as_mv.col + MAX_FULL_PEL_VAL,
best_ref_mv.as_mv.row - MAX_FULL_PEL_VAL,
best_ref_mv.as_mv.row + MAX_FULL_PEL_VAL);
best_ref_mv.as_mv.col - (MAX_FULL_PEL_VAL<<3),
best_ref_mv.as_mv.col + (MAX_FULL_PEL_VAL<<3),
best_ref_mv.as_mv.row - (MAX_FULL_PEL_VAL<<3),
best_ref_mv.as_mv.row + (MAX_FULL_PEL_VAL<<3));
}
switch (this_mode)
......@@ -681,10 +681,14 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
mvp.as_int = best_ref_mv.as_int;
}
col_min = (best_ref_mv.as_mv.col - MAX_FULL_PEL_VAL) >>3;
col_max = (best_ref_mv.as_mv.col + MAX_FULL_PEL_VAL) >>3;
row_min = (best_ref_mv.as_mv.row - MAX_FULL_PEL_VAL) >>3;
row_max = (best_ref_mv.as_mv.row + MAX_FULL_PEL_VAL) >>3;
col_min = (best_ref_mv.as_mv.col < 0)?(-((abs(best_ref_mv.as_mv.col))>>3) - MAX_FULL_PEL_VAL)
:((best_ref_mv.as_mv.col>>3) - MAX_FULL_PEL_VAL);
col_max = (best_ref_mv.as_mv.col < 0)?(-((abs(best_ref_mv.as_mv.col))>>3) + MAX_FULL_PEL_VAL)
:((best_ref_mv.as_mv.col>>3) + MAX_FULL_PEL_VAL);
row_min = (best_ref_mv.as_mv.row < 0)?(-((abs(best_ref_mv.as_mv.row))>>3) - MAX_FULL_PEL_VAL)
:((best_ref_mv.as_mv.row>>3) - MAX_FULL_PEL_VAL);
row_max = (best_ref_mv.as_mv.row < 0)?(-((abs(best_ref_mv.as_mv.row))>>3) + MAX_FULL_PEL_VAL)
:((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 )
......
......@@ -1330,10 +1330,14 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x,
if (bsi.segment_rd < best_rd)
{
int col_min = (best_ref_mv->as_mv.col - MAX_FULL_PEL_VAL) >>3;
int col_max = (best_ref_mv->as_mv.col + MAX_FULL_PEL_VAL) >>3;
int row_min = (best_ref_mv->as_mv.row - MAX_FULL_PEL_VAL) >>3;
int row_max = (best_ref_mv->as_mv.row + MAX_FULL_PEL_VAL) >>3;
int col_min = (best_ref_mv->as_mv.col < 0)?(-((abs(best_ref_mv->as_mv.col))>>3) - MAX_FULL_PEL_VAL)
:((best_ref_mv->as_mv.col>>3) - MAX_FULL_PEL_VAL);
int col_max = (best_ref_mv->as_mv.col < 0)?(-((abs(best_ref_mv->as_mv.col))>>3) + MAX_FULL_PEL_VAL)
:((best_ref_mv->as_mv.col>>3) + MAX_FULL_PEL_VAL);
int row_min = (best_ref_mv->as_mv.row < 0)?(-((abs(best_ref_mv->as_mv.row))>>3) - MAX_FULL_PEL_VAL)
:((best_ref_mv->as_mv.row>>3) - MAX_FULL_PEL_VAL);
int row_max = (best_ref_mv->as_mv.row < 0)?(-((abs(best_ref_mv->as_mv.row))>>3) + MAX_FULL_PEL_VAL)
:((best_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;
......@@ -1876,10 +1880,10 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
/* adjust mvp to make sure it is within MV range */
vp8_clamp_mv(&mvp,
best_ref_mv.as_mv.col - MAX_FULL_PEL_VAL,
best_ref_mv.as_mv.col + MAX_FULL_PEL_VAL,
best_ref_mv.as_mv.row - MAX_FULL_PEL_VAL,
best_ref_mv.as_mv.row + MAX_FULL_PEL_VAL);
best_ref_mv.as_mv.col - (MAX_FULL_PEL_VAL<<3),
best_ref_mv.as_mv.col + (MAX_FULL_PEL_VAL<<3),
best_ref_mv.as_mv.row - (MAX_FULL_PEL_VAL<<3),
best_ref_mv.as_mv.row + (MAX_FULL_PEL_VAL<<3));
}
// Check to see if the testing frequency for this mode is at its max
......@@ -2011,10 +2015,14 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
int sadpb = x->sadperbit16;
int col_min = (best_ref_mv.as_mv.col - MAX_FULL_PEL_VAL) >>3;
int col_max = (best_ref_mv.as_mv.col + MAX_FULL_PEL_VAL) >>3;
int row_min = (best_ref_mv.as_mv.row - MAX_FULL_PEL_VAL) >>3;
int row_max = (best_ref_mv.as_mv.row + MAX_FULL_PEL_VAL) >>3;
int col_min = (best_ref_mv.as_mv.col < 0)?(-((abs(best_ref_mv.as_mv.col))>>3) - MAX_FULL_PEL_VAL)
:((best_ref_mv.as_mv.col>>3) - MAX_FULL_PEL_VAL);
int col_max = (best_ref_mv.as_mv.col < 0)?(-((abs(best_ref_mv.as_mv.col))>>3) + MAX_FULL_PEL_VAL)
:((best_ref_mv.as_mv.col>>3) + MAX_FULL_PEL_VAL);
int row_min = (best_ref_mv.as_mv.row < 0)?(-((abs(best_ref_mv.as_mv.row))>>3) - MAX_FULL_PEL_VAL)
:((best_ref_mv.as_mv.row>>3) - MAX_FULL_PEL_VAL);
int row_max = (best_ref_mv.as_mv.row < 0)?(-((abs(best_ref_mv.as_mv.row))>>3) + MAX_FULL_PEL_VAL)
:((best_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;
......
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