+static av_always_inline void blend_image_yuv(AVFilterContext *ctx,
+ AVFrame *dst, const AVFrame *src,
+ int hsub, int vsub,
+ int main_has_alpha,
+ int x, int y)
+{
+ const int src_w = src->width;
+ const int src_h = src->height;
+ const int dst_w = dst->width;
+ const int dst_h = dst->height;
+
+ if (main_has_alpha)
+ alpha_composite(src, dst, src_w, src_h, dst_w, dst_h, x, y);
+
+ blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, 0, x, y, main_has_alpha);
+ blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, x, y, main_has_alpha);
+ blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, x, y, main_has_alpha);
+}
+
+static void blend_image_yuv420(AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
+{
+ OverlayContext *s = ctx->priv;
+
+ blend_image_yuv(ctx, dst, src, 1, 1, s->main_has_alpha, x, y);
+}
+
+static void blend_image_yuv422(AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
+{
+ OverlayContext *s = ctx->priv;
+
+ blend_image_yuv(ctx, dst, src, 1, 0, s->main_has_alpha, x, y);
+}
+
+static void blend_image_yuv444(AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
+{
+ OverlayContext *s = ctx->priv;
+
+ blend_image_yuv(ctx, dst, src, 0, 0, s->main_has_alpha, x, y);
+}
+