diff options
Diffstat (limited to 'vp8/encoder/pickinter.c')
-rw-r--r-- | vp8/encoder/pickinter.c | 60 |
1 files changed, 38 insertions, 22 deletions
diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c index 487126d40..6ab85adbc 100644 --- a/vp8/encoder/pickinter.c +++ b/vp8/encoder/pickinter.c @@ -608,7 +608,7 @@ int vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rec continue; } - if(x->e_mbd.mode_info_context->mbmi.mode == NEWMV) + if(cpi->sf.improved_mv_pred && x->e_mbd.mode_info_context->mbmi.mode == NEWMV) { if(!saddone) { @@ -685,40 +685,53 @@ int vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rec int n = 0; int sadpb = x->sadperbit16; - int col_min = (best_ref_mv.col - MAX_FULL_PEL_VAL) >>3; - int col_max = (best_ref_mv.col + MAX_FULL_PEL_VAL) >>3; - int row_min = (best_ref_mv.row - MAX_FULL_PEL_VAL) >>3; - int row_max = (best_ref_mv.row + MAX_FULL_PEL_VAL) >>3; + int col_min; + int col_max; + int row_min; + int row_max; 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; - // 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 speed_adjust = (cpi->Speed > 5) ? ((cpi->Speed >= 8)? 3 : 2) : 1; // Further step/diamond searches as necessary + step_param = cpi->sf.first_step + speed_adjust; + + if(cpi->sf.improved_mv_pred) { - int speed_adjust = (cpi->Speed > 5) ? ((cpi->Speed >= 8)? 3 : 2) : 1; - step_param = cpi->sf.first_step + speed_adjust; sr += speed_adjust; //adjust search range according to sr from mv prediction if(sr > step_param) step_param = sr; - further_steps = (cpi->Speed >= 8)? 0: (cpi->sf.max_step_search_steps - 1 - step_param); + + col_min = (best_ref_mv.col - MAX_FULL_PEL_VAL) >>3; + col_max = (best_ref_mv.col + MAX_FULL_PEL_VAL) >>3; + row_min = (best_ref_mv.row - MAX_FULL_PEL_VAL) >>3; + row_max = (best_ref_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.row = best_ref_mv.row; + mvp.col = best_ref_mv.col; } + further_steps = (cpi->Speed >= 8)? 0: (cpi->sf.max_step_search_steps - 1 - step_param); + if (cpi->sf.search_method == HEX) { - bestsme = vp8_hex_search(x, b, d, &best_ref_mv, &d->bmi.mv.as_mv, step_param, sadpb/*x->errorperbit*/, &num00, &cpi->fn_ptr[BLOCK_16X16], x->mvsadcost, x->mvcost); + bestsme = vp8_hex_search(x, b, d, &mvp, &d->bmi.mv.as_mv, step_param, sadpb/*x->errorperbit*/, &num00, &cpi->fn_ptr[BLOCK_16X16], x->mvsadcost, x->mvcost, &best_ref_mv); mode_mv[NEWMV].row = d->bmi.mv.as_mv.row; mode_mv[NEWMV].col = d->bmi.mv.as_mv.col; } @@ -760,10 +773,13 @@ int vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rec } } - 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(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; + } if (bestsme < INT_MAX) cpi->find_fractional_mv_step(x, b, d, &d->bmi.mv.as_mv, &best_ref_mv, x->errorperbit, &cpi->fn_ptr[BLOCK_16X16], cpi->mb.mvcost); |