[FFmpeg-devel] [PATCH 27/41] avcodec/x86/lossless_audiodsp_init: Disable overridden functions on x64
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Fri Jun 10 02:55:09 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>
---
libavcodec/x86/lossless_audiodsp.asm | 2 ++
libavcodec/x86/lossless_audiodsp_init.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/libavcodec/x86/lossless_audiodsp.asm b/libavcodec/x86/lossless_audiodsp.asm
index 063d7b41af..ad8a34531a 100644
--- a/libavcodec/x86/lossless_audiodsp.asm
+++ b/libavcodec/x86/lossless_audiodsp.asm
@@ -63,8 +63,10 @@ cglobal scalarproduct_and_madd_int16, 4,4,8, v1, v2, v3, order, mul
RET
%endmacro
+%if ARCH_X86_32
INIT_MMX mmxext
SCALARPRODUCT
+%endif
INIT_XMM sse2
SCALARPRODUCT
diff --git a/libavcodec/x86/lossless_audiodsp_init.c b/libavcodec/x86/lossless_audiodsp_init.c
index f74c7e4361..f90cab55d3 100644
--- a/libavcodec/x86/lossless_audiodsp_init.c
+++ b/libavcodec/x86/lossless_audiodsp_init.c
@@ -40,8 +40,10 @@ av_cold void ff_llauddsp_init_x86(LLAudDSPContext *c)
#if HAVE_X86ASM
int cpu_flags = av_get_cpu_flags();
+#if ARCH_X86_32
if (EXTERNAL_MMXEXT(cpu_flags))
c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_mmxext;
+#endif
if (EXTERNAL_SSE2(cpu_flags))
c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_sse2;
--
2.34.1
More information about the ffmpeg-devel
mailing list