summaryrefslogtreecommitdiff
path: root/vp8/encoder/firstpass.c
diff options
context:
space:
mode:
authorDeb Mukherjee <debargha@google.com>2012-02-27 10:22:38 -0800
committerDeb Mukherjee <debargha@google.com>2012-02-28 15:09:20 -0800
commit3e1cad9c69e9d89ecbed47ba187ccb5d48ae0a77 (patch)
treea66f0fd14f75bb0a8554a5ef5f9057f26f1caac5 /vp8/encoder/firstpass.c
parent3d93ae521c4bd71f3be833ab16d93fb35ab1f8d1 (diff)
downloadlibvpx-3e1cad9c69e9d89ecbed47ba187ccb5d48ae0a77.tar
libvpx-3e1cad9c69e9d89ecbed47ba187ccb5d48ae0a77.tar.gz
libvpx-3e1cad9c69e9d89ecbed47ba187ccb5d48ae0a77.tar.bz2
libvpx-3e1cad9c69e9d89ecbed47ba187ccb5d48ae0a77.zip
Initial refactoring of high_precision mv code.
This is the first patch for refactoring of the code related to high-precision mv, so that 1/4 and 1/8 pel motion vectors can co-exist in the same bit-stream by use of a frame level flag. The current patch works fine for only use of 1/4th and only use of 1/8th pel mv, but there are some issues with the mode switching in between. Subsequent patches on this change Id will fix the remaining issues. Patch 2: Adds fixes to make sure that multiple mv precisions can co-exist in the bit-stream. Frame level switching has been tested to work correctly. Patch 3: Fixes lines exceeding 80 char Patch 4: http://www.corp.google.com/~debargha/vp8_results/enhinterp.html Results on derf after ssse3 bugfix, compared to everything enabled but the 8-tap, 1/8-subpel and 1/16-subpel uv. Overall the gains are about 3% now. Hopefully there are no more bugs lingering. Apparently the sse3 bug affected the quartel subpel results more than the eighth pel ones (which is understandabale because one bad predictor due to the bug, matters less if there are a lot more subpel options available as in the 1/8 subpel case). The results in the 4th column correspond to the current settings. The first two columns correspond to two settings of adaptive switching of the 1/4 or 1/8 subpel mode based on initial Q estimate. These do not work as good as just using 1/8 all the time yet. Change-Id: I3ef392ad338329f4d68a85257a49f2b14f3af472
Diffstat (limited to 'vp8/encoder/firstpass.c')
-rw-r--r--vp8/encoder/firstpass.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c
index 7d9c38665..9cf875c4c 100644
--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -420,7 +420,12 @@ static void first_pass_motion_search(VP8_COMP *cpi, MACROBLOCK *x,
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 CONFIG_HIGH_PRECISION_MV
+ x->e_mbd.allow_high_precision_mv?x->mvcost_hp:x->mvcost,
+#else
+ x->mvcost,
+#endif
+ ref_mv);
if ( tmp_err < INT_MAX-new_mv_mode_penalty )
tmp_err += new_mv_mode_penalty;
@@ -445,7 +450,12 @@ static void first_pass_motion_search(VP8_COMP *cpi, MACROBLOCK *x,
{
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,
+ &num00, &v_fn_ptr,
+#if CONFIG_HIGH_PRECISION_MV
+ x->e_mbd.allow_high_precision_mv?x->mvcost_hp:x->mvcost,
+#else
+ x->mvcost,
+#endif
ref_mv);
if ( tmp_err < INT_MAX-new_mv_mode_penalty )
tmp_err += new_mv_mode_penalty;
@@ -520,6 +530,10 @@ void vp8_first_pass(VP8_COMP *cpi)
vp8_initialize_rd_consts(cpi, cm->base_qindex + cm->y1dc_delta_q);
vpx_memcpy(cm->fc.mvc, vp8_default_mv_context, sizeof(vp8_default_mv_context));
vp8_build_component_cost_table(cpi->mb.mvcost, (const MV_CONTEXT *) cm->fc.mvc, flag);
+#if CONFIG_HIGH_PRECISION_MV
+ vpx_memcpy(cm->fc.mvc_hp, vp8_default_mv_context_hp, sizeof(vp8_default_mv_context_hp));
+ vp8_build_component_cost_table_hp(cpi->mb.mvcost_hp, (const MV_CONTEXT_HP *) cm->fc.mvc_hp, flag);
+#endif
}
// for each macroblock row in image