summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
authorJingning Han <jingning@google.com>2015-03-13 12:57:49 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2015-03-13 12:57:49 -0700
commit6cceed09cf5480394621bb93fd1faf1e51092650 (patch)
tree8d44b6026b700cbf22c08d26628c445874cf45f9 /vp9/encoder
parentdeaf661f4548fe29c322801e169bfcfb14f4997a (diff)
parentcce7020f2ce5bb8e4d493705d83c0dfa1f678309 (diff)
downloadlibvpx-6cceed09cf5480394621bb93fd1faf1e51092650.tar
libvpx-6cceed09cf5480394621bb93fd1faf1e51092650.tar.gz
libvpx-6cceed09cf5480394621bb93fd1faf1e51092650.tar.bz2
libvpx-6cceed09cf5480394621bb93fd1faf1e51092650.zip
Merge "Use sdx4df to do 1-step refinement"
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_mcomp.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c
index eb01bb279..0d833ffc2 100644
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -1803,7 +1803,7 @@ unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x,
const int ref_stride = xd->plane[0].pre[0].stride;
uint8_t const *ref_buf, *src_buf;
MV *tmp_mv = &xd->mi[0].src_mi->mbmi.mv[0].as_mv;
- int best_sad, tmp_sad, this_sad[5];
+ unsigned int best_sad, tmp_sad, this_sad[4];
MV this_mv;
#if CONFIG_VP9_HIGHBITDEPTH
@@ -1842,16 +1842,23 @@ unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x,
tmp_mv->col = vector_match(hbuf, src_hbuf, b_width_log2_lookup[bsize]);
tmp_mv->row = vector_match(vbuf, src_vbuf, b_height_log2_lookup[bsize]);
- best_sad = INT_MAX;
this_mv = *tmp_mv;
src_buf = x->plane[0].src.buf;
- for (idx = 0; idx < 5; ++idx) {
- ref_buf = xd->plane[0].pre[0].buf +
- (search_pos[idx].row + this_mv.row) * ref_stride +
- (search_pos[idx].col + this_mv.col);
+ ref_buf = xd->plane[0].pre[0].buf + this_mv.row * ref_stride + this_mv.col;
+ best_sad = cpi->fn_ptr[bsize].sdf(src_buf, src_stride, ref_buf, ref_stride);
+
+ {
+ const uint8_t * const pos[4] = {
+ ref_buf - ref_stride,
+ ref_buf - 1,
+ ref_buf + 1,
+ ref_buf + ref_stride,
+ };
+
+ cpi->fn_ptr[bsize].sdx4df(src_buf, src_stride, pos, ref_stride, this_sad);
+ }
- this_sad[idx] = cpi->fn_ptr[bsize].sdf(src_buf, src_stride,
- ref_buf, ref_stride);
+ for (idx = 0; idx < 4; ++idx) {
if (this_sad[idx] < best_sad) {
best_sad = this_sad[idx];
tmp_mv->row = search_pos[idx].row + this_mv.row;
@@ -1859,12 +1866,12 @@ unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x,
}
}
- if (this_sad[0] < this_sad[4])
+ if (this_sad[0] < this_sad[3])
this_mv.row -= 1;
else
this_mv.row += 1;
- if (this_sad[1] < this_sad[3])
+ if (this_sad[1] < this_sad[2])
this_mv.col -= 1;
else
this_mv.col += 1;