summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
authorJingning Han <jingning@google.com>2015-03-13 09:55:52 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2015-03-13 09:55:52 -0700
commit1b3499ae8b4c9db3a15f59ca3961e54efa30bd26 (patch)
treefcf25ede81bf8410d2dd7f66fa692a6ace35ffa6 /vp9/encoder
parentb6749aa3a70d12796dbcbc14682050633299392b (diff)
parent427cdf0a41988320c721462d02884a6a4f19aee4 (diff)
downloadlibvpx-1b3499ae8b4c9db3a15f59ca3961e54efa30bd26.tar
libvpx-1b3499ae8b4c9db3a15f59ca3961e54efa30bd26.tar.gz
libvpx-1b3499ae8b4c9db3a15f59ca3961e54efa30bd26.tar.bz2
libvpx-1b3499ae8b4c9db3a15f59ca3961e54efa30bd26.zip
Merge "Reduce the number of full block SAD calls"
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_mcomp.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c
index 12882e432..3136790d6 100644
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -1783,9 +1783,8 @@ static int vector_match(int16_t *ref, int16_t *src, int bwl) {
return (center - (bw >> 1));
}
-static const MV search_pos[9] = {
- {-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 0}, {0, 1},
- {1, -1}, {1, 0}, {1, 1},
+static const MV search_pos[5] = {
+ {-1, 0}, {0, -1}, {0, 0}, {0, 1}, {1, 0},
};
unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x,
@@ -1804,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;
+ int best_sad, tmp_sad, this_sad[5];
MV this_mv;
#if CONFIG_VP9_HIGHBITDEPTH
@@ -1845,21 +1844,40 @@ unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x,
best_sad = INT_MAX;
this_mv = *tmp_mv;
- for (idx = 0; idx < 9; ++idx) {
- int this_sad;
+ for (idx = 0; idx < 5; ++idx) {
src_buf = x->plane[0].src.buf;
ref_buf = xd->plane[0].pre[0].buf +
(search_pos[idx].row + this_mv.row) * ref_stride +
(search_pos[idx].col + this_mv.col);
- this_sad = cpi->fn_ptr[bsize].sdf(src_buf, src_stride,
- ref_buf, ref_stride);
- if (this_sad < best_sad) {
- best_sad = this_sad;
+ this_sad[idx] = cpi->fn_ptr[bsize].sdf(src_buf, src_stride,
+ ref_buf, ref_stride);
+ if (this_sad[idx] < best_sad) {
+ best_sad = this_sad[idx];
tmp_mv->row = search_pos[idx].row + this_mv.row;
tmp_mv->col = search_pos[idx].col + this_mv.col;
}
}
+
+ if (this_sad[0] < this_sad[4])
+ this_mv.row -= 1;
+ else
+ this_mv.row += 1;
+
+ if (this_sad[1] < this_sad[3])
+ this_mv.col -= 1;
+ else
+ this_mv.col += 1;
+
+ ref_buf = xd->plane[0].pre[0].buf + this_mv.row * ref_stride + this_mv.col;
+
+ tmp_sad = cpi->fn_ptr[bsize].sdf(src_buf, src_stride,
+ ref_buf, ref_stride);
+ if (best_sad > tmp_sad) {
+ *tmp_mv = this_mv;
+ best_sad = tmp_sad;
+ }
+
tmp_mv->row *= 8;
tmp_mv->col *= 8;