Skip to content
Snippets Groups Projects
Commit e5c236c2 authored by Yunqing Wang's avatar Yunqing Wang
Browse files

Adjust bounds checking for hex search in real-time mode

Currently, hex search couldn't guarantee the motion vector(MV)
found is within the limit of maximum MV. Therefore, very large
motion vectors resulted from big motion in the video could cause
encoding artifacts. This change adjusted hex search bounds
checking to make sure the resulted motion vector won't go out
of the range. James Berry, thank you for finding the bug.

Change-Id: If2c55edd9019e72444ad9b4b8688969eef610c55
parent 4ce6928d
No related branches found
No related tags found
No related merge requests found
......@@ -736,26 +736,26 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
//adjust search range according to sr from mv prediction
if(sr > step_param)
step_param = sr;
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;
// 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;
}else
{
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;
// 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;
further_steps = (cpi->Speed >= 8)? 0: (cpi->sf.max_step_search_steps - 1 - step_param);
if (cpi->sf.search_method == HEX)
......@@ -808,13 +808,10 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
}
}
if(cpi->sf.improved_mv_pred)
{
x->mv_col_min = tmp_col_min;
x->mv_col_max = tmp_col_max;
x->mv_row_min = tmp_row_min;
x->mv_row_max = tmp_row_max;
}
x->mv_col_min = tmp_col_min;
x->mv_col_max = tmp_col_max;
x->mv_row_min = tmp_row_min;
x->mv_row_max = tmp_row_max;
if (bestsme < INT_MAX)
cpi->find_fractional_mv_step(x, b, d, &d->bmi.mv, &best_ref_mv,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment