summaryrefslogtreecommitdiff
path: root/vp8/encoder/rdopt.c
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2011-05-19 00:05:12 -0400
committerJohn Koleszar <jkoleszar@google.com>2011-05-19 00:05:12 -0400
commit23d525a5035a3e00cd2c2a65147e9c878c738014 (patch)
tree01c1579b61a36f21fb286175b0d6ae83bfce71cb /vp8/encoder/rdopt.c
parent790801a6d572115a775ae7ff221cc924e150020d (diff)
parent00a1e2f8e4878f59c95f017f4cdbc80ada07a487 (diff)
downloadlibvpx-23d525a5035a3e00cd2c2a65147e9c878c738014.tar
libvpx-23d525a5035a3e00cd2c2a65147e9c878c738014.tar.gz
libvpx-23d525a5035a3e00cd2c2a65147e9c878c738014.tar.bz2
libvpx-23d525a5035a3e00cd2c2a65147e9c878c738014.zip
Merge remote branch 'internal/upstream' into HEAD
Diffstat (limited to 'vp8/encoder/rdopt.c')
-rw-r--r--vp8/encoder/rdopt.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index a077cea74..aa8202b2e 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -1751,6 +1751,28 @@ void vp8_cal_sad(VP8_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x, int recon_yoffse
}
}
+static void vp8_rd_update_mvcount(VP8_COMP *cpi, MACROBLOCKD *xd, int_mv *best_ref_mv)
+{
+ int i;
+
+ if (xd->mode_info_context->mbmi.mode == SPLITMV)
+ {
+ for (i = 0; i < 16; i++)
+ {
+ if (xd->block[i].bmi.mode == NEW4X4)
+ {
+ cpi->MVcount[0][mv_max+((xd->block[i].bmi.mv.as_mv.row - best_ref_mv->as_mv.row) >> 1)]++;
+ cpi->MVcount[1][mv_max+((xd->block[i].bmi.mv.as_mv.col - best_ref_mv->as_mv.col) >> 1)]++;
+ }
+ }
+ }
+ else if (xd->mode_info_context->mbmi.mode == NEWMV)
+ {
+ cpi->MVcount[0][mv_max+((xd->block[0].bmi.mv.as_mv.row - best_ref_mv->as_mv.row) >> 1)]++;
+ cpi->MVcount[1][mv_max+((xd->block[0].bmi.mv.as_mv.col - best_ref_mv->as_mv.col) >> 1)]++;
+ }
+}
+
void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int recon_uvoffset, int *returnrate, int *returndistortion, int *returnintra)
{
BLOCK *b = &x->block[0];
@@ -1943,10 +1965,10 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
/* adjust mvp to make sure it is within MV range */
vp8_clamp_mv(&mvp,
- best_ref_mv.as_mv.row - MAX_FULL_PEL_VAL,
- best_ref_mv.as_mv.row + MAX_FULL_PEL_VAL,
best_ref_mv.as_mv.col - MAX_FULL_PEL_VAL,
- best_ref_mv.as_mv.col + MAX_FULL_PEL_VAL);
+ best_ref_mv.as_mv.col + MAX_FULL_PEL_VAL,
+ best_ref_mv.as_mv.row - MAX_FULL_PEL_VAL,
+ best_ref_mv.as_mv.row + MAX_FULL_PEL_VAL);
}
// Check to see if the testing frequency for this mode is at its max
@@ -2465,4 +2487,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
}
x->e_mbd.mode_info_context->mbmi.mv.as_mv = x->e_mbd.block[15].bmi.mv.as_mv;
+
+ vp8_rd_update_mvcount(cpi, &x->e_mbd, &frame_best_ref_mv[xd->mode_info_context->mbmi.ref_frame]);
}