From b987bc36af383a06976164ab32c233e2c769018d Mon Sep 17 00:00:00 2001 From: Yunqing Wang Date: Mon, 23 Jan 2017 16:57:34 -0800 Subject: [PATCH] Remove marco MVC in mcomp.c Removed MVC so that mv_err_cost() is always called while calculating the mv cost. Change-Id: I28123e05fbfc2352128e266c985d2ab093940071 --- vp9/encoder/vp9_mcomp.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c index 70deda842..59b90be14 100644 --- a/vp9/encoder/vp9_mcomp.c +++ b/vp9/encoder/vp9_mcomp.c @@ -138,17 +138,6 @@ void vp9_init3smotion_compensation(search_site_config *cfg, int stride) { cfg->total_steps = ss_count / cfg->searches_per_step; } -/* Estimated (square) error cost of a motion vector (r,c). The 14 scale comes - * from the same math as in mv_err_cost(). */ -#define MVC(r, c) \ - (mvcost \ - ? ((unsigned)(mvjcost[((r) != rr) * 2 + ((c) != rc)] + \ - mvcost[0][((r)-rr)] + mvcost[1][((c)-rc)]) * \ - error_per_bit + \ - 8192) >> \ - 14 \ - : 0) - // convert motion vector component to offset for sv[a]f calc static INLINE int sp(int x) { return x & 7; } @@ -161,6 +150,8 @@ static INLINE const uint8_t *pre(const uint8_t *buf, int stride, int r, int c) { #define CHECK_BETTER(v, r, c) \ if (c >= minc && c <= maxc && r >= minr && r <= maxr) { \ int64_t tmpmse; \ + const MV mv = { r, c }; \ + const MV ref_mv = { rr, rc }; \ if (second_pred == NULL) { \ thismse = vfp->svf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), z, \ src_stride, &sse); \ @@ -169,7 +160,7 @@ static INLINE const uint8_t *pre(const uint8_t *buf, int stride, int r, int c) { src_stride, &sse, second_pred); \ } \ tmpmse = thismse; \ - tmpmse += MVC(r, c); \ + tmpmse += mv_err_cost(&mv, &ref_mv, mvjcost, mvcost, error_per_bit); \ if (tmpmse >= INT_MAX) { \ v = INT_MAX; \ } else if ((v = (uint32_t)tmpmse) < besterr) { \ @@ -186,13 +177,16 @@ static INLINE const uint8_t *pre(const uint8_t *buf, int stride, int r, int c) { /* checks if (r, c) has better score than previous best */ #define CHECK_BETTER(v, r, c) \ if (c >= minc && c <= maxc && r >= minr && r <= maxr) { \ + const MV mv = { r, c }; \ + const MV ref_mv = { rr, rc }; \ if (second_pred == NULL) \ thismse = vfp->svf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), z, \ src_stride, &sse); \ else \ thismse = vfp->svaf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), z, \ src_stride, &sse, second_pred); \ - if ((v = MVC(r, c) + thismse) < besterr) { \ + if ((v = mv_err_cost(&mv, &ref_mv, mvjcost, mvcost, error_per_bit) + \ + thismse) < besterr) { \ besterr = v; \ br = r; \ bc = c; \ @@ -776,7 +770,6 @@ uint32_t vp9_find_best_sub_pixel_tree( return besterr; } -#undef MVC #undef CHECK_BETTER static INLINE int check_bounds(const MvLimits *mv_limits, int row, int col,