summaryrefslogtreecommitdiff
path: root/vp8/common/findnearmv.h
diff options
context:
space:
mode:
authorYaowu Xu <yaowu@google.com>2012-08-06 10:51:20 -0700
committerYaowu Xu <yaowu@google.com>2012-08-07 11:25:57 -0700
commit8b2f57d0b8da5a51e4579da6baa3e7bf4ea40b5b (patch)
treee6350cabc46cc6f01fd9c2db560c183c604908d4 /vp8/common/findnearmv.h
parent66f440f1ee6c993eff908da9c75cc2ae9de08775 (diff)
downloadlibvpx-8b2f57d0b8da5a51e4579da6baa3e7bf4ea40b5b.tar
libvpx-8b2f57d0b8da5a51e4579da6baa3e7bf4ea40b5b.tar.gz
libvpx-8b2f57d0b8da5a51e4579da6baa3e7bf4ea40b5b.tar.bz2
libvpx-8b2f57d0b8da5a51e4579da6baa3e7bf4ea40b5b.zip
a new way of determining reference motion vector
Using surrounding reconstructed pixels from left and above to select best matching mv to use as reference motion vector for mv encoding. Test results: AVGPSNR GLBPSNR VPXSSIM Derf: 1.107% 1.062% 0.992% Std-hd:1.209% 1.176% 1.029% Change-Id: I8f10e09ee6538c05df2fb9f069abcaf1edb3fca6
Diffstat (limited to 'vp8/common/findnearmv.h')
-rw-r--r--vp8/common/findnearmv.h47
1 files changed, 26 insertions, 21 deletions
diff --git a/vp8/common/findnearmv.h b/vp8/common/findnearmv.h
index d4769e608..3bb2024c2 100644
--- a/vp8/common/findnearmv.h
+++ b/vp8/common/findnearmv.h
@@ -33,20 +33,14 @@ static void mv_bias(int refmb_ref_frame_sign_bias, int refframe, int_mv *mvp, co
#define LEFT_TOP_MARGIN (16 << 3)
#define RIGHT_BOTTOM_MARGIN (16 << 3)
-static void vp8_clamp_mv2(int_mv *mv, const MACROBLOCKD *xd) {
- if (mv->as_mv.col < (xd->mb_to_left_edge - LEFT_TOP_MARGIN))
- mv->as_mv.col = xd->mb_to_left_edge - LEFT_TOP_MARGIN;
- else if (mv->as_mv.col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN)
- mv->as_mv.col = xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN;
-
- if (mv->as_mv.row < (xd->mb_to_top_edge - LEFT_TOP_MARGIN))
- mv->as_mv.row = xd->mb_to_top_edge - LEFT_TOP_MARGIN;
- else if (mv->as_mv.row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN)
- mv->as_mv.row = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN;
-}
-static void vp8_clamp_mv(int_mv *mv, int mb_to_left_edge, int mb_to_right_edge,
- int mb_to_top_edge, int mb_to_bottom_edge) {
+
+
+static void vp8_clamp_mv(int_mv *mv,
+ int mb_to_left_edge,
+ int mb_to_right_edge,
+ int mb_to_top_edge,
+ int mb_to_bottom_edge) {
mv->as_mv.col = (mv->as_mv.col < mb_to_left_edge) ?
mb_to_left_edge : mv->as_mv.col;
mv->as_mv.col = (mv->as_mv.col > mb_to_right_edge) ?
@@ -56,15 +50,26 @@ static void vp8_clamp_mv(int_mv *mv, int mb_to_left_edge, int mb_to_right_edge,
mv->as_mv.row = (mv->as_mv.row > mb_to_bottom_edge) ?
mb_to_bottom_edge : mv->as_mv.row;
}
-static unsigned int vp8_check_mv_bounds(int_mv *mv, int mb_to_left_edge,
- int mb_to_right_edge, int mb_to_top_edge,
+
+static void vp8_clamp_mv2(int_mv *mv, const MACROBLOCKD *xd) {
+ vp8_clamp_mv(mv,
+ xd->mb_to_left_edge - LEFT_TOP_MARGIN,
+ xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
+ xd->mb_to_top_edge - LEFT_TOP_MARGIN,
+ xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
+}
+
+
+
+static unsigned int vp8_check_mv_bounds(int_mv *mv,
+ int mb_to_left_edge,
+ int mb_to_right_edge,
+ int mb_to_top_edge,
int mb_to_bottom_edge) {
- unsigned int need_to_clamp;
- need_to_clamp = (mv->as_mv.col < mb_to_left_edge) ? 1 : 0;
- need_to_clamp |= (mv->as_mv.col > mb_to_right_edge) ? 1 : 0;
- need_to_clamp |= (mv->as_mv.row < mb_to_top_edge) ? 1 : 0;
- need_to_clamp |= (mv->as_mv.row > mb_to_bottom_edge) ? 1 : 0;
- return need_to_clamp;
+ return (mv->as_mv.col < mb_to_left_edge) ||
+ (mv->as_mv.col > mb_to_right_edge) ||
+ (mv->as_mv.row < mb_to_top_edge) ||
+ (mv->as_mv.row > mb_to_bottom_edge);
}
void vp8_find_near_mvs