[FFmpeg-devel] [PATCH 25/41] avcodec/x86/blockdsp_init: Disable overridden functions on x64
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Fri Jun 10 02:55:07 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 SSE
specific implementation) at compile-time for x64.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavcodec/x86/blockdsp.asm | 4 ++++
libavcodec/x86/blockdsp_init.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/libavcodec/x86/blockdsp.asm b/libavcodec/x86/blockdsp.asm
index 9d203df8f5..dfa38f1d3d 100644
--- a/libavcodec/x86/blockdsp.asm
+++ b/libavcodec/x86/blockdsp.asm
@@ -46,9 +46,11 @@ cglobal clear_block, 1, 1, %1, blocks
RET
%endmacro
+%if ARCH_X86_32
INIT_MMX mmx
%define ZERO pxor
CLEAR_BLOCK 0, 4
+%endif
INIT_XMM sse
%define ZERO xorps
CLEAR_BLOCK 1, 2
@@ -78,9 +80,11 @@ cglobal clear_blocks, 1, 2, %1, blocks, len
RET
%endmacro
+%if ARCH_X86_32
INIT_MMX mmx
%define ZERO pxor
CLEAR_BLOCKS 0
+%endif
INIT_XMM sse
%define ZERO xorps
CLEAR_BLOCKS 1
diff --git a/libavcodec/x86/blockdsp_init.c b/libavcodec/x86/blockdsp_init.c
index d7f8a8e508..3b857a51b6 100644
--- a/libavcodec/x86/blockdsp_init.c
+++ b/libavcodec/x86/blockdsp_init.c
@@ -37,10 +37,12 @@ av_cold void ff_blockdsp_init_x86(BlockDSPContext *c,
#if HAVE_X86ASM
int cpu_flags = av_get_cpu_flags();
+#if ARCH_X86_32
if (EXTERNAL_MMX(cpu_flags)) {
c->clear_block = ff_clear_block_mmx;
c->clear_blocks = ff_clear_blocks_mmx;
}
+#endif
if (EXTERNAL_SSE(cpu_flags)) {
c->clear_block = ff_clear_block_sse;
--
2.34.1
More information about the ffmpeg-devel
mailing list