| Index: source/libvpx/vp9/encoder/vp9_mcomp.c
|
| diff --git a/source/libvpx/vp9/encoder/vp9_mcomp.c b/source/libvpx/vp9/encoder/vp9_mcomp.c
|
| index 0730467b0f32a5a43f2e090c848398a252312780..88c5ca0c3757b507bfae98f211ac151a948e3ef2 100644
|
| --- a/source/libvpx/vp9/encoder/vp9_mcomp.c
|
| +++ b/source/libvpx/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[4] = {
|
| + {-1, 0}, {0, -1}, {0, 1}, {1, 0},
|
| };
|
|
|
| unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x,
|
| @@ -1804,9 +1803,16 @@ 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;
|
| + unsigned int best_sad, tmp_sad, this_sad[4];
|
| MV this_mv;
|
|
|
| +#if CONFIG_VP9_HIGHBITDEPTH
|
| + tmp_mv->row = 0;
|
| + tmp_mv->col = 0;
|
| + return cpi->fn_ptr[bsize].sdf(x->plane[0].src.buf, src_stride,
|
| + xd->plane[0].pre[0].buf, ref_stride);
|
| +#endif
|
| +
|
| // Set up prediction 1-D reference set
|
| ref_buf = xd->plane[0].pre[0].buf - (bw >> 1);
|
| for (idx = 0; idx < search_width; idx += 16) {
|
| @@ -1836,23 +1842,49 @@ 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;
|
| - for (idx = 0; idx < 9; ++idx) {
|
| - int this_sad;
|
| - 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;
|
| + src_buf = x->plane[0].src.buf;
|
| + 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);
|
| + }
|
| +
|
| + 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;
|
| tmp_mv->col = search_pos[idx].col + this_mv.col;
|
| }
|
| }
|
| +
|
| + if (this_sad[0] < this_sad[3])
|
| + this_mv.row -= 1;
|
| + else
|
| + this_mv.row += 1;
|
| +
|
| + if (this_sad[1] < this_sad[2])
|
| + 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;
|
|
|
|
|