From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 70ECA4CF72 for ; Thu, 4 Dec 2025 12:38:56 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'WNLcEJKDvP4QUu62ieuef1/XYAkRG13XK1kzMSKOWds=', expected b'MpLaYT5FevYQ8vNJIBJlp5X1mFVTNabnDKVJghO5Gbs=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1764851920; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=WNLcEJKDvP4QUu62ieuef1/XYAkRG13XK1kzMSKOWds=; b=iIGMca0P3jzN+Hg6YuG1JcaPdxOrBN+rExujlnIhpHJcsIrDXc/fjcGXVY7pEQhbt7C4P 87O3nv+BAo4s0V7qIura+TpIIODVVGDGeu1KQtOrab1KLyupZOfG4DgfajcHlq+R5fqYf+h Q/8kOGUU7eX/ipjEpV/TO5cvIUFVIM2Z/6Bjgvlx5e/3imCNs6fHlU6qE9hA6qppHTF0Ex4 NBkiQzBP/EggZkbBu5pd8/dt2/hzRKGFKcLcwX7R2Ti8ERHj3GETbj7cXhq1eK4JbIYUG5M +GXMQDBblo+BzNTf6BmFK2BShr6mf8TJxJsIahsVOoaNYre1/9BWo0fjZ02g== Received: from [172.19.0.3] (unknown [172.19.0.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 9B7E9690534; Thu, 4 Dec 2025 14:38:40 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1764851904; b=hHbbDsrOHB8E13amahMD8jS1xt1u9r1iENEZcmJREuv9lllvL0EO7SW0VOaTS78F1xNmj AWpxHSZyDgWK8luse8rMXPrs406CIWKKvZil8QlNddt9v850M0vx/86p63eb17ON/Z0pQ/z v6Jr3Q6ktpp838m9CdkRRBtMLrX7zhFQcfds1em13ANWACBhA9W854p9qbsy7BXKbrtoJKa fHNtfgJzRpyV4q/wZRN8N1SjChWQGDx+rIxVW0OcHS4GAFU9UMKia6i2ens7paROKsrYqUS 1T0W7EtCCgN8CMg+HvpOQzZeCCeV4ILhw1IWE7kx6Y+S70Ox6oIH/2a3fCYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1764851904; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=0YmJI22xuGwiwVK0M21B4bdL9z9o5d4eXAA2OD/LVDw=; b=DzXBXSmkjfNhfecA97xHYxQqjGgj8quAhXnPDrwI8gB6NDnuG/nDh5GHC9cwFNOpAgED3 rYJZlHCrP9dBMGQ0JjrcryhGb4XnyC6uPybuJfyowIQ+HUhkoMkAtyTMkC0YioXKAGUFqiV jzMUgj6b093DCGElX6EDU8MLqketBzx+WyEDcg7qFvMfzvRRECFTRfRL7fucffkMg7yCTe+ iGH0dsT7TEcXs67tP1dfG0itXJB1RW9NWCUvxigMe+wCS7GCVqQRDb36l0VIDWcjD2Rm/WJ EQXpWjTvTJ7kSNPHHgDjXe2XHgkcQwNC3awCYFQP/z/8MAPX+6x6eWqJ6QLQ== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1764851897; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=MpLaYT5FevYQ8vNJIBJlp5X1mFVTNabnDKVJghO5Gbs=; b=HjOy8h2FAm/np5a7BVmnhyDUoUW5zelrKJPC3qV/x6X175+u5W4cDhRbUhodMoxAGHQ4i RjU0eZ3ITwdcHyCt5tVIb7ncv2muGtmdiVTddj8OALcBBylsD5uKGC6JeYtHriERE8HRSWa vld8nYhLqkG3ZqqPv7b6HtjItbA+Ltz0ck+zMnZI3UGIvHZoPrGAGajgMZCJ0d/x/KcYG56 Ica6lZPLTEPOpyd66SOpTRgcHahGC2JsD/J0ojxgMGjBMfl8CP3w8fWX0fCLB545HEDn/3b FbGc1xV98UTHFMZQNvpShUBiF3GQdcq4IRllideeVYUbijNTQRbIgwq+pLPw== Received: from 55ca25703178 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 6FE5E6904B9 for ; Thu, 4 Dec 2025 14:38:17 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Thu, 04 Dec 2025 12:38:17 -0000 Message-ID: <176485189756.39.11557437636566510079@2cb04c0e5124> Message-ID-Hash: RIA3SVMFRXCVNR6HHQ6D2YCZLRPND4OU X-Message-ID-Hash: RIA3SVMFRXCVNR6HHQ6D2YCZLRPND4OU X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] avfilter/avfiltergraph: always retry format negotiation after auto-filters (PR #21100) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Niklas Haas via ffmpeg-devel Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #21100 opened by Niklas Haas (haasn) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21100 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21100.patch There is an edge case not covered by the current logic: If there is only a single auto-filter inserted, but the auto-inserted filter is incompatible with a *different* format attribute (after settling the previous formats), we may need a second auto-filter (e.g. `scale`) to settle the newly introduced incompatibility. A regression test demonstrating the issue is added. >>From 60a3b0848e038d75a59dd942c547787c6e68869a Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Thu, 4 Dec 2025 13:25:03 +0100 Subject: [PATCH 1/2] avfilter/avfiltergraph: always retry format negotiation after auto-filters There is an edge case not covered by the current logic: If there is only a single auto-filter inserted, but the auto-inserted filter is incompatible with a *different* format attribute (after settling the previous formats), we may need a second auto-filter (e.g. `scale`) to settle the newly introduced incompatibility. A regression test demonstrating the issue is added. --- libavfilter/avfiltergraph.c | 9 +++++---- tests/fate/filter-video.mak | 3 +++ tests/ref/fate/filter-scale-premultiply | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 tests/ref/fate/filter-scale-premultiply diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index d5c2ef54e6..c15d95b91e 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -701,10 +701,11 @@ retry: } } - /* if there is more than one auto filter, we may need another round - * to fully settle formats due to possible cross-incompatibilities - * between the auto filters themselves */ - if (num_conv > 1) + /* if there is an auto filter, we may need another round to fully + * settle formats due to possible cross-incompatibilities between + * the auto filters themselves, or between the auto filters and + * a different attribute of the filter they are modifying */ + if (num_conv) goto retry; } } diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index 9f3c92a395..35b2687b27 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -836,6 +836,9 @@ FATE_FILTER-$(call ALLYES, TESTSRC2_FILTER SPLIT_FILTER AVGBLUR_FILTER \ METADATA_FILTER WRAPPED_AVFRAME_ENCODER NULL_MUXER \ PIPE_PROTOCOL) += $(FATE_FILTER_REFCMP_METADATA-yes) +FATE_FILTER-$(call FILTERFRAMECRC, TESTSRC SCALE PREMULTIPLY, LAVFI_INDEV) += fate-filter-scale-premultiply +fate-filter-scale-premultiply: CMD = framecrc -auto_conversion_filters -lavfi "testsrc,format=rgba,setparams=alpha_mode=premultiplied,format=rgba:alpha_modes=straight" -frames:v 10 + FATE_SAMPLES_FFPROBE += $(FATE_METADATA_FILTER-yes) FATE_SAMPLES_FFMPEG += $(FATE_FILTER_SAMPLES-yes) FATE_FFPROBE += $(FATE_FILTER_FFPROBE-yes) diff --git a/tests/ref/fate/filter-scale-premultiply b/tests/ref/fate/filter-scale-premultiply new file mode 100644 index 0000000000..13fd79310a --- /dev/null +++ b/tests/ref/fate/filter-scale-premultiply @@ -0,0 +1,15 @@ +#tb 0: 1/25 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 320x240 +#sar 0: 1/1 +0, 0, 0, 1, 307200, 0x73a3b71f +0, 1, 1, 1, 307200, 0x3f05f047 +0, 2, 2, 1, 307200, 0x50382370 +0, 3, 3, 1, 307200, 0x41a15136 +0, 4, 4, 1, 307200, 0xbc8c78ee +0, 5, 5, 1, 307200, 0x19839e1b +0, 6, 6, 1, 307200, 0x8545b93b +0, 7, 7, 1, 307200, 0x4a4acf07 +0, 8, 8, 1, 307200, 0xefa1dee4 +0, 9, 9, 1, 307200, 0x22dae9ca -- 2.49.1 >>From 73f67a23d292cf4018114dc820879d7e640d29c4 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Thu, 4 Dec 2025 13:10:47 +0100 Subject: [PATCH 2/2] avfilter/avfiltergraph: add missing newlines to format printing --- libavfilter/avfiltergraph.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index c15d95b91e..ad81d91bbc 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -485,13 +485,13 @@ static void print_filter_formats(void *log_ctx, int level, const AVFilterContext for (int i = 0; i < f->nb_inputs; i++) { const AVFilterLink *in = f->inputs[i]; const AVFilterNegotiation *neg = ff_filter_get_negotiation(in); - av_log(log_ctx, level, " in[%d] '%s':", i, f->input_pads[i].name); + av_log(log_ctx, level, " in[%d] '%s':\n", i, f->input_pads[i].name); for (unsigned i = 0; i < neg->nb_mergers; i++) { const AVFilterFormatsMerger *m = &neg->mergers[i]; m->print_list(&bp, FF_FIELD_AT(void *, m->offset, in->outcfg)); if (av_bprint_is_complete(&bp)) - av_log(log_ctx, level, " %s: %s", m->name, bp.str); + av_log(log_ctx, level, " %s: %s\n", m->name, bp.str); av_bprint_clear(&bp); } } @@ -499,13 +499,13 @@ static void print_filter_formats(void *log_ctx, int level, const AVFilterContext for (int i = 0; i < f->nb_outputs; i++) { const AVFilterLink *out = f->outputs[i]; const AVFilterNegotiation *neg = ff_filter_get_negotiation(out); - av_log(log_ctx, level, " out[%d] '%s':", i, f->output_pads[i].name); + av_log(log_ctx, level, " out[%d] '%s':\n", i, f->output_pads[i].name); for (unsigned i = 0; i < neg->nb_mergers; i++) { const AVFilterFormatsMerger *m = &neg->mergers[i]; m->print_list(&bp, FF_FIELD_AT(void *, m->offset, out->incfg)); if (av_bprint_is_complete(&bp)) - av_log(log_ctx, level, " %s: %s", m->name, bp.str); + av_log(log_ctx, level, " %s: %s\n", m->name, bp.str); av_bprint_clear(&bp); } } -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org