summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunqing Wang <yunqingwang@google.com>2011-02-11 07:20:17 -0800
committerCode Review <code-review@webmproject.org>2011-02-11 07:20:17 -0800
commit353246bd6054a6ff4cceff8560d72607e2d7f32b (patch)
treeaa03788d0c63262367047e5974f9e3e83efb0319
parent4f8a16605822fec7f8553689da54fa97280fc439 (diff)
parent9d0b2cbbceaa672ec6307a6362cb041e8788c067 (diff)
downloadlibvpx-353246bd6054a6ff4cceff8560d72607e2d7f32b.tar
libvpx-353246bd6054a6ff4cceff8560d72607e2d7f32b.tar.gz
libvpx-353246bd6054a6ff4cceff8560d72607e2d7f32b.tar.bz2
libvpx-353246bd6054a6ff4cceff8560d72607e2d7f32b.zip
Merge "Add improved_mv_pred flag in real-time mode"
-rw-r--r--vp8/encoder/onyx_if.c2
-rw-r--r--vp8/encoder/onyx_int.h1
-rw-r--r--vp8/encoder/pickinter.c58
3 files changed, 40 insertions, 21 deletions
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 807cc8592..e73e41ee7 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -601,6 +601,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->first_step = 0;
sf->max_step_search_steps = MAX_MVSEARCH_STEPS;
+ sf->improved_mv_pred = 1;
cpi->do_full[0] = 0;
cpi->do_full[1] = 0;
@@ -1123,6 +1124,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_V_PRED] = INT_MAX;
sf->thresh_mult[THR_H_PRED] = INT_MAX;
+ sf->improved_mv_pred = 0;
}
if (Speed > 8)
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index 0289b4a45..d6e494282 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -185,6 +185,7 @@ typedef struct
int use_fastquant_for_pick;
int no_skip_block4x4_search;
+ int improved_mv_pred;
} SPEED_FEATURES;
diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c
index 0bfcd38a6..1a58257a3 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,37 +685,50 @@ 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, &mvp, &d->bmi.mv.as_mv, step_param, sadpb/*x->errorperbit*/, &num00, &cpi->fn_ptr[BLOCK_16X16], x->mvsadcost, x->mvcost, &best_ref_mv);
@@ -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);