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

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Fri Jun 10 02:55:17 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/audio_convert.asm    | 2 ++
 libswresample/x86/audio_convert_init.c | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/libswresample/x86/audio_convert.asm b/libswresample/x86/audio_convert.asm
index d441636d3c..d2413f9f04 100644
--- a/libswresample/x86/audio_convert.asm
+++ b/libswresample/x86/audio_convert.asm
@@ -608,6 +608,7 @@ pack_8ch_%2_to_%1_u_int %+ SUFFIX:
 %macro NOP_N 0-6
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 CONV int32, int16, u, 2, 1, INT16_TO_INT32_N, NOP_N
 CONV int32, int16, a, 2, 1, INT16_TO_INT32_N, NOP_N
@@ -616,6 +617,7 @@ CONV int16, int32, a, 1, 2, INT32_TO_INT16_N, NOP_N
 
 PACK_6CH float, float, u, 2, 2, 0, NOP_N, NOP_N
 PACK_6CH float, float, a, 2, 2, 0, NOP_N, NOP_N
+%endif
 
 INIT_XMM sse
 PACK_6CH float, float, u, 2, 2, 7, NOP_N, NOP_N
diff --git a/libswresample/x86/audio_convert_init.c b/libswresample/x86/audio_convert_init.c
index a7d5ab89f8..7728c9ae00 100644
--- a/libswresample/x86/audio_convert_init.c
+++ b/libswresample/x86/audio_convert_init.c
@@ -52,15 +52,19 @@ av_cold void swri_audio_convert_init_x86(struct AudioConvert *ac,
             ac->simd_f =  ff_int32_to_int16_a_ ## cap;\
     }
 
+#if ARCH_X86_32
 MULTI_CAPS_FUNC(MMX, mmx)
+#endif
 MULTI_CAPS_FUNC(SSE2, sse2)
 
+#if ARCH_X86_32
     if(EXTERNAL_MMX(mm_flags)) {
         if(channels == 6) {
             if(   out_fmt == AV_SAMPLE_FMT_FLT  && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
                 ac->simd_f =  ff_pack_6ch_float_to_float_a_mmx;
         }
     }
+#endif
     if(EXTERNAL_SSE(mm_flags)) {
         if(channels == 6) {
             if(   out_fmt == AV_SAMPLE_FMT_FLT  && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
-- 
2.34.1



More information about the ffmpeg-devel mailing list