[FFmpeg-devel] [PATCH 36/41] swresample/x86/rematrix_init: Disable overridden functions on x64

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Fri Jun 10 02:55:18 EEST 2022


x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the MMX implementation (which is overridden by the SSE2
specific implementation) at compile-time for x64.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libswresample/x86/rematrix.asm    | 2 ++
 libswresample/x86/rematrix_init.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/libswresample/x86/rematrix.asm b/libswresample/x86/rematrix.asm
index 7984b9a729..1c657ff72f 100644
--- a/libswresample/x86/rematrix.asm
+++ b/libswresample/x86/rematrix.asm
@@ -223,11 +223,13 @@ mix_2_1_int16_u_int %+ SUFFIX:
 %endmacro
 
 
+%if ARCH_X86_32
 INIT_MMX mmx
 MIX1_INT16 u
 MIX1_INT16 a
 MIX2_INT16 u
 MIX2_INT16 a
+%endif
 
 INIT_XMM sse
 MIX2_FLT u
diff --git a/libswresample/x86/rematrix_init.c b/libswresample/x86/rematrix_init.c
index 0608c74e7f..3981de4277 100644
--- a/libswresample/x86/rematrix_init.c
+++ b/libswresample/x86/rematrix_init.c
@@ -43,10 +43,12 @@ av_cold int swri_rematrix_init_x86(struct SwrContext *s){
     s->mix_2_1_simd = NULL;
 
     if (s->midbuf.fmt == AV_SAMPLE_FMT_S16P){
+#if ARCH_X86_32
         if(EXTERNAL_MMX(mm_flags)) {
             s->mix_1_1_simd = ff_mix_1_1_a_int16_mmx;
             s->mix_2_1_simd = ff_mix_2_1_a_int16_mmx;
         }
+#endif
         if(EXTERNAL_SSE2(mm_flags)) {
             s->mix_1_1_simd = ff_mix_1_1_a_int16_sse2;
             s->mix_2_1_simd = ff_mix_2_1_a_int16_sse2;
-- 
2.34.1



More information about the ffmpeg-devel mailing list