Commit 06e4f825 authored by Jingning Han's avatar Jingning Han
Browse files

Fix an issue in motion vector prediction stage

The previous implementation stops motion vector prediction test when
the zero motion vector appears for the second time. This commit fixes
it by simply skipping the second time check on zero mv and continuing
on to next mv candidate.

It slightly improves stdhd in speed 2 by 0.06% on average. Most static
sequences are not affected. A few hard ones, like jet, ped, and riverbed
were improved by 0.1 - 0.2%.

Change-Id: Ia8d4e2ffb7136669e8ad1fb24ea6e8fdd6b9a3c1
parent 16f5607d
......@@ -585,7 +585,6 @@ static void set_rt_speed_feature(VP9_COMMON *cm,
SPEED_FEATURES *sf,
int speed) {
sf->static_segmentation = 0;
sf->use_avoid_tested_higherror = 1;
sf->adaptive_rd_thresh = 1;
sf->recode_loop = (speed < 1);
if (speed >= 1) {
......
......@@ -2119,16 +2119,20 @@ static void mv_pred(VP9_COMP *cpi, MACROBLOCK *x,
cpi->common.show_frame &&
block_size < cpi->sf.max_partition_size);
int_mv pred_mv[3] = {
mbmi->ref_mvs[ref_frame][0], mbmi->ref_mvs[ref_frame][1],
x->pred_mv[ref_frame]
};
// Get the sad for each candidate reference mv
for (i = 0; i < num_mv_refs; i++) {
this_mv.as_int = (i < MAX_MV_REF_CANDIDATES) ?
mbmi->ref_mvs[ref_frame][i].as_int : x->pred_mv[ref_frame].as_int;
this_mv.as_int = pred_mv[i].as_int;
max_mv = MAX(max_mv,
MAX(abs(this_mv.as_mv.row), abs(this_mv.as_mv.col)) >> 3);
// The list is at an end if we see 0 for a second time.
// only need to check zero mv once
if (!this_mv.as_int && zero_seen)
break;
continue;
zero_seen = zero_seen || !this_mv.as_int;
row_offset = this_mv.as_mv.row >> 3;
......@@ -2346,6 +2350,10 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
YV12_BUFFER_CONFIG *scaled_ref_frame = get_scaled_ref_frame(cpi, ref);
int_mv pred_mv[3] = {
mbmi->ref_mvs[ref][0], mbmi->ref_mvs[ref][1], x->pred_mv[ref]
};
if (scaled_ref_frame) {
int i;
// Swap out the reference frame for a version that's been scaled to
......@@ -2410,9 +2418,7 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
}
}
mvp_full = x->mv_best_ref_index[ref] < MAX_MV_REF_CANDIDATES
? mbmi->ref_mvs[ref][x->mv_best_ref_index[ref]].as_mv
: x->pred_mv[ref].as_mv;
mvp_full = pred_mv[x->mv_best_ref_index[ref]].as_mv;
mvp_full.col >>= 3;
mvp_full.row >>= 3;
......
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