PR #26356 opened by Martin Storsjö (mstorsjo)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26356
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26356.patch

This fixes running on x86_32 on Windows, built with Clang or
MSVC, after 928e58c8d3abef8df7dfa782ac687c5f5e905ad5.

Co-Authored-By: Claude Opus 5.5 <[email protected]>



From 8fa2136a5c60d01bb9b219a41ec27edb47fbabe4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <[email protected]>
Date: Wed, 25 Nov 2026 14:57:02 +0200
Subject: [PATCH] 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 <[email protected]>
---
 libavcodec/x86/vc1dsp_mc.asm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavcodec/x86/vc1dsp_mc.asm b/libavcodec/x86/vc1dsp_mc.asm
index 0f75a6acb77..373c202e178 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
 
-- 
2.54.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to