Commit 35ef294f5d for ffmpeg
commit 35ef294f5d9d6c5b9a13abb59a4eedb1d0c875a3
Author: Martin Storsjö <martin@martin.st>
Date: Wed Nov 25 14:57:02 2026 +0200
avcodec/x86/vc1dsp_mc: Fix running on x86_32 with realigned stack
This fixes running on x86_32 on Windows, built with Clang or
MSVC, after 928e58c8d3abef8df7dfa782ac687c5f5e905ad5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
diff --git a/libavcodec/x86/vc1dsp_mc.asm b/libavcodec/x86/vc1dsp_mc.asm
index 0f75a6acb7..373c202e17 100644
--- a/libavcodec/x86/vc1dsp_mc.asm
+++ b/libavcodec/x86/vc1dsp_mc.asm
@@ -471,8 +471,13 @@ put_mspel_ver_%2_%1_ssse3:
DEFINE_ARGS coeffs, src, stride, rnd1, tmp
%endif
%define hd rnd1d
-; Necessary to ensure that reading memory args works.
+; Necessary to ensure that reading memory args works, after a call which
+; pushed a return address on the stack. If the stack had to be realigned,
+; memory args are accessed relative to the saved stack pointer (rstk)
+; instead of rsp, which is unaffected by the call.
+%ifidn rstk, rsp
%assign stack_offset stack_offset+gprsize
+%endif
neg strideq
dec srcq
movd m0, rnd1d
@@ -627,7 +632,9 @@ put_mspel_ver_%2_%1_ssse3:
%endif
mov hd, %1
SPLATW m0, m0
+%ifidn rstk, rsp
%assign stack_offset stack_offset-gprsize
+%endif
ret
%endmacro