[FFmpeg-cvslog] avcodec/me_cmp: add () to protect avg*s arguments

Michael Niedermayer git at videolan.org
Mon Feb 16 23:58:02 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Feb 16 23:13:00 2015 +0100| [235782260da483bcbe0122bec846dd917e8362fb] | committer: Michael Niedermayer

avcodec/me_cmp: add () to protect avg*s arguments

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=235782260da483bcbe0122bec846dd917e8362fb
---

 libavcodec/me_cmp.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/me_cmp.c b/libavcodec/me_cmp.c
index cfd14ab..d4213d2 100644
--- a/libavcodec/me_cmp.c
+++ b/libavcodec/me_cmp.c
@@ -108,8 +108,8 @@ static int sum_abs_dctelem_c(int16_t *block)
     return sum;
 }
 
-#define avg2(a, b) ((a + b + 1) >> 1)
-#define avg4(a, b, c, d) ((a + b + c + d + 2) >> 2)
+#define avg2(a, b) (((a) + (b) + 1) >> 1)
+#define avg4(a, b, c, d) (((a) + (b) + (c) + (d) + 2) >> 2)
 
 static inline int pix_abs16_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
                               ptrdiff_t stride, int h)



More information about the ffmpeg-cvslog mailing list