* [FFmpeg-devel] [PATCH] swscale: Don't pass a concrete SwsOpPriv as parameter (PR #20413)
@ 2025-09-03 11:40 Martin Storsjö via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Martin Storsjö via ffmpeg-devel @ 2025-09-03 11:40 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Martin Storsjö
PR #20413 opened by Martin Storsjö (mstorsjo)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20413
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20413.patch
This fixes the following compiler error, if compiling with MSVC
for ARM (32 bit):
src/libswscale/ops_chain.c(48): error C2719: 'priv': formal parameter with requested alignment of 16 won't be aligned
This change shouldn't affect the performance of this operation
(which in itself probably isn't relevant); instead of copying the
contents of the SwsOpPriv struct from the stack as parameter,
it gets copied straight from the caller function's stack frame
instead.
Separately from this issue, MSVC 17.8 and 17.9 end up in an
internal compiler error when compiling libswscale/ops.c, but
older and newer versions do compile it successfully.
From 04e504941d181d9f863ba487defd49080787c7a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Wed, 3 Sep 2025 14:03:28 +0300
Subject: [PATCH] swscale: Don't pass a concrete SwsOpPriv as parameter
This fixes the following compiler error, if compiling with MSVC
for ARM (32 bit):
src/libswscale/ops_chain.c(48): error C2719: 'priv': formal parameter with requested alignment of 16 won't be aligned
This change shouldn't affect the performance of this operation
(which in itself probably isn't relevant); instead of copying the
contents of the SwsOpPriv struct from the stack as parameter,
it gets copied straight from the caller function's stack frame
instead.
Separately from this issue, MSVC 17.8 and 17.9 end up in an
internal compiler error when compiling libswscale/ops.c, but
older and newer versions do compile it successfully.
---
libswscale/ops_chain.c | 6 +++---
libswscale/ops_chain.h | 2 +-
libswscale/x86/ops.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libswscale/ops_chain.c b/libswscale/ops_chain.c
index 5d138a9e46..80162507b0 100644
--- a/libswscale/ops_chain.c
+++ b/libswscale/ops_chain.c
@@ -45,7 +45,7 @@ void ff_sws_op_chain_free(SwsOpChain *chain)
}
int ff_sws_op_chain_append(SwsOpChain *chain, SwsFuncPtr func,
- void (*free)(void *), SwsOpPriv priv)
+ void (*free)(void *), const SwsOpPriv *priv)
{
const int idx = chain->num_impl;
if (idx == SWS_MAX_OPS)
@@ -53,7 +53,7 @@ int ff_sws_op_chain_append(SwsOpChain *chain, SwsFuncPtr func,
av_assert1(func);
chain->impl[idx].cont = func;
- chain->impl[idx + 1].priv = priv;
+ chain->impl[idx + 1].priv = *priv;
chain->free[idx + 1] = free;
chain->num_impl++;
return 0;
@@ -231,7 +231,7 @@ int ff_sws_op_compile_tables(const SwsOpTable *const tables[], int num_tables,
}
chain->cpu_flags |= best_cpu_flags;
- ret = ff_sws_op_chain_append(chain, best->func, best->free, priv);
+ ret = ff_sws_op_chain_append(chain, best->func, best->free, &priv);
if (ret < 0) {
if (best->free)
best->free(&priv);
diff --git a/libswscale/ops_chain.h b/libswscale/ops_chain.h
index 777d8e13c1..ceff7e4e7e 100644
--- a/libswscale/ops_chain.h
+++ b/libswscale/ops_chain.h
@@ -90,7 +90,7 @@ void ff_sws_op_chain_free(SwsOpChain *chain);
/* Returns 0 on success, or a negative error code. */
int ff_sws_op_chain_append(SwsOpChain *chain, SwsFuncPtr func,
- void (*free)(void *), SwsOpPriv priv);
+ void (*free)(void *), const SwsOpPriv *priv);
typedef struct SwsOpEntry {
/* Kernel metadata; reduced size subset of SwsOp */
diff --git a/libswscale/x86/ops.c b/libswscale/x86/ops.c
index b3fe5fb014..8704f77227 100644
--- a/libswscale/x86/ops.c
+++ b/libswscale/x86/ops.c
@@ -695,7 +695,7 @@ static int compile(SwsContext *ctx, SwsOpList *ops, SwsCompiledOp *out)
SWS_DECL_FUNC(NAME); \
void NAME##_return(void); \
ret = ff_sws_op_chain_append(chain, NAME##_return, \
- NULL, (SwsOpPriv) {0}); \
+ NULL, &(SwsOpPriv) {0}); \
out->func = NAME; \
} while (0)
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-09-03 11:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-03 11:40 [FFmpeg-devel] [PATCH] swscale: Don't pass a concrete SwsOpPriv as parameter (PR #20413) Martin Storsjö via ffmpeg-devel
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