[FFmpeg-cvslog] avfilter/xbr: move alpha blend assignment out of the macros

Clément Bœsch git at videolan.org
Thu Dec 25 23:50:59 CET 2014


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sun Nov 16 12:12:40 2014 +0100| [20cac72a4f6dea934c0bbcd0d4a278bece52362b] | committer: Clément Bœsch

avfilter/xbr: move alpha blend assignment out of the macros

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

 libavfilter/vf_xbr.c |   76 +++++++++++++++++++++++++-------------------------
 1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/libavfilter/vf_xbr.c b/libavfilter/vf_xbr.c
index 914561c..2bcf69e 100644
--- a/libavfilter/vf_xbr.c
+++ b/libavfilter/vf_xbr.c
@@ -74,13 +74,13 @@ static uint32_t pixel_diff(uint32_t x, uint32_t y, const uint32_t *r2y)
            abs((yuv1 & VMASK) - (yuv2 & VMASK));
 }
 
-#define ALPHA_BLEND_128_W(dst, src) dst = ((src & LB_MASK) >> 1) + ((dst & LB_MASK) >> 1)
+#define ALPHA_BLEND_128_W(a, b) ((((a) & LB_MASK) >> 1) + (((b) & LB_MASK) >> 1))
 #define ALPHA_BLEND_BASE(a, b, m, s) (  (RED_BLUE_MASK & (((a) & RED_BLUE_MASK) + (((((b) & RED_BLUE_MASK) - ((a) & RED_BLUE_MASK)) * (m)) >> (s)))) \
                                       | (GREEN_MASK    & (((a) & GREEN_MASK)    + (((((b) & GREEN_MASK)    - ((a) & GREEN_MASK))    * (m)) >> (s)))))
-#define ALPHA_BLEND_32_W(dst, src)  dst = ALPHA_BLEND_BASE(dst, src, 1, 3)
-#define ALPHA_BLEND_64_W(dst, src)  dst = ALPHA_BLEND_BASE(dst, src, 1, 2)
-#define ALPHA_BLEND_192_W(dst, src) dst = ALPHA_BLEND_BASE(dst, src, 3, 2)
-#define ALPHA_BLEND_224_W(dst, src) dst = ALPHA_BLEND_BASE(dst, src, 7, 3)
+#define ALPHA_BLEND_32_W(a, b)  ALPHA_BLEND_BASE(a, b, 1, 3)
+#define ALPHA_BLEND_64_W(a, b)  ALPHA_BLEND_BASE(a, b, 1, 2)
+#define ALPHA_BLEND_192_W(a, b) ALPHA_BLEND_BASE(a, b, 3, 2)
+#define ALPHA_BLEND_224_W(a, b) ALPHA_BLEND_BASE(a, b, 7, 3)
 
 #define df(A, B) pixel_diff(A, B, r2y)
 #define eq(A, B) (df(A, B) < 155)
@@ -99,20 +99,20 @@ static uint32_t pixel_diff(uint32_t x, uint32_t y, const uint32_t *r2y)
             const int up      = ke >= ki<<1 && PE != PC && PB != PC;                                \
             const unsigned px = df(PE,PF) <= df(PE,PH) ? PF : PH;                                   \
             if (left && up) {                                                                       \
-                ALPHA_BLEND_224_W(E[N3], px);                                                       \
-                ALPHA_BLEND_64_W( E[N2], px);                                                       \
+                E[N3] = ALPHA_BLEND_224_W(E[N3], px);                                               \
+                E[N2] = ALPHA_BLEND_64_W( E[N2], px);                                               \
                 E[N1] = E[N2];                                                                      \
             } else if (left) {                                                                      \
-                ALPHA_BLEND_192_W(E[N3], px);                                                       \
-                ALPHA_BLEND_64_W( E[N2], px);                                                       \
+                E[N3] = ALPHA_BLEND_192_W(E[N3], px);                                               \
+                E[N2] = ALPHA_BLEND_64_W( E[N2], px);                                               \
             } else if (up) {                                                                        \
-                ALPHA_BLEND_192_W(E[N3], px);                                                       \
-                ALPHA_BLEND_64_W( E[N1], px);                                                       \
+                E[N3] = ALPHA_BLEND_192_W(E[N3], px);                                               \
+                E[N1] = ALPHA_BLEND_64_W( E[N1], px);                                               \
             } else { /* diagonal */                                                                 \
-                ALPHA_BLEND_128_W(E[N3], px);                                                       \
+                E[N3] = ALPHA_BLEND_128_W(E[N3], px);                                               \
             }                                                                                       \
         } else if (e <= i) {                                                                        \
-            ALPHA_BLEND_128_W( E[N3], ((df(PE,PF) <= df(PE,PH)) ? PF : PH));                        \
+            E[N3] = ALPHA_BLEND_128_W(E[N3], ((df(PE,PF) <= df(PE,PH)) ? PF : PH));                 \
         }                                                                                           \
     }                                                                                               \
 } while (0)
