ref: 67246764a20ec3f598e94ffcaa02f13ed16db85d
parent: d2bb0c51d397019e22bc920ac36ae3d09924c87d
author: Dmitry Kovalev <[email protected]>
date: Thu Jan 16 13:00:44 EST 2014
Replacing macros with inline functions. Change-Id: Ibde8fb45594cd259fc3281d7874de8fc877fd4f2
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -174,8 +174,10 @@
error_per_bit + 4096) >> 13 : 0)
-#define SP(x) (((x) & 7) << 1) // convert motion vector component to offset
- // for svf calc
+// convert motion vector component to offset for svf calc
+static INLINE int sp(int x) {
+ return (x & 7) << 1;
+}
#define IFMVCV(r, c, s, e) \
if (c >= minc && c <= maxc && r >= minr && r <= maxr) \
@@ -183,12 +185,14 @@
else \
e;
-/* pointer to predictor base of a motionvector */
-#define PRE(r, c) (y + (((r) >> 3) * y_stride + ((c) >> 3) -(offset)))
+static INLINE uint8_t *pre(uint8_t *buf, int stride, int r, int c, int offset) {
+ return &buf[(r >> 3) * stride + (c >> 3) - offset];
+}
/* returns subpixel variance error function */
#define DIST(r, c) \
- vfp->svf(PRE(r, c), y_stride, SP(c), SP(r), z, src_stride, &sse)
+ vfp->svf(pre(y, y_stride, r, c, offset), y_stride, sp(c), sp(r), z, \
+ src_stride, &sse)
/* checks if (r, c) has better score than previous best */
#define CHECK_BETTER(v, r, c) \
@@ -358,7 +362,7 @@
#undef DIST
/* returns subpixel variance error function */
#define DIST(r, c) \
- vfp->svaf(PRE(r, c), y_stride, SP(c), SP(r), \
+ vfp->svaf(pre(y, y_stride, r, c, offset), y_stride, sp(c), sp(r), \
z, src_stride, &sse, second_pred)
int vp9_find_best_sub_pixel_comp_tree(MACROBLOCK *x,