Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Kacper Michajłow via ffmpeg-devel" <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: "Kacper Michajłow" <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] swscale/ops_tmpl_int: remove unused arguments from wrap read decl (PR #20514)
Date: Sat, 13 Sep 2025 14:15:23 -0000
Message-ID: <175777292362.25.2945362679015509989@463a07221176> (raw)

PR #20514 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20514
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20514.patch


From d445724e8c68535bcd571821e8ee5e36a93da54f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Sat, 13 Sep 2025 16:10:51 +0200
Subject: [PATCH 1/2] swscale/ops_chain: remove type from free function
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

to avoid pointer casting and UB of calling function with different
pointer type.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
 libswscale/ops_backend.c | 2 +-
 libswscale/ops_chain.c   | 5 +++--
 libswscale/ops_chain.h   | 2 +-
 libswscale/x86/ops.c     | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libswscale/ops_backend.c b/libswscale/ops_backend.c
index ac76dedbee..2796f7b42d 100644
--- a/libswscale/ops_backend.c
+++ b/libswscale/ops_backend.c
@@ -98,7 +98,7 @@ static int compile(SwsContext *ctx, SwsOpList *ops, SwsCompiledOp *out)
         .block_size = SWS_BLOCK_SIZE,
         .cpu_flags  = chain->cpu_flags,
         .priv       = chain,
-        .free       = (void (*)(void *)) ff_sws_op_chain_free,
+        .free       = ff_sws_op_chain_free,
     };
     return 0;
 }
diff --git a/libswscale/ops_chain.c b/libswscale/ops_chain.c
index ef768b4904..e613470438 100644
--- a/libswscale/ops_chain.c
+++ b/libswscale/ops_chain.c
@@ -31,11 +31,12 @@ SwsOpChain *ff_sws_op_chain_alloc(void)
     return av_mallocz(sizeof(SwsOpChain));
 }
 
-void ff_sws_op_chain_free(SwsOpChain *chain)
+void ff_sws_op_chain_free(void *ptr)
 {
-    if (!chain)
+    if (!ptr)
         return;
 
+    SwsOpChain *chain = ptr;
     for (int i = 0; i < chain->num_impl + 1; i++) {
         if (chain->free[i])
             chain->free[i](chain->impl[i].priv.ptr);
diff --git a/libswscale/ops_chain.h b/libswscale/ops_chain.h
index ceff7e4e7e..f8bc55064e 100644
--- a/libswscale/ops_chain.h
+++ b/libswscale/ops_chain.h
@@ -86,7 +86,7 @@ typedef struct SwsOpChain {
 } SwsOpChain;
 
 SwsOpChain *ff_sws_op_chain_alloc(void);
-void ff_sws_op_chain_free(SwsOpChain *chain);
+void ff_sws_op_chain_free(void *chain);
 
 /* Returns 0 on success, or a negative error code. */
 int ff_sws_op_chain_append(SwsOpChain *chain, SwsFuncPtr func,
diff --git a/libswscale/x86/ops.c b/libswscale/x86/ops.c
index 82a6d233b9..e147c5916b 100644
--- a/libswscale/x86/ops.c
+++ b/libswscale/x86/ops.c
@@ -649,7 +649,7 @@ static int compile(SwsContext *ctx, SwsOpList *ops, SwsCompiledOp *out)
 
     *out = (SwsCompiledOp) {
         .priv = chain,
-        .free = (void (*)(void *)) ff_sws_op_chain_free,
+        .free = ff_sws_op_chain_free,
 
         /* Use at most two full YMM regs during the widest precision section */
         .block_size = 2 * FFMIN(mmsize, 32) / ff_sws_op_list_max_size(ops),
-- 
2.49.1


From e7dc5619a2869565630f4b13310bb95dd6d4766c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Sat, 13 Sep 2025 16:12:16 +0200
Subject: [PATCH 2/2] swscale/ops_tmpl_int: remove unused arguments from wrap
 read decl
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
 libswscale/ops_backend.h  | 6 +++++-
 libswscale/ops_tmpl_int.c | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libswscale/ops_backend.h b/libswscale/ops_backend.h
index 7880bb608e..32c6a3a7da 100644
--- a/libswscale/ops_backend.h
+++ b/libswscale/ops_backend.h
@@ -110,7 +110,11 @@ typedef struct SwsOpIter {
     static SWS_FUNC void fn(NAME)(SwsOpIter *restrict iter,                     \
                                   const SwsOpImpl *restrict impl,               \
                                   block_t x, block_t y,                         \
-                                  block_t z, block_t w)                         \
+                                  block_t z, block_t w)
+
+#define DECL_WRAP_IMPL(NAME, ...)                                               \
+    static SWS_FUNC void fn(NAME)(SwsOpIter *restrict iter,                     \
+                                  const SwsOpImpl *restrict impl)
 
 /* Helper macro to call into the next continuation with a given type */
 #define CONTINUE(TYPE, ...)                                                     \
diff --git a/libswscale/ops_tmpl_int.c b/libswscale/ops_tmpl_int.c
index 0337ae5708..c693fd3a58 100644
--- a/libswscale/ops_tmpl_int.c
+++ b/libswscale/ops_tmpl_int.c
@@ -121,7 +121,7 @@ DECL_WRITE(write_packed, const int elems)
 }
 
 #define WRAP_READ(FUNC, ELEMS, FRAC, PACKED)                                    \
-DECL_IMPL(FUNC##ELEMS)                                                          \
+DECL_WRAP_IMPL(FUNC##ELEMS)                                                     \
 {                                                                               \
     CALL_READ(FUNC, ELEMS);                                                     \
     for (int i = 0; i < (PACKED ? 1 : ELEMS); i++)                              \
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2025-09-13 14:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=175777292362.25.2945362679015509989@463a07221176 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@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