@@ -131,28 +131,28 @@ static uint32_t pixel_diff(uint32_t x, uint32_t y, const uint32_t *r2y)
             const int up      = ke >= ki<<1 && PE != PC && PB != PC;                                \
             const unsigned px = df(PE,PF) <= df(PE,PH) ? PF : PH;                                   \
             if (left && up) {                                                                       \
-                ALPHA_BLEND_192_W(E[N7], px);                                                       \
-                ALPHA_BLEND_64_W( E[N6], px);                                                       \
+                E[N7] = ALPHA_BLEND_192_W(E[N7], px);                                               \
+                E[N6] = ALPHA_BLEND_64_W( E[N6], px);                                               \
                 E[N5] = E[N7];                                                                      \
                 E[N2] = E[N6];                                                                      \
                 E[N8] = px;                                                                         \
             } else if (left) {                                                                      \
-                ALPHA_BLEND_192_W(E[N7], px);                                                       \
-                ALPHA_BLEND_64_W( E[N5], px);                                                       \
-                ALPHA_BLEND_64_W( E[N6], px);                                                       \
+                E[N7] = ALPHA_BLEND_192_W(E[N7], px);                                               \
+                E[N5] = ALPHA_BLEND_64_W( E[N5], px);                                               \
+                E[N6] = ALPHA_BLEND_64_W( E[N6], px);                                               \
                 E[N8] = px;                                                                         \
             } else if (up) {                                                                        \
-                ALPHA_BLEND_192_W(E[N5], px);                                                       \
-                ALPHA_BLEND_64_W( E[N7], px);                                                       \
-                ALPHA_BLEND_64_W( E[N2], px);                                                       \
+                E[N5] = ALPHA_BLEND_192_W(E[N5], px);                                               \
+                E[N7] = ALPHA_BLEND_64_W( E[N7], px);                                               \
+                E[N2] = ALPHA_BLEND_64_W( E[N2], px);                                               \
                 E[N8] = px;                                                                         \
             } else { /* diagonal */                                                                 \
-                ALPHA_BLEND_224_W(E[N8], px);                                                       \
-                ALPHA_BLEND_32_W( E[N5], px);                                                       \
-                ALPHA_BLEND_32_W( E[N7], px);                                                       \
+                E[N8] = ALPHA_BLEND_224_W(E[N8], px);                                               \
+                E[N5] = ALPHA_BLEND_32_W( E[N5], px);                                               \
+                E[N7] = ALPHA_BLEND_32_W( E[N7], px);                                               \
             }                                                                                       \
         } else if (e <= i) {                                                                        \
-            ALPHA_BLEND_128_W(E[N8], ((df(PE,PF) <= df(PE,PH)) ? PF : PH));                         \
+            E[N8] = ALPHA_BLEND_128_W(E[N8], ((df(PE,PF) <= df(PE,PH)) ? PF : PH));                 \
         }                                                                                           \
     }                                                                                               \
 } while (0)
@@ -171,32 +171,32 @@ static uint32_t pixel_diff(uint32_t x, uint32_t y, const uint32_t *r2y)
             const int up      = ke >= ki<<1 && PE != PC && PB != PC;                                \
             const unsigned px = df(PE,PF) <= df(PE,PH) ? PF : PH;                                   \
             if (left && up) {                                                                       \
-                ALPHA_BLEND_192_W(E[N13], px);                                                      \
-                ALPHA_BLEND_64_W( E[N12], px);                                                      \
+                E[N13] = ALPHA_BLEND_192_W(E[N13], px);                                             \
+                E[N12] = ALPHA_BLEND_64_W( E[N12], px);                                             \
                 E[N15] = E[N14] = E[N11] = px;                                                      \
                 E[N10] = E[N3]  = E[N12];                                                           \
                 E[N7]  = E[N13];                                                                    \
             } else if (left) {                                                                      \
-                ALPHA_BLEND_192_W(E[N11], px);                                                      \
-                ALPHA_BLEND_192_W(E[N13], px);                                                      \
-                ALPHA_BLEND_64_W( E[N10], px);                                                      \
-                ALPHA_BLEND_64_W( E[N12], px);                                                      \
+                E[N11] = ALPHA_BLEND_192_W(E[N11], px);                                             \
+                E[N13] = ALPHA_BLEND_192_W(E[N13], px);                                             \
+                E[N10] = ALPHA_BLEND_64_W( E[N10], px);                                             \
+                E[N12] = ALPHA_BLEND_64_W( E[N12], px);                                             \
                 E[N14] = px;                                                                        \
                 E[N15] = px;                                                                        \
             } else if (up) {                                                                        \
-                ALPHA_BLEND_192_W(E[N14], px);                                                      \
-                ALPHA_BLEND_192_W(E[N7 ], px);                                                      \
-                ALPHA_BLEND_64_W( E[N10], px);                                                      \
-                ALPHA_BLEND_64_W( E[N3 ], px);                                                      \
+                E[N14] = ALPHA_BLEND_192_W(E[N14], px);                                             \
+                E[N7 ] = ALPHA_BLEND_192_W(E[N7 ], px);                                             \
+                E[N10] = ALPHA_BLEND_64_W( E[N10], px);                                             \
+                E[N3 ] = ALPHA_BLEND_64_W( E[N3 ], px);                                             \
                 E[N11] = px;                                                                        \
                 E[N15] = px;                                                                        \
             } else { /* diagonal */                                                                 \
-                ALPHA_BLEND_128_W(E[N11], px);                                                      \
-                ALPHA_BLEND_128_W(E[N14], px);                                                      \
+                E[N11] = ALPHA_BLEND_128_W(E[N11], px);                                             \
+                E[N14] = ALPHA_BLEND_128_W(E[N14], px);                                             \
                 E[N15] = px;                                                                        \
             }                                                                                       \
         } else if (e <= i) {                                                                        \
-            ALPHA_BLEND_128_W( E[N15], ((df(PE,PF) <= df(PE,PH)) ? PF : PH));                       \
+            E[N15] = ALPHA_BLEND_128_W(E[N15], ((df(PE,PF) <= df(PE,PH)) ? PF : PH));               \
         }                                                                                           \
     }                                                                                               \
 } while (0)



More information about the ffmpeg-cvslog mailing list