@@ -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, \
From: Limin Wang <lance.lmwang@gmail.com> --- libavfilter/vf_overlay.c | 92 ++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 46 deletions(-)