1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

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.
This commit is contained in:
Martin Storsjö
2025-09-03 14:03:28 +03:00
parent 9d037c54f2
commit a3360c0eaf
3 changed files with 5 additions and 5 deletions

View File

@@ -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);

View File

@@ -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 */

View File

@@ -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)