[FFmpeg-devel,3/7] libavfilter/vf_overlay.c: Add '\' for every line of the alpha_composite function

Submitted by lance.lmwang@gmail.com on May 24, 2019, 9:36 a.m.

Details

Message ID 20190524093616.74647-3-lance.lmwang@gmail.com
State New
Headers show

Commit Message

lance.lmwang@gmail.com May 24, 2019, 9:36 a.m.
From: Limin Wang <lance.lmwang@gmail.com>

---
 libavfilter/vf_overlay.c | 92 ++++++++++++++++++++--------------------
 1 file changed, 46 insertions(+), 46 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index c1abd3e1b2..f36be1601b 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -550,52 +550,52 @@  static av_always_inline void blend_plane(AVFilterContext *ctx,
     }
 }
 
-static inline void alpha_composite(const AVFrame *src, const AVFrame *dst,
-                                   int src_w, int src_h,
-                                   int dst_w, int dst_h,
-                                   int x, int y,
-                                   int jobnr, int nb_jobs)
-{
-    uint8_t alpha;          /* the amount of overlay to blend on to main */
-    uint8_t *s, *sa, *d, *da;
-    int i, imax, j, jmax;
-    int slice_start, slice_end;
-
-    imax = FFMIN(-y + dst_h, src_h);
-    slice_start = (imax * jobnr) / nb_jobs;
-    slice_end = ((imax * (jobnr+1)) / nb_jobs);
-
-    i = FFMAX(-y, 0);
-    sa = src->data[3] + (i + slice_start) * src->linesize[3];
-    da = dst->data[3] + (y + i + slice_start) * dst->linesize[3];
-
-    for (i = i + slice_start; i < slice_end; i++) {
-        j = FFMAX(-x, 0);
-        s = sa + j;
-        d = da + x+j;
-
-        for (jmax = FFMIN(-x + dst_w, src_w); j < jmax; j++) {
-            alpha = *s;
-            if (alpha != 0 && alpha != 255) {
-                uint8_t alpha_d = *d;
-                alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d);
-            }
-            switch (alpha) {
-            case 0:
-                break;
-            case 255:
-                *d = *s;
-                break;
-            default:
-                /* apply alpha compositing: main_alpha += (1-main_alpha) * overlay_alpha */
-                *d += FAST_DIV255((255 - *d) * *s);
-            }
-            d += 1;
-            s += 1;
-        }
-        da += dst->linesize[3];
-        sa += src->linesize[3];
-    }
+static inline void alpha_composite(const AVFrame *src, const AVFrame *dst,                                             \
+                                   int src_w, int src_h,                                                               \
+                                   int dst_w, int dst_h,                                                               \
+                                   int x, int y,                                                                       \
+                                   int jobnr, int nb_jobs)                                                             \
+{                                                                                                                      \
+    uint8_t alpha;          /* the amount of overlay to blend on to main */                                            \
+    uint8_t *s, *sa, *d, *da;                                                                                          \
+    int i, imax, j, jmax;                                                                                              \
+    int slice_start, slice_end;                                                                                        \
+                                                                                                                       \
+    imax = FFMIN(-y + dst_h, src_h);                                                                                   \
+    slice_start = (imax * jobnr) / nb_jobs;                                                                            \
+    slice_end = ((imax * (jobnr+1)) / nb_jobs);                                                                        \
+                                                                                                                       \
+    i = FFMAX(-y, 0);                                                                                                  \
+    sa = src->data[3] + (i + slice_start) * src->linesize[3];                                                          \
+    da = dst->data[3] + (y + i + slice_start) * dst->linesize[3];                                                      \
+                                                                                                                       \
+    for (i = i + slice_start; i < slice_end; i++) {                                                                    \
+        j = FFMAX(-x, 0);                                                                                              \
+        s = sa + j;                                                                                                    \
+        d = da + x+j;                                                                                                  \
+                                                                                                                       \
+        for (jmax = FFMIN(-x + dst_w, src_w); j < jmax; j++) {                                                         \
+            alpha = *s;                                                                                                \
+            if (alpha != 0 && alpha != 255) {                                                                          \
+                uint8_t alpha_d = *d;                                                                                  \
+                alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d);                                                           \
+            }                                                                                                          \
+            switch (alpha) {                                                                                           \
+            case 0:                                                                                                    \
+                break;                                                                                                 \
+            case 255:                                                                                                  \
+                *d = *s;                                                                                               \
+                break;                                                                                                 \
+            default:                                                                                                   \
+                /* apply alpha compositing: main_alpha += (1-main_alpha) * overlay_alpha */                            \
+                *d += FAST_DIV255((255 - *d) * *s);                                                                    \
+            }                                                                                                          \
+            d += 1;                                                                                                    \
+            s += 1;                                                                                                    \
+        }                                                                                                              \
+        da += dst->linesize[3];                                                                                        \
+        sa += src->linesize[3];                                                                                        \
+    }                                                                                                                  \
 }
 
 static av_always_inline void blend_slice_yuv(AVFilterContext *ctx,                                                     \