Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Nicolas George <george@nsup.org>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] lavfi: protection against premultiplied alpha (was: The patch series about premultiplied alpha)
Date: Sun, 3 Aug 2025 20:15:09 +0200
Message-ID: <aI-nLTg1ejgyCXYy@phare.normalesup.org> (raw)
In-Reply-To: <aI-E-rlLSRjqDnJG@phare.normalesup.org>

[-- Attachment #1: Type: text/plain, Size: 474 bytes --]

Nicolas George (HE12025-08-03):
> I will send the series here in a few hours.

Here is a series of patch. I am absolutely not sure I found all the
filters that could be flagged, but the rest can be done as the need
arises.

Not tested every filter, but it is pretty straightforward.

I could not find how to download your patch series in a format suitable
for git am from the monster, I used the v2 series, but it should not
change anything.

Regards,

-- 
  Nicolas George

[-- Attachment #2: 0001-lavfi-add-a-flag-for-filters-that-support-premultipl.patch --]
[-- Type: text/x-diff, Size: 1707 bytes --]

From e7867075c4dc4bb244798c096e484d3cfaf10254 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:34:08 +0200
Subject: [PATCH 01/39] lavfi: add a flag for filters that support
 premultiplied alpha

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/avfilter.c | 7 +++++++
 libavfilter/filters.h  | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 5bcf0b4ef7..2f425b529c 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1097,6 +1097,13 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
                                        link->time_base);
     }
 
+    if ((frame->alpha_mode == AVALPHA_MODE_PREMULTIPLIED) &&
+        !(link->dstpad->flags & AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED)) {
+        av_log(link->dst, AV_LOG_ERROR, "Frames with premultiplied alpha are not supported by this filter.\n");
+        av_frame_free(&frame);
+        return AVERROR_PATCHWELCOME;
+    }
+
     li->frame_blocked_in = li->frame_wanted_out = 0;
     li->l.frame_count_in++;
     li->l.sample_count_in += frame->nb_samples;
diff --git a/libavfilter/filters.h b/libavfilter/filters.h
index 11152cfabf..8b431bd457 100644
--- a/libavfilter/filters.h
+++ b/libavfilter/filters.h
@@ -62,6 +62,12 @@ struct AVFilterPad {
      */
 #define AVFILTERPAD_FLAG_FREE_NAME                       (1 << 1)
 
+    /**
+     * The filter is capable of handling frame with premultiplied alpha
+     * without producing garbled output
+     */
+#define AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED            (1 << 2)
+
     /**
      * A combination of AVFILTERPAD_FLAG_* flags.
      */
-- 
2.47.2


[-- Attachment #3: 0002-lavfi-vf_stack-check-alp-a-mode-consistency.patch --]
[-- Type: text/x-diff, Size: 1900 bytes --]

From e48d82211e62cb9199d722f7218cfccbd0c77741 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:41:02 +0200
Subject: [PATCH 02/39] =?UTF-8?q?lavfi/vf=5Fstack:=20check=20alp=C4=A5a=20?=
 =?UTF-8?q?mode=20consistency?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_stack.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c
index fa202ee0cc..981f644cd2 100644
--- a/libavfilter/vf_stack.c
+++ b/libavfilter/vf_stack.c
@@ -135,6 +135,7 @@ static av_cold int init(AVFilterContext *ctx)
         pad.name = av_asprintf("input%d", i);
         if (!pad.name)
             return AVERROR(ENOMEM);
+        pad.flags |= AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED;
 
         if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0)
             return ret;
@@ -166,6 +167,17 @@ static int process_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
     return 0;
 }
 
+static int check_premult_consistent(AVFrame * const *frames, unsigned nb_frames)
+{
+    unsigned m = 0, i;
+    for (i = 0; i < nb_frames; i++) {
+        m |= frames[i]->alpha_mode == AVALPHA_MODE_PREMULTIPLIED ? 2 : 1;
+        if (m == 3)
+            return 0;
+    }
+    return 1;
+}
+
 static int process_frame(FFFrameSync *fs)
 {
     AVFilterContext *ctx = fs->parent;
@@ -179,6 +191,10 @@ static int process_frame(FFFrameSync *fs)
         if ((ret = ff_framesync_get_frame(&s->fs, i, &in[i], 0)) < 0)
             return ret;
     }
+    if (!check_premult_consistent(in, s->nb_inputs)) {
+        av_log(ctx, AV_LOG_ERROR, "All frames must have the same alpha mode.\n");
+        return AVERROR(EINVAL);
+    }
 
     out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     if (!out)
-- 
2.47.2


