ref: 4d50dc5ab54b0dac7392abefd37f386533a0e130
parent: 37cd112b0f1150679b0966bee13ec9ff8e09a642
parent: b987bc36af383a06976164ab32c233e2c769018d
author: Yunqing Wang <[email protected]>
date: Wed Jan 25 19:32:54 EST 2017
Merge "Remove marco MVC in mcomp.c"
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -138,17 +138,6 @@
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 @@
#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 @@
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,6 +177,8 @@
/* 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); \
@@ -192,7 +185,8 @@
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 @@
return besterr;
}
-#undef MVC
#undef CHECK_BETTER
static INLINE int check_bounds(const MvLimits *mv_limits, int row, int col,