diff mbox series

[FFmpeg-devel,10/41] avcodec/x86/ac3dsp_init: Disable overridden functions on x64

Message ID DB6PR0101MB2214E0CE0776DD1191C7DA458FA79@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com
State Superseded
Headers show
Series Stop including superseded functions for x64 | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt June 9, 2022, 11:54 p.m. UTC
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 such AC-3 functions
at compile-time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/x86/ac3dsp.asm    | 5 +++++
 libavcodec/x86/ac3dsp_init.c | 2 ++
 2 files changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm
index 4ddaa94320..050cbfe06a 100644
--- a/libavcodec/x86/ac3dsp.asm
+++ b/libavcodec/x86/ac3dsp.asm
@@ -64,6 +64,7 @@  cglobal ac3_exponent_min, 3, 4, 2, exp, reuse_blks, expn, offset
 %endmacro
 
 %define LOOP_ALIGN
+%if ARCH_X86_32
 INIT_MMX mmx
 AC3_EXPONENT_MIN
 %if HAVE_MMXEXT_EXTERNAL
@@ -71,7 +72,9 @@  AC3_EXPONENT_MIN
 INIT_MMX mmxext
 AC3_EXPONENT_MIN
 %endif
+%endif
 %if HAVE_SSE2_EXTERNAL
+%define LOOP_ALIGN ALIGN 16
 INIT_XMM sse2
 AC3_EXPONENT_MIN
 %endif
@@ -81,6 +84,7 @@  AC3_EXPONENT_MIN
 ; void ff_float_to_fixed24(int32_t *dst, const float *src, unsigned int len)
 ;-----------------------------------------------------------------------------
 
+%if ARCH_X86_32
 ; The 3DNow! version is not bit-identical because pf2id uses truncation rather
 ; than round-to-nearest.
 INIT_MMX 3dnow
@@ -134,6 +138,7 @@  cglobal float_to_fixed24, 3, 3, 3, dst, src, len
     ja .loop
     emms
     RET
+%endif
 
 INIT_XMM sse2
 cglobal float_to_fixed24, 3, 3, 9, dst, src, len
diff --git a/libavcodec/x86/ac3dsp_init.c b/libavcodec/x86/ac3dsp_init.c
index 5f20e6dc31..47ec5d8070 100644
--- a/libavcodec/x86/ac3dsp_init.c
+++ b/libavcodec/x86/ac3dsp_init.c
@@ -41,6 +41,7 @@  av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
 {
     int cpu_flags = av_get_cpu_flags();
 
+#if ARCH_X86_32
     if (EXTERNAL_MMX(cpu_flags)) {
         c->ac3_exponent_min = ff_ac3_exponent_min_mmx;
     }
@@ -55,6 +56,7 @@  av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
     if (EXTERNAL_SSE(cpu_flags)) {
         c->float_to_fixed24 = ff_float_to_fixed24_sse;
     }
+#endif
     if (EXTERNAL_SSE2(cpu_flags)) {
         c->ac3_exponent_min = ff_ac3_exponent_min_sse2;
         c->float_to_fixed24 = ff_float_to_fixed24_sse2;