[-- Attachment #4: 0003-lavfi-video-add-ff_video_default_filterpad_premult_o.patch --]
[-- Type: text/x-diff, Size: 1658 bytes --]

From 84549c11729027093c0fc974a24631e7e3c22ae9 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:35:08 +0200
Subject: [PATCH 03/39] lavfi/video: add ff_video_default_filterpad_premult_ok
 helper

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/video.c | 8 ++++++++
 libavfilter/video.h | 7 +++++++
 2 files changed, 15 insertions(+)

diff --git a/libavfilter/video.c b/libavfilter/video.c
index 1de7f2ef59..462160846f 100644
--- a/libavfilter/video.c
+++ b/libavfilter/video.c
@@ -41,6 +41,14 @@ const AVFilterPad ff_video_default_filterpad[1] = {
     }
 };
 
+const AVFilterPad ff_video_default_filterpad_premult_ok[1] = {
+    {
+        .name = "default",
+        .type = AVMEDIA_TYPE_VIDEO,
+        .flags = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
+    }
+};
+
 AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
 {
     return ff_get_video_buffer(link->dst->outputs[0], w, h);
diff --git a/libavfilter/video.h b/libavfilter/video.h
index f44d3445dc..2292fe1caf 100644
--- a/libavfilter/video.h
+++ b/libavfilter/video.h
@@ -30,6 +30,13 @@
  */
 extern const AVFilterPad ff_video_default_filterpad[1];
 
+/**
+ * An AVFilterPad array whose only entry has name "default"
+ * and is of type AVMEDIA_TYPE_VIDEO, with the
+ * AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED flag
+ */
+extern const AVFilterPad ff_video_default_filterpad_premult_ok[1];
+
 AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h);
 AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int align);
 AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h);
-- 
2.47.2


