Improve motion search in real-time mode
Applied better MV prediction in real-time mode, which improves the encoding quality. Used quarter-pixel search instead of iterative sub-pixel search for speed >=5 to improve encoding performance. Tests on the test set showed: 1. For speed=-5, quality improvement: 1.7% on AvgPSNR and 2.1% on SSIM, performance improvement: 3.6% (This counts in the performance lose caused by MV prediction calculation in "Improve MV prediction in vp8_pick_inter_mode() for speed>3"). 2. For speed=-8, quality improvement: 2.1% on AvgPSNR and 2.5% on SSIM. but, 6.9% performance decrease because of MV prediction calculation. This should be improved later. Change-Id: I349a96c452bd691081d8c8e3e54419e7f477bebd
This commit is contained in:
parent
eaadfb5869
commit
41e6eceb28
@ -779,15 +779,17 @@ int vp8_hex_search
|
|||||||
int *num00,
|
int *num00,
|
||||||
const vp8_variance_fn_ptr_t *vfp,
|
const vp8_variance_fn_ptr_t *vfp,
|
||||||
int *mvsadcost[2],
|
int *mvsadcost[2],
|
||||||
int *mvcost[2]
|
int *mvcost[2],
|
||||||
|
MV *center_mv
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MV hex[6] = { { -1, -2}, {1, -2}, {2, 0}, {1, 2}, { -1, 2}, { -2, 0} } ;
|
MV hex[6] = { { -1, -2}, {1, -2}, {2, 0}, {1, 2}, { -1, 2}, { -2, 0} } ;
|
||||||
MV neighbors[8] = { { -1, -1}, { -1, 0}, { -1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1} } ;
|
MV neighbors[8] = { { -1, -1}, {0, -1}, {1, -1}, { -1, 0}, {1, 0}, { -1, 1}, {0, 1}, {1, 1} } ;
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned char *src = (*(b->base_src) + b->src);
|
unsigned char *src = (*(b->base_src) + b->src);
|
||||||
int src_stride = b->src_stride;
|
int src_stride = b->src_stride;
|
||||||
int rr = ref_mv->row, rc = ref_mv->col, br = rr >> 3, bc = rc >> 3, tr, tc;
|
int rr = center_mv->row, rc = center_mv->col;
|
||||||
|
int br = ref_mv->row >> 3, bc = ref_mv->col >> 3, tr, tc;
|
||||||
unsigned int besterr, thiserr = 0x7fffffff;
|
unsigned int besterr, thiserr = 0x7fffffff;
|
||||||
int k = -1, tk;
|
int k = -1, tk;
|
||||||
|
|
||||||
@ -892,7 +894,7 @@ cal_neighbors:
|
|||||||
best_mv->row = br;
|
best_mv->row = br;
|
||||||
best_mv->col = bc;
|
best_mv->col = bc;
|
||||||
|
|
||||||
return vfp->vf(src, src_stride, PRE(br, bc), d->pre_stride, &thiserr) + MVC(br, bc) ;
|
return vfp->vf(src, src_stride, PRE(br, bc), d->pre_stride, &thiserr) + vp8_mv_err_cost(best_mv, center_mv, mvcost, error_per_bit) ;
|
||||||
}
|
}
|
||||||
#undef MVC
|
#undef MVC
|
||||||
#undef PRE
|
#undef PRE
|
||||||
|
@ -43,8 +43,8 @@ extern int vp8_hex_search
|
|||||||
int *num00,
|
int *num00,
|
||||||
const vp8_variance_fn_ptr_t *vf,
|
const vp8_variance_fn_ptr_t *vf,
|
||||||
int *mvsadcost[2],
|
int *mvsadcost[2],
|
||||||
int *mvcost[2]
|
int *mvcost[2],
|
||||||
|
MV *center_mv
|
||||||
);
|
);
|
||||||
|
|
||||||
typedef int (fractional_mv_step_fp)
|
typedef int (fractional_mv_step_fp)
|
||||||
|
@ -1118,6 +1118,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
|
|||||||
#else
|
#else
|
||||||
sf->search_method = DIAMOND;
|
sf->search_method = DIAMOND;
|
||||||
#endif
|
#endif
|
||||||
|
sf->iterative_sub_pixel = 0;
|
||||||
|
|
||||||
cpi->mode_check_freq[THR_V_PRED] = 4;
|
cpi->mode_check_freq[THR_V_PRED] = 4;
|
||||||
cpi->mode_check_freq[THR_H_PRED] = 4;
|
cpi->mode_check_freq[THR_H_PRED] = 4;
|
||||||
@ -1169,7 +1170,6 @@ void vp8_set_speed_features(VP8_COMP *cpi)
|
|||||||
int total_skip;
|
int total_skip;
|
||||||
|
|
||||||
int min = 2000;
|
int min = 2000;
|
||||||
sf->iterative_sub_pixel = 0;
|
|
||||||
|
|
||||||
if (cpi->oxcf.encode_breakout > 2000)
|
if (cpi->oxcf.encode_breakout > 2000)
|
||||||
min = cpi->oxcf.encode_breakout;
|
min = cpi->oxcf.encode_breakout;
|
||||||
|
@ -718,7 +718,7 @@ int vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rec
|
|||||||
|
|
||||||
if (cpi->sf.search_method == HEX)
|
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].row = d->bmi.mv.as_mv.row;
|
||||||
mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;
|
mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;
|
||||||
}
|
}
|
||||||
|
@ -1139,7 +1139,7 @@ void vp8_rd_check_segment(VP8_COMP *cpi, MACROBLOCK *x, BEST_SEG_INFO *bsi,
|
|||||||
|
|
||||||
if (cpi->sf.search_method == HEX)
|
if (cpi->sf.search_method == HEX)
|
||||||
bestsme = vp8_hex_search(x, c, e, bsi->ref_mv,
|
bestsme = vp8_hex_search(x, c, e, bsi->ref_mv,
|
||||||
&mode_mv[NEW4X4], step_param, sadpb, &num00, v_fn_ptr, x->mvsadcost, x->mvcost);
|
&mode_mv[NEW4X4], step_param, sadpb, &num00, v_fn_ptr, x->mvsadcost, x->mvcost, bsi->ref_mv);
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2068,7 +2068,7 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
|
|||||||
|
|
||||||
if (cpi->sf.search_method == HEX)
|
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, &best_ref_mv, &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].row = d->bmi.mv.as_mv.row;
|
||||||
mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;
|
mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ static int vp8_temporal_filter_find_matching_mb_c
|
|||||||
step_param,
|
step_param,
|
||||||
sadpb/*x->errorperbit*/,
|
sadpb/*x->errorperbit*/,
|
||||||
&num00, &cpi->fn_ptr[BLOCK_16X16],
|
&num00, &cpi->fn_ptr[BLOCK_16X16],
|
||||||
mvsadcost, mvcost);
|
mvsadcost, mvcost, &best_ref_mv1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user