summaryrefslogtreecommitdiff
path: root/libavcodec/texturedspenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-23 17:02:22 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-06-23 17:12:00 +0200
commit9f997acdd003b3183221ce3043a30c2d05a1de21 (patch)
treeb876aae82023c5323bdeafbb240aaa4b782c26d9 /libavcodec/texturedspenc.c
parent88325c2e0b63abf4c3482cecd43870015123764a (diff)
avcodec/texturedspenc: Add () to protect macro / argument evaluation order
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/texturedspenc.c')
-rw-r--r--libavcodec/texturedspenc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/texturedspenc.c b/libavcodec/texturedspenc.c
index 30525c8320..577e1c43b8 100644
--- a/libavcodec/texturedspenc.c
+++ b/libavcodec/texturedspenc.c
@@ -140,14 +140,14 @@ const static uint8_t match6[256][2] = {
};
/* Multiplication over 8 bit emulation */
-#define mul8(a, b) (a * b + 128 + ((a * b + 128) >> 8)) >> 8
+#define mul8(a, b) (((a) * (b) + 128 + (((a) * (b) + 128) >> 8)) >> 8)
/* Conversion from rgb24 to rgb565 */
#define rgb2rgb565(r, g, b) \
- (mul8(r, 31) << 11) | (mul8(g, 63) << 5) | (mul8(b, 31) << 0)
+ ((mul8(r, 31) << 11) | (mul8(g, 63) << 5) | (mul8(b, 31) << 0))
/* Linear interpolation at 1/3 point between a and b */
-#define lerp13(a, b) (2 * a + b) / 3
+#define lerp13(a, b) ((2 * (a) + (b)) / 3)
/* Linear interpolation on an RGB pixel */
static inline void lerp13rgb(uint8_t *out, uint8_t *p1, uint8_t *p2)