[-- Attachment #5: 0004-lavfi-vf_null-use-ff_video_default_filterpad_premult.patch --]
[-- Type: text/x-diff, Size: 899 bytes --]

From 61ba67d98e26140f9bcd12b1f5dfdb430cfb77c3 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:37:43 +0200
Subject: [PATCH 04/39] lavfi/vf_null: use
 ff_video_default_filterpad_premult_ok

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_null.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_null.c b/libavfilter/vf_null.c
index 7071cc959f..676b81e346 100644
--- a/libavfilter/vf_null.c
+++ b/libavfilter/vf_null.c
@@ -30,6 +30,6 @@ const FFFilter ff_vf_null = {
     .p.name        = "null",
     .p.description = NULL_IF_CONFIG_SMALL("Pass the source unchanged to the output."),
     .p.flags       = AVFILTER_FLAG_METADATA_ONLY,
-    FILTER_INPUTS(ff_video_default_filterpad),
+    FILTER_INPUTS(ff_video_default_filterpad_premult_ok),
     FILTER_OUTPUTS(ff_video_default_filterpad),
 };
-- 
2.47.2


[-- Attachment #6: 0005-lavfi-vf_fps-use-ff_video_default_filterpad_premult_.patch --]
[-- Type: text/x-diff, Size: 819 bytes --]

From a8d9f0af1601a9eb28721694a74169f36b483d8c Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:37:55 +0200
Subject: [PATCH 05/39] lavfi/vf_fps: use ff_video_default_filterpad_premult_ok

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_fps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c
index 0257a8ef78..443dc0ee1e 100644
--- a/libavfilter/vf_fps.c
+++ b/libavfilter/vf_fps.c
@@ -395,6 +395,6 @@ const FFFilter ff_vf_fps = {
     .uninit      = uninit,
     .priv_size   = sizeof(FPSContext),
     .activate    = activate,
-    FILTER_INPUTS(ff_video_default_filterpad),
+    FILTER_INPUTS(ff_video_default_filterpad_premult_ok),
     FILTER_OUTPUTS(avfilter_vf_fps_outputs),
 };
-- 
2.47.2


[-- Attachment #7: 0006-lavfi-buffersink-use-ff_video_default_filterpad_prem.patch --]
[-- Type: text/x-diff, Size: 850 bytes --]

From f5df1d7b7c0a71f2d9d68b459254f44a83cc3e63 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:38:10 +0200
Subject: [PATCH 06/39] lavfi/buffersink: use
 ff_video_default_filterpad_premult_ok

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/buffersink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index 50a7da2756..1033bf76d2 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -553,7 +553,7 @@ const FFFilter ff_vsink_buffer = {
     .init          = init_video,
     .uninit        = uninit,
     .activate      = activate,
-    FILTER_INPUTS(ff_video_default_filterpad),
+    FILTER_INPUTS(ff_video_default_filterpad_premult_ok),
     FILTER_QUERY_FUNC2(vsink_query_formats),
 };
 
-- 
2.47.2


[-- Attachment #8: 0007-lavfi-settb-use-ff_video_default_filterpad_premult_o.patch --]
[-- Type: text/x-diff, Size: 878 bytes --]

From c5f62c126faab2840c41a1f0dba467d6ba21193a Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:38:25 +0200
Subject: [PATCH 07/39] lavfi/settb: use ff_video_default_filterpad_premult_ok

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/settb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/settb.c b/libavfilter/settb.c
index 6000c9c5a6..a68b0c1f80 100644
--- a/libavfilter/settb.c
+++ b/libavfilter/settb.c
@@ -178,7 +178,7 @@ const FFFilter ff_vf_settb = {
     .p.priv_class  = &settb_class,
     .p.flags       = AVFILTER_FLAG_METADATA_ONLY,
     .priv_size   = sizeof(SetTBContext),
-    FILTER_INPUTS(ff_video_default_filterpad),
+    FILTER_INPUTS(ff_video_default_filterpad_premult_ok),
     FILTER_OUTPUTS(avfilter_vf_settb_outputs),
     .activate    = activate,
 };
-- 
2.47.2


[-- Attachment #9: 0008-lavfi-vf_untile-use-ff_video_default_filterpad_premu.patch --]
[-- Type: text/x-diff, Size: 881 bytes --]

From 06d243dfce61c99d22f6d157b55a0ae18d2f9cf5 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:39:15 +0200
Subject: [PATCH 08/39] lavfi/vf_untile: use
 ff_video_default_filterpad_premult_ok

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_untile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_untile.c b/libavfilter/vf_untile.c
index 6c1bfbabdc..655c05acc8 100644
--- a/libavfilter/vf_untile.c
+++ b/libavfilter/vf_untile.c
@@ -184,7 +184,7 @@ const FFFilter ff_vf_untile = {
     .uninit        = uninit,
     .activate      = activate,
     .priv_size     = sizeof(UntileContext),
-    FILTER_INPUTS(ff_video_default_filterpad),
+    FILTER_INPUTS(ff_video_default_filterpad_premult_ok),
     FILTER_OUTPUTS(untile_outputs),
     FILTER_QUERY_FUNC2(query_formats),
 };
-- 
2.47.2


[-- Attachment #10: 0009-lavfi-vf_fsync-use-ff_video_default_filterpad_premul.patch --]
[-- Type: text/x-diff, Size: 855 bytes --]

From f2ca298afbae767bcd0fbd7e7ceca0aafb2a200f Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:39:47 +0200
Subject: [PATCH 09/39] lavfi/vf_fsync: use
 ff_video_default_filterpad_premult_ok

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_fsync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_fsync.c b/libavfilter/vf_fsync.c
index 02f10a9bd8..f5cd202975 100644
--- a/libavfilter/vf_fsync.c
+++ b/libavfilter/vf_fsync.c
@@ -298,6 +298,6 @@ const FFFilter ff_vf_fsync = {
     .priv_size     = sizeof(FsyncContext),
     .activate      = activate,
     .formats_state = FF_FILTER_FORMATS_PASSTHROUGH,
-    FILTER_INPUTS(ff_video_default_filterpad),
+    FILTER_INPUTS(ff_video_default_filterpad_premult_ok),
     FILTER_OUTPUTS(fsync_outputs),
 };
-- 
2.47.2


[-- Attachment #11: 0010-lavfi-vf_separatefields-use-ff_video_default_filterp.patch --]
[-- Type: text/x-diff, Size: 907 bytes --]

From b7fbbcc2cce6c344b750eefb8f9b1c9c30d8d017 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:40:38 +0200
Subject: [PATCH 10/39] lavfi/vf_separatefields: use
 ff_video_default_filterpad_premult_ok

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_separatefields.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_separatefields.c b/libavfilter/vf_separatefields.c
index c0c0640dcc..f32a147b96 100644
--- a/libavfilter/vf_separatefields.c
+++ b/libavfilter/vf_separatefields.c
@@ -172,6 +172,6 @@ const FFFilter ff_vf_separatefields = {
     .priv_size   = sizeof(SeparateFieldsContext),
     .activate    = activate,
     .uninit      = uninit,
-    FILTER_INPUTS(ff_video_default_filterpad),
+    FILTER_INPUTS(ff_video_default_filterpad_premult_ok),
     FILTER_OUTPUTS(separatefields_outputs),
 };
-- 
2.47.2


[-- Attachment #12: 0011-lavfi-f_cue-use-ff_video_default_filterpad_premult_o.patch --]
[-- Type: text/x-diff, Size: 906 bytes --]

From 43e1dfce32217775cc3fba8da14adb61761c69b2 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:41:28 +0200
Subject: [PATCH 11/39] lavfi/f_cue: use ff_video_default_filterpad_premult_ok

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/f_cue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/f_cue.c b/libavfilter/f_cue.c
index 63027c7c2e..d38f83e6a5 100644
--- a/libavfilter/f_cue.c
+++ b/libavfilter/f_cue.c
@@ -105,7 +105,7 @@ const FFFilter ff_vf_cue = {
     .p.description = NULL_IF_CONFIG_SMALL("Delay filtering to match a cue."),
     .p.priv_class  = &cue_acue_class,
     .priv_size   = sizeof(CueContext),
-    FILTER_INPUTS(ff_video_default_filterpad),
+    FILTER_INPUTS(ff_video_default_filterpad_premult_ok),
     FILTER_OUTPUTS(ff_video_default_filterpad),
     .activate    = activate,
 };
-- 
2.47.2


[-- Attachment #13: 0012-lavfi-f_latency-use-ff_video_default_filterpad_premu.patch --]
[-- Type: text/x-diff, Size: 839 bytes --]

From c2189e67e03767ee872792a6782dcb3ec057d779 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:41:36 +0200
Subject: [PATCH 12/39] lavfi/f_latency: use
 ff_video_default_filterpad_premult_ok

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/f_latency.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/f_latency.c b/libavfilter/f_latency.c
index 00b55ddb4b..e82ac316ee 100644
--- a/libavfilter/f_latency.c
+++ b/libavfilter/f_latency.c
@@ -109,7 +109,7 @@ const FFFilter ff_vf_latency = {
     .init          = init,
     .uninit        = uninit,
     .activate      = activate,
-    FILTER_INPUTS(ff_video_default_filterpad),
+    FILTER_INPUTS(ff_video_default_filterpad_premult_ok),
     FILTER_OUTPUTS(ff_video_default_filterpad),
 };
 
-- 
2.47.2


[-- Attachment #14: 0013-lavfi-f_loop-use-ff_video_default_filterpad_premult_.patch --]
[-- Type: text/x-diff, Size: 842 bytes --]

From ae04f4daa340e9f7094580278671014f5539d774 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:41:45 +0200
Subject: [PATCH 13/39] lavfi/f_loop: use ff_video_default_filterpad_premult_ok

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/f_loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/f_loop.c b/libavfilter/f_loop.c
index 1984fad70d..d437d4ad54 100644
--- a/libavfilter/f_loop.c
+++ b/libavfilter/f_loop.c
@@ -464,7 +464,7 @@ const FFFilter ff_vf_loop = {
     .init        = init,
     .uninit      = uninit,
     .activate    = activate,
-    FILTER_INPUTS(ff_video_default_filterpad),
+    FILTER_INPUTS(ff_video_default_filterpad_premult_ok),
     FILTER_OUTPUTS(ff_video_default_filterpad),
 };
 #endif /* CONFIG_LOOP_FILTER */
-- 
2.47.2


[-- Attachment #15: 0014-lavfi-split-use-ff_video_default_filterpad_premult_o.patch --]
[-- Type: text/x-diff, Size: 810 bytes --]

From 6dc1ef0d7f99cd23659e616429bee1ca752f916f Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:41:52 +0200
Subject: [PATCH 14/39] lavfi/split: use ff_video_default_filterpad_premult_ok

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/split.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/split.c b/libavfilter/split.c
index d0bd0c3b2a..831a2e9170 100644
--- a/libavfilter/split.c
+++ b/libavfilter/split.c
@@ -132,7 +132,7 @@ const FFFilter ff_vf_split = {
     .priv_size   = sizeof(SplitContext),
     .init        = split_init,
     .activate    = activate,
-    FILTER_INPUTS(ff_video_default_filterpad),
+    FILTER_INPUTS(ff_video_default_filterpad_premult_ok),
 };
 
 const FFFilter ff_af_asplit = {
-- 
2.47.2


[-- Attachment #16: 0015-lavfi-vf_format-set-AVFILTERPAD_FLAG_ACCEPT_PREMULTI.patch --]
[-- Type: text/x-diff, Size: 798 bytes --]

From 9cb8a71cddfd32f3a15031efe041446b1a8a0723 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:37:00 +0200
Subject: [PATCH 15/39] lavfi/vf_format: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_format.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c
index ae91b9655a..3529e40e8b 100644
--- a/libavfilter/vf_format.c
+++ b/libavfilter/vf_format.c
@@ -180,6 +180,7 @@ static const AVFilterPad inputs[] = {
         .name             = "default",
         .type             = AVMEDIA_TYPE_VIDEO,
         .get_buffer.video = ff_null_get_video_buffer,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #17: 0016-lavfi-vf_scale-set-AVFILTERPAD_FLAG_ACCEPT_PREMULTIP.patch --]
[-- Type: text/x-diff, Size: 1240 bytes --]

From c437bf3d55d2346e64243530b7be873e18fc3a23 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:37:31 +0200
Subject: [PATCH 16/39] lavfi/vf_scale: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_scale.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 54cd0b12b6..a4b331ddaf 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -1168,6 +1168,7 @@ static const AVFilterPad avfilter_vf_scale_inputs[] = {
     {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
@@ -1225,11 +1226,13 @@ static const AVFilterPad avfilter_vf_scale2ref_inputs[] = {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
     {
         .name         = "ref",
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame_ref,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #18: 0017-lavfi-vf_aspect-set-AVFILTERPAD_FLAG_ACCEPT_PREMULTI.patch --]
[-- Type: text/x-diff, Size: 781 bytes --]

From c0c478a6b1e0f4ec4b4c3c9d7a74823d5d0ef251 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:38:35 +0200
Subject: [PATCH 17/39] lavfi/vf_aspect: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_aspect.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_aspect.c b/libavfilter/vf_aspect.c
index 7ec1035336..7816c9934c 100644
--- a/libavfilter/vf_aspect.c
+++ b/libavfilter/vf_aspect.c
@@ -132,6 +132,7 @@ static const AVFilterPad aspect_inputs[] = {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #19: 0018-lavfi-vf_setparams-set-AVFILTERPAD_FLAG_ACCEPT_PREMU.patch --]
[-- Type: text/x-diff, Size: 792 bytes --]

From 8d83718c4fc909dd91d6c1854bd2fff048fa53f1 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:38:50 +0200
Subject: [PATCH 18/39] lavfi/vf_setparams: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_setparams.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c
index 5043ae6e65..a2211cef8d 100644
--- a/libavfilter/vf_setparams.c
+++ b/libavfilter/vf_setparams.c
@@ -206,6 +206,7 @@ static const AVFilterPad inputs[] = {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #20: 0019-lavfi-vf_copy-set-AVFILTERPAD_FLAG_ACCEPT_PREMULTIPL.patch --]
[-- Type: text/x-diff, Size: 777 bytes --]

From e795f7e514e3e23a516d5f2ca9162a62f57edc11 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:39:24 +0200
Subject: [PATCH 19/39] lavfi/vf_copy: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_copy.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_copy.c b/libavfilter/vf_copy.c
index c6d5191901..76537fe3e4 100644
--- a/libavfilter/vf_copy.c
+++ b/libavfilter/vf_copy.c
@@ -66,6 +66,7 @@ static const AVFilterPad avfilter_vf_copy_inputs[] = {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #21: 0020-lavfi-vf_vfrdet-set-AVFILTERPAD_FLAG_ACCEPT_PREMULTI.patch --]
[-- Type: text/x-diff, Size: 779 bytes --]

From 2ef259981ae8a8fb91865716dfb33ed05b6e6d37 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:39:36 +0200
Subject: [PATCH 20/39] lavfi/vf_vfrdet: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_vfrdet.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_vfrdet.c b/libavfilter/vf_vfrdet.c
index f99bc71de7..7500afb998 100644
--- a/libavfilter/vf_vfrdet.c
+++ b/libavfilter/vf_vfrdet.c
@@ -94,6 +94,7 @@ static const AVFilterPad vfrdet_inputs[] = {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #22: 0021-lavfi-vf_framestep-set-AVFILTERPAD_FLAG_ACCEPT_PREMU.patch --]
[-- Type: text/x-diff, Size: 800 bytes --]

From 8905930c9d318d47c0406f38d634b902ed3a6b1c Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:39:55 +0200
Subject: [PATCH 21/39] lavfi/vf_framestep: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_framestep.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_framestep.c b/libavfilter/vf_framestep.c
index 02beda6cf3..76eeac30d2 100644
--- a/libavfilter/vf_framestep.c
+++ b/libavfilter/vf_framestep.c
@@ -79,6 +79,7 @@ static const AVFilterPad framestep_inputs[] = {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #23: 0022-lavfi-vf_ccrepack-set-AVFILTERPAD_FLAG_ACCEPT_PREMUL.patch --]
[-- Type: text/x-diff, Size: 808 bytes --]

From d9676eb568a6567bb8052320e41cc201df68d1d0 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:40:03 +0200
Subject: [PATCH 22/39] lavfi/vf_ccrepack: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_ccrepack.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_ccrepack.c b/libavfilter/vf_ccrepack.c
index f3f0c69676..bc17f97bac 100644
--- a/libavfilter/vf_ccrepack.c
+++ b/libavfilter/vf_ccrepack.c
@@ -84,6 +84,7 @@ static const AVFilterPad avfilter_vf_ccrepack_inputs[] = {
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
         .config_props = config_input,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #24: 0023-lavfi-vf_dejudder-set-AVFILTERPAD_FLAG_ACCEPT_PREMUL.patch --]
[-- Type: text/x-diff, Size: 795 bytes --]

From 33fe0ee504510badc1dc4393232c2b3a4c39f21a Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:40:10 +0200
Subject: [PATCH 23/39] lavfi/vf_dejudder: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_dejudder.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_dejudder.c b/libavfilter/vf_dejudder.c
index 9d0c4717d2..875842314e 100644
--- a/libavfilter/vf_dejudder.c
+++ b/libavfilter/vf_dejudder.c
@@ -163,6 +163,7 @@ static const AVFilterPad dejudder_inputs[] = {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #25: 0024-lavfi-vf_iccgen-set-AVFILTERPAD_FLAG_ACCEPT_PREMULTI.patch --]
[-- Type: text/x-diff, Size: 794 bytes --]

From 19cb9e06457b565ed77c2389703ed444f2bdb41b Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:40:15 +0200
Subject: [PATCH 24/39] lavfi/vf_iccgen: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_iccgen.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_iccgen.c b/libavfilter/vf_iccgen.c
index 06c5b4ebdc..c1e41c7644 100644
--- a/libavfilter/vf_iccgen.c
+++ b/libavfilter/vf_iccgen.c
@@ -159,6 +159,7 @@ static const AVFilterPad iccgen_inputs[] = {
         .name           = "default",
         .type           = AVMEDIA_TYPE_VIDEO,
         .filter_frame   = iccgen_filter_frame,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #26: 0025-lavfi-vf_premultiply-set-AVFILTERPAD_FLAG_ACCEPT_PRE.patch --]
[-- Type: text/x-diff, Size: 884 bytes --]

From f48375aa798c90914552fe5be1b81b1ddcefebed Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:40:23 +0200
Subject: [PATCH 25/39] lavfi/vf_premultiply: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_premultiply.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c
index 3232ba0ee2..5087268224 100644
--- a/libavfilter/vf_premultiply.c
+++ b/libavfilter/vf_premultiply.c
@@ -798,6 +798,8 @@ static av_cold int init(AVFilterContext *ctx)
     pad.type         = AVMEDIA_TYPE_VIDEO;
     pad.name         = "main";
     pad.config_props = config_input;
+    if (s->inverse)
+        pad.flags |= AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED;
 
     if ((ret = ff_append_inpad(ctx, &pad)) < 0)
         return ret;
-- 
2.47.2


[-- Attachment #27: 0026-lavfi-vf_random-set-AVFILTERPAD_FLAG_ACCEPT_PREMULTI.patch --]
[-- Type: text/x-diff, Size: 781 bytes --]

From 4e9ae2107111d2418477df294ba287697fb8585a Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:40:30 +0200
Subject: [PATCH 26/39] lavfi/vf_random: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_random.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_random.c b/libavfilter/vf_random.c
index ca95ca2c10..6c69daeeec 100644
--- a/libavfilter/vf_random.c
+++ b/libavfilter/vf_random.c
@@ -130,6 +130,7 @@ static const AVFilterPad random_inputs[] = {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #28: 0027-lavfi-vf_shuffleframes-set-AVFILTERPAD_FLAG_ACCEPT_P.patch --]
[-- Type: text/x-diff, Size: 830 bytes --]

From 9fe38c1f663f3edadf8f6422eafac53d32a052e6 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:40:47 +0200
Subject: [PATCH 27/39] lavfi/vf_shuffleframes: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_shuffleframes.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_shuffleframes.c b/libavfilter/vf_shuffleframes.c
index 7d16fcc497..5756431b00 100644
--- a/libavfilter/vf_shuffleframes.c
+++ b/libavfilter/vf_shuffleframes.c
@@ -144,6 +144,7 @@ static const AVFilterPad shuffleframes_inputs[] = {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #29: 0028-lavfi-vf_overlay-set-AVFILTERPAD_FLAG_ACCEPT_PREMULT.patch --]
[-- Type: text/x-diff, Size: 1013 bytes --]

From 87227184fe87f115fbd17296706a612434164a0b Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:53:10 +0200
Subject: [PATCH 28/39] lavfi/vf_overlay: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_overlay.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 8eb4218542..22d0a288f5 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -983,11 +983,13 @@ static const AVFilterPad avfilter_vf_overlay_inputs[] = {
         .name         = "main",
         .type         = AVMEDIA_TYPE_VIDEO,
         .config_props = config_input_main,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
     {
         .name         = "overlay",
         .type         = AVMEDIA_TYPE_VIDEO,
         .config_props = config_input_overlay,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #30: 0029-lavfi-f_select-set-AVFILTERPAD_FLAG_ACCEPT_PREMULTIP.patch --]
[-- Type: text/x-diff, Size: 846 bytes --]

From 6e1ac54c782ce2ba4c0399248c64e6cc457ef737 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:54:11 +0200
Subject: [PATCH 29/39] lavfi/f_select: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Assume a very transparent frame counts as a scene change.

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/f_select.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index 46208a7b76..bc2ac66df6 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -549,6 +549,7 @@ static const AVFilterPad avfilter_vf_select_inputs[] = {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
         .config_props = config_input,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #31: 0030-lavfi-vf_bbox-set-AVFILTERPAD_FLAG_ACCEPT_PREMULTIPL.patch --]
[-- Type: text/x-diff, Size: 767 bytes --]

From 3d7193456082c9f7f792307b052e365aae35df41 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:55:47 +0200
Subject: [PATCH 30/39] lavfi/vf_bbox: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_bbox.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_bbox.c b/libavfilter/vf_bbox.c
index 9631613ff4..62b16ec968 100644
--- a/libavfilter/vf_bbox.c
+++ b/libavfilter/vf_bbox.c
@@ -133,6 +133,7 @@ static const AVFilterPad bbox_inputs[] = {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #32: 0031-lavfi-vf_blackdetect-set-AVFILTERPAD_FLAG_ACCEPT_PRE.patch --]
[-- Type: text/x-diff, Size: 865 bytes --]

From f96bcd8a0a946c5fbda64217bafc4c1db2a72db9 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 19:56:52 +0200
Subject: [PATCH 31/39] lavfi/vf_blackdetect: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Assume very transparent counts as black.

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_blackdetect.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_blackdetect.c b/libavfilter/vf_blackdetect.c
index b233bdfd60..628495560a 100644
--- a/libavfilter/vf_blackdetect.c
+++ b/libavfilter/vf_blackdetect.c
@@ -249,6 +249,7 @@ static const AVFilterPad blackdetect_inputs[] = {
         .type          = AVMEDIA_TYPE_VIDEO,
         .config_props  = config_input,
         .filter_frame  = filter_frame,
+        .flags         = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #33: 0032-lavfi-vf_pixdesctest-set-AVFILTERPAD_FLAG_ACCEPT_PRE.patch --]
[-- Type: text/x-diff, Size: 831 bytes --]

From 84293ddd1cc021097a75dd15376e40f1847c51ca Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 20:00:37 +0200
Subject: [PATCH 32/39] lavfi/vf_pixdesctest: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_pixdesctest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_pixdesctest.c b/libavfilter/vf_pixdesctest.c
index 994fe1db93..128511049b 100644
--- a/libavfilter/vf_pixdesctest.c
+++ b/libavfilter/vf_pixdesctest.c
@@ -113,6 +113,7 @@ static const AVFilterPad avfilter_vf_pixdesctest_inputs[] = {
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
         .config_props = config_props,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #34: 0033-lavfi-vf_libplacebo-set-AVFILTERPAD_FLAG_ACCEPT_PREM.patch --]
[-- Type: text/x-diff, Size: 914 bytes --]

From 26e6e4313bf0c0eb9dfa4fc37d01e2644a9f5f78 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 20:00:50 +0200
Subject: [PATCH 33/39] lavfi/vf_libplacebo: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_libplacebo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 26ded247bc..89eb36e845 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -566,6 +566,7 @@ static int libplacebo_init(AVFilterContext *avctx)
             .name         = av_asprintf("input%d", i),
             .type         = AVMEDIA_TYPE_VIDEO,
             .config_props = &libplacebo_config_input,
+            .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
         };
         if (!pad.name)
             return AVERROR(ENOMEM);
-- 
2.47.2


[-- Attachment #35: 0034-lavfi-vf_field-set-AVFILTERPAD_FLAG_ACCEPT_PREMULTIP.patch --]
[-- Type: text/x-diff, Size: 772 bytes --]

From c5c8d0edd0d35c63ed7057e446cf7fde7c741601 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 20:07:17 +0200
Subject: [PATCH 34/39] lavfi/vf_field: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_field.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_field.c b/libavfilter/vf_field.c
index 40fcf73bc4..0905c64edc 100644
--- a/libavfilter/vf_field.c
+++ b/libavfilter/vf_field.c
@@ -88,6 +88,7 @@ static const AVFilterPad field_inputs[] = {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #36: 0035-lavfi-vf_fieldhint-set-AVFILTERPAD_FLAG_ACCEPT_PREMU.patch --]
[-- Type: text/x-diff, Size: 795 bytes --]

From 79a372018b899142c45de6820754d2a30ba2765e Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 20:07:35 +0200
Subject: [PATCH 35/39] lavfi/vf_fieldhint: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_fieldhint.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_fieldhint.c b/libavfilter/vf_fieldhint.c
index 6f4403a48d..9680a16903 100644
--- a/libavfilter/vf_fieldhint.c
+++ b/libavfilter/vf_fieldhint.c
@@ -302,6 +302,7 @@ static const AVFilterPad inputs[] = {
         .type         = AVMEDIA_TYPE_VIDEO,
         .config_props = config_input,
         .filter_frame = filter_frame,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #37: 0036-lavfi-vf_fieldmatch-set-AVFILTERPAD_FLAG_ACCEPT_PREM.patch --]
[-- Type: text/x-diff, Size: 824 bytes --]

From d22d3b3f6a51b438b3440f22e3a3cdb809bb129b Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 20:07:43 +0200
Subject: [PATCH 36/39] lavfi/vf_fieldmatch: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_fieldmatch.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_fieldmatch.c b/libavfilter/vf_fieldmatch.c
index 60b4a602cb..484a0ea173 100644
--- a/libavfilter/vf_fieldmatch.c
+++ b/libavfilter/vf_fieldmatch.c
@@ -989,6 +989,7 @@ static av_cold int fieldmatch_init(AVFilterContext *ctx)
         .name         = "main",
         .type         = AVMEDIA_TYPE_VIDEO,
         .config_props = config_input,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     };
     int ret;
 
-- 
2.47.2


[-- Attachment #38: 0037-lavfi-vf_fieldorder-set-AVFILTERPAD_FLAG_ACCEPT_PREM.patch --]
[-- Type: text/x-diff, Size: 824 bytes --]

From b5bdd1448136333a77c97ea10f9a74f7dfb42434 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 20:07:50 +0200
Subject: [PATCH 37/39] lavfi/vf_fieldorder: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_fieldorder.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_fieldorder.c b/libavfilter/vf_fieldorder.c
index fe999f27ea..0e288e86be 100644
--- a/libavfilter/vf_fieldorder.c
+++ b/libavfilter/vf_fieldorder.c
@@ -170,6 +170,7 @@ static const AVFilterPad avfilter_vf_fieldorder_inputs[] = {
         .type         = AVMEDIA_TYPE_VIDEO,
         .config_props = config_input,
         .filter_frame = filter_frame,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #39: 0038-lavfi-vf_hflip-set-AVFILTERPAD_FLAG_ACCEPT_PREMULTIP.patch --]
[-- Type: text/x-diff, Size: 789 bytes --]

From 2408c4ca68d53bf33ec397a4fa50d86d053882b2 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 20:09:02 +0200
Subject: [PATCH 38/39] lavfi/vf_hflip: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_hflip.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c
index 8f8dd14240..0100867fc0 100644
--- a/libavfilter/vf_hflip.c
+++ b/libavfilter/vf_hflip.c
@@ -143,6 +143,7 @@ static const AVFilterPad avfilter_vf_hflip_inputs[] = {
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
         .config_props = config_props,
+        .flags        = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #40: 0039-lavfi-vf_vflip-set-AVFILTERPAD_FLAG_ACCEPT_PREMULTIP.patch --]
[-- Type: text/x-diff, Size: 803 bytes --]

From d28bde401f8aa7a43c20729686831865f39cd7cb Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Sun, 3 Aug 2025 20:09:11 +0200
Subject: [PATCH 39/39] lavfi/vf_vflip: set
 AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/vf_vflip.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_vflip.c b/libavfilter/vf_vflip.c
index 4e0411a457..135d630ab1 100644
--- a/libavfilter/vf_vflip.c
+++ b/libavfilter/vf_vflip.c
@@ -124,6 +124,7 @@ static const AVFilterPad avfilter_vf_vflip_inputs[] = {
         .get_buffer.video = get_video_buffer,
         .filter_frame     = filter_frame,
         .config_props     = config_input,
+        .flags            = AVFILTERPAD_FLAG_ACCEPT_PREMULTIPLIED,
     },
 };
 
-- 
2.47.2


[-- Attachment #41: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2025-08-03 18:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-02 15:18 [FFmpeg-devel] The patch series about premultiplied alpha Nicolas George
2025-08-02 18:03 ` Nicolas George
2025-08-03 10:42   ` Niklas Haas
2025-08-03 10:50     ` Niklas Haas
2025-08-03 14:35     ` Nicolas George
2025-08-03 15:49       ` Nicolas George
2025-08-03 18:15         ` Nicolas George [this message]
2025-08-03 20:04           ` [FFmpeg-devel] [PATCH] lavfi: protection against premultiplied alpha (was: The patch series about premultiplied alpha) Michael Niedermayer
2025-08-03 20:50             ` Kacper Michajlow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aI-nLTg1ejgyCXYy@phare.normalesup.org \
    --to=george@nsup.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git