yadif: add parens around macro parameters
authorMans Rullgard <mans@mansr.com>
Thu, 24 Feb 2011 21:25:53 +0000 (21:25 +0000)
committerMans Rullgard <mans@mansr.com>
Sat, 5 Mar 2011 14:51:03 +0000 (14:51 +0000)
This fixes compilation with preprocessors which do not add whitespace
around replaced tokens, resulting in invalid expressions like 1--1.

Signed-off-by: Mans Rullgard <mans@mansr.com>
libavfilter/vf_yadif.c

index bd0a9de..f81ee8a 100644 (file)
@@ -73,12 +73,12 @@ static void filter_line_c(uint8_t *dst,
                           + FFABS(cur[-refs+1] - cur[+refs+1]) - 1;
 
 #define CHECK(j)\
-    {   int score = FFABS(cur[-refs-1+j] - cur[+refs-1-j])\
-                  + FFABS(cur[-refs  +j] - cur[+refs  -j])\
-                  + FFABS(cur[-refs+1+j] - cur[+refs+1-j]);\
+    {   int score = FFABS(cur[-refs-1+(j)] - cur[+refs-1-(j)])\
+                  + FFABS(cur[-refs  +(j)] - cur[+refs  -(j)])\
+                  + FFABS(cur[-refs+1+(j)] - cur[+refs+1-(j)]);\
         if (score < spatial_score) {\
             spatial_score= score;\
-            spatial_pred= (cur[-refs  +j] + cur[+refs  -j])>>1;\
+            spatial_pred= (cur[-refs  +(j)] + cur[+refs  -(j)])>>1;\
 
         CHECK(-1) CHECK(-2) }} }}
         CHECK( 1) CHECK( 2) }} }}