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 66DDF4E67E for ; Wed, 11 Jun 2025 12:48:35 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id B8CA068C2F3; Wed, 11 Jun 2025 15:48:19 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 491ED68B8C6 for ; Wed, 11 Jun 2025 15:48:12 +0300 (EEST) Received: from haasn.dev (unknown [10.30.1.1]) by haasn.dev (Postfix) with UTF8SMTP id 1905C41842; Wed, 11 Jun 2025 14:48:12 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Jun 2025 14:47:07 +0200 Message-ID: <20250611124805.73196-2-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250611124805.73196-1-ffmpeg@haasn.xyz> References: <20250611124805.73196-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v6 01/18] swscale/graph: pass per-pass image pointers to setup() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Niklas Haas This behavior had no real justification and was just incredibly confusing, since the in/out pointers passet to setup() did not match those passed to run(), all for what is arguably an exception anyways (the palette setup). --- libswscale/graph.c | 10 +++++++--- libswscale/graph.h | 2 -- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libswscale/graph.c b/libswscale/graph.c index dc7784aa49..2b26c068d1 100644 --- a/libswscale/graph.c +++ b/libswscale/graph.c @@ -169,6 +169,8 @@ static void free_legacy_swscale(void *priv) static void setup_legacy_swscale(const SwsImg *out, const SwsImg *in, const SwsPass *pass) { + const SwsGraph *graph = pass->graph; + const SwsImg *in_orig = &graph->exec.input; SwsContext *sws = pass->priv; SwsInternal *c = sws_internal(sws); if (sws->flags & SWS_BITEXACT && sws->dither == SWS_DITHER_ED && c->dither_error[0]) { @@ -177,7 +179,7 @@ static void setup_legacy_swscale(const SwsImg *out, const SwsImg *in, } if (usePal(sws->src_format)) - ff_update_palette(c, (const uint32_t *) in->data[1]); + ff_update_palette(c, (const uint32_t *) in_orig->data[1]); } static inline SwsContext *slice_ctx(const SwsPass *pass, int y) @@ -712,8 +714,10 @@ void ff_sws_graph_run(SwsGraph *graph, uint8_t *const out_data[4], for (int i = 0; i < graph->num_passes; i++) { const SwsPass *pass = graph->passes[i]; graph->exec.pass = pass; - if (pass->setup) - pass->setup(out, in, pass); + if (pass->setup) { + pass->setup(pass->output.fmt != AV_PIX_FMT_NONE ? &pass->output : out, + pass->input ? &pass->input->output : in, pass); + } avpriv_slicethread_execute(graph->slicethread, pass->num_slices, 0); } } diff --git a/libswscale/graph.h b/libswscale/graph.h index 0630b31ce6..b829bac88c 100644 --- a/libswscale/graph.h +++ b/libswscale/graph.h @@ -92,8 +92,6 @@ struct SwsPass { /** * Called once from the main thread before running the filter. Optional. - * `out` and `in` always point to the main image input/output, regardless - * of `input` and `output` fields. */ void (*setup)(const SwsImg *out, const SwsImg *in, const SwsPass *pass); -- 2.49.0 _______________________________________________ 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".