summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kovalev <dkovalev@google.com>2014-03-26 15:40:41 -0700
committerDmitry Kovalev <dkovalev@google.com>2014-03-26 15:40:41 -0700
commit224d986858137412cd80e0f13e2468301671533f (patch)
tree0e8437b6c3722b75be48d566e6702e3cbf93bd74
parent38c2d37b9d46f501576ea8914d8d8df1e6099ab8 (diff)
downloadlibvpx-224d986858137412cd80e0f13e2468301671533f.tar
libvpx-224d986858137412cd80e0f13e2468301671533f.tar.gz
libvpx-224d986858137412cd80e0f13e2468301671533f.tar.bz2
libvpx-224d986858137412cd80e0f13e2468301671533f.zip
Cleaning up vp9_get_mvpred_{av_,}var() functions.
Change-Id: I0df8c2a6d9863f92ee406010f2daeb5e40627649
-rw-r--r--vp9/encoder/vp9_mcomp.c37
-rw-r--r--vp9/encoder/vp9_mcomp.h3
2 files changed, 16 insertions, 24 deletions
diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c
index e0299f07f..b42fd3883 100644
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -719,39 +719,32 @@ int vp9_get_mvpred_var(const MACROBLOCK *x,
const MV *best_mv, const MV *center_mv,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost) {
- unsigned int unused;
-
const MACROBLOCKD *const xd = &x->e_mbd;
- const uint8_t *what = x->plane[0].src.buf;
- const int what_stride = x->plane[0].src.stride;
- const int in_what_stride = xd->plane[0].pre[0].stride;
- const uint8_t *base_offset = xd->plane[0].pre[0].buf;
- const uint8_t *this_offset = &base_offset[best_mv->row * in_what_stride +
- best_mv->col];
+ const struct buf_2d *const what = &x->plane[0].src;
+ const struct buf_2d *const in_what = &xd->plane[0].pre[0];
const MV mv = {best_mv->row * 8, best_mv->col * 8};
- return vfp->vf(what, what_stride, this_offset, in_what_stride, &unused) +
+ unsigned int unused;
+
+ return vfp->vf(what->buf, what->stride,
+ get_buf_from_mv(in_what, best_mv), in_what->stride, &unused) +
(use_mvcost ? mv_err_cost(&mv, center_mv, x->nmvjointcost,
x->mvcost, x->errorperbit) : 0);
}
int vp9_get_mvpred_av_var(const MACROBLOCK *x,
- MV *best_mv,
- const MV *center_mv,
+ const MV *best_mv, const MV *center_mv,
const uint8_t *second_pred,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost) {
- unsigned int bestsad;
const MACROBLOCKD *const xd = &x->e_mbd;
- const uint8_t *what = x->plane[0].src.buf;
- const int what_stride = x->plane[0].src.stride;
- const int in_what_stride = xd->plane[0].pre[0].stride;
- const uint8_t *base_offset = xd->plane[0].pre[0].buf;
- const uint8_t *this_offset = base_offset + (best_mv->row * in_what_stride) +
- best_mv->col;
- const MV this_mv = {best_mv->row * 8, best_mv->col * 8};
- return vfp->svaf(this_offset, in_what_stride, 0, 0, what, what_stride,
- &bestsad, second_pred) +
- (use_mvcost ? mv_err_cost(&this_mv, center_mv, x->nmvjointcost,
+ const struct buf_2d *const what = &x->plane[0].src;
+ const struct buf_2d *const in_what = &xd->plane[0].pre[0];
+ const MV mv = {best_mv->row * 8, best_mv->col * 8};
+ unsigned int unused;
+
+ return vfp->svaf(get_buf_from_mv(in_what, best_mv), in_what->stride, 0, 0,
+ what->buf, what->stride, &unused, second_pred) +
+ (use_mvcost ? mv_err_cost(&mv, center_mv, x->nmvjointcost,
x->mvcost, x->errorperbit) : 0);
}
diff --git a/vp9/encoder/vp9_mcomp.h b/vp9/encoder/vp9_mcomp.h
index 917de75e6..f7b7c5e49 100644
--- a/vp9/encoder/vp9_mcomp.h
+++ b/vp9/encoder/vp9_mcomp.h
@@ -42,8 +42,7 @@ int vp9_get_mvpred_var(const MACROBLOCK *x,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost);
int vp9_get_mvpred_av_var(const MACROBLOCK *x,
- MV *best_mv,
- const MV *center_mv,
+ const MV *best_mv, const MV *center_mv,
const uint8_t *second_pred,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost);