int num00;
int_mv tmp_mv;
+ int_mv ref_mv_full;
int tmp_err;
int step_param = 3; //3; // Dont search over full range for first pass
// Initial step/diamond search centred on best mv
tmp_mv.as_int = 0;
- tmp_err = cpi->diamond_search_sad(x, b, d, ref_mv, &tmp_mv, step_param,
+ ref_mv_full.as_mv.col = ref_mv->as_mv.col>>3;
+ ref_mv_full.as_mv.row = ref_mv->as_mv.row>>3;
+ tmp_err = cpi->diamond_search_sad(x, b, d, &ref_mv_full, &tmp_mv, step_param,
x->sadperbit16, &num00, &v_fn_ptr,
x->mvcost, ref_mv);
if ( tmp_err < INT_MAX-new_mv_mode_penalty )
num00--;
else
{
- tmp_err = cpi->diamond_search_sad(x, b, d, ref_mv, &tmp_mv,
+ tmp_err = cpi->diamond_search_sad(x, b, d, &ref_mv_full, &tmp_mv,
step_param + n, x->sadperbit16,
&num00, &v_fn_ptr, x->mvcost,
ref_mv);
unsigned char *what = (*(b->base_src) + b->src);
int what_stride = b->src_stride;
int in_what_stride = d->pre_stride;
- int br = ref_mv->as_mv.row >> 3, bc = ref_mv->as_mv.col >> 3;
+ int br = ref_mv->as_mv.row, bc = ref_mv->as_mv.col;
int_mv this_mv;
unsigned int bestsad = 0x7fffffff;
unsigned int thissad;
int best_site = 0;
int last_site = 0;
- int ref_row = ref_mv->as_mv.row >> 3;
- int ref_col = ref_mv->as_mv.col >> 3;
+ int ref_row = ref_mv->as_mv.row;
+ int ref_col = ref_mv->as_mv.col;
int this_row_offset;
int this_col_offset;
search_site *ss;
int best_site = 0;
int last_site = 0;
- int ref_row = ref_mv->as_mv.row >> 3;
- int ref_col = ref_mv->as_mv.col >> 3;
+ int ref_row = ref_mv->as_mv.row;
+ int ref_col = ref_mv->as_mv.col;
int this_row_offset;
int this_col_offset;
search_site *ss;
vp8_mv_pred(cpi, &x->e_mbd, x->e_mbd.mode_info_context, &mvp,
x->e_mbd.mode_info_context->mbmi.ref_frame, cpi->common.ref_frame_sign_bias, &sr, &near_sadidx[0]);
-
- /* adjust mvp to make sure it is within MV range */
- vp8_clamp_mv(&mvp,
- 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)
int further_steps;
int n = 0;
int sadpb = x->sadperbit16;
+ int_mv mvp_full;
- int col_min;
- int col_max;
- int row_min;
- int row_max;
+ 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;
int tmp_col_min = x->mv_col_min;
int tmp_col_max = x->mv_col_max;
//adjust search range according to sr from mv prediction
if(sr > step_param)
step_param = sr;
+
+ mvp_full.as_mv.col = mvp.as_mv.col>>3;
+ mvp_full.as_mv.row = mvp.as_mv.row>>3;
+
+ /* adjust mvp to make sure it is within MV range */
+ vp8_clamp_mv(&mvp_full, col_min, col_max, row_min, row_max);
}else
{
mvp.as_int = best_ref_mv.as_int;
+ mvp_full.as_mv.col = best_ref_mv.as_mv.col>>3;
+ mvp_full.as_mv.row = best_ref_mv.as_mv.row>>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 )
x->mv_col_min = col_min;
if (cpi->sf.search_method == HEX)
{
- bestsme = vp8_hex_search(x, b, d, &mvp, &d->bmi.mv, step_param,
+ bestsme = vp8_hex_search(x, b, d, &mvp_full, &d->bmi.mv, step_param,
sadpb, &cpi->fn_ptr[BLOCK_16X16],
x->mvsadcost, x->mvcost, &best_ref_mv);
mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
}
else
{
- bestsme = cpi->diamond_search_sad(x, b, d, &mvp, &d->bmi.mv,
+ bestsme = cpi->diamond_search_sad(x, b, d, &mvp_full, &d->bmi.mv,
step_param, sadpb, &num00,
&cpi->fn_ptr[BLOCK_16X16],
x->mvcost, &best_ref_mv);
else
{
thissme =
- cpi->diamond_search_sad(x, b, d, &mvp,
+ cpi->diamond_search_sad(x, b, d, &mvp_full,
&d->bmi.mv,
step_param + n,
sadpb, &num00,
{
int sadpb = x->sadperbit4;
+ int_mv mvp_full;
+
+ mvp_full.as_mv.row = bsi->mvp.as_mv.row >>3;
+ mvp_full.as_mv.col = bsi->mvp.as_mv.col >>3;
// find first label
n = vp8_mbsplit_offset[segmentation][i];
e = &x->e_mbd.block[n];
{
- bestsme = cpi->diamond_search_sad(x, c, e, &bsi->mvp,
+ bestsme = cpi->diamond_search_sad(x, c, e, &mvp_full,
&mode_mv[NEW4X4], step_param,
sadpb, &num00, v_fn_ptr,
x->mvcost, bsi->ref_mv);
else
{
thissme = cpi->diamond_search_sad(x, c, e,
- &bsi->mvp, &temp_mv,
+ &mvp_full, &temp_mv,
step_param + n, sadpb,
&num00, v_fn_ptr,
x->mvcost, bsi->ref_mv);
// Should we do a full search (best quality only)
if ((cpi->compressor_speed == 0) && (bestsme >> sseshift) > 4000)
{
- int_mv full_mvp;
-
- full_mvp.as_mv.row = bsi->mvp.as_mv.row >>3;
- full_mvp.as_mv.col = bsi->mvp.as_mv.col >>3;
-
- thissme = cpi->full_search_sad(x, c, e, &full_mvp,
+ thissme = cpi->full_search_sad(x, c, e, &mvp_full,
sadpb, 16, v_fn_ptr,
x->mvcost, bsi->ref_mv);
if (bsi.segment_rd < best_rd)
{
- 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 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;
int tmp_col_min = x->mv_col_min;
int tmp_col_max = x->mv_col_max;
vp8_mv_pred(cpi, &x->e_mbd, x->e_mbd.mode_info_context, &mvp,
x->e_mbd.mode_info_context->mbmi.ref_frame, cpi->common.ref_frame_sign_bias, &sr, &near_sadidx[0]);
-
- /* adjust mvp to make sure it is within MV range */
- vp8_clamp_mv(&mvp,
- 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
we will do a final 1-away diamond refining search */
int sadpb = x->sadperbit16;
+ int_mv mvp_full;
- 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 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;
int tmp_col_min = x->mv_col_min;
int tmp_col_max = x->mv_col_max;
int tmp_row_min = x->mv_row_min;
int tmp_row_max = x->mv_row_max;
+ mvp_full.as_mv.col = mvp.as_mv.col>>3;
+ mvp_full.as_mv.row = mvp.as_mv.row>>3;
+
+ /* adjust mvp to make sure it is within MV range */
+ vp8_clamp_mv(&mvp_full, col_min, col_max, row_min, row_max);
+
// 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;
// Initial step/diamond search
{
- bestsme = cpi->diamond_search_sad(x, b, d, &mvp, &d->bmi.mv,
+ bestsme = cpi->diamond_search_sad(x, b, d, &mvp_full, &d->bmi.mv,
step_param, sadpb, &num00,
&cpi->fn_ptr[BLOCK_16X16],
x->mvcost, &best_ref_mv);
num00--;
else
{
- thissme = cpi->diamond_search_sad(x, b, d, &mvp,
+ thissme = cpi->diamond_search_sad(x, b, d, &mvp_full,
&d->bmi.mv, step_param + n, sadpb, &num00,
&cpi->fn_ptr[BLOCK_16X16], x->mvcost,
&best_ref_mv);
BLOCK *b = &x->block[0];
BLOCKD *d = &x->e_mbd.block[0];
int_mv best_ref_mv1;
+ int_mv best_ref_mv1_full; /* full-pixel value of best_ref_mv1 */
int *mvcost[2] = { &dummy_cost[mv_max+1], &dummy_cost[mv_max+1] };
int *mvsadcost[2] = { &dummy_cost[mv_max+1], &dummy_cost[mv_max+1] };
int pre_stride = d->pre_stride;
best_ref_mv1.as_int = 0;
+ best_ref_mv1_full.as_mv.col = best_ref_mv1.as_mv.col >>3;
+ best_ref_mv1_full.as_mv.row = best_ref_mv1.as_mv.row >>3;
// Setup frame pointers
b->base_src = &arf_frame->y_buffer;
/*cpi->sf.search_method == HEX*/
// TODO Check that the 16x16 vf & sdf are selected here
bestsme = vp8_hex_search(x, b, d,
- &best_ref_mv1, &d->bmi.mv,
+ &best_ref_mv1_full, &d->bmi.mv,
step_param,
sadpb,
&cpi->fn_ptr[BLOCK_16X16],