[FFmpeg-devel] [PATCH 28/41] avcodec/x86/svq1enc_init: Disable overridden functions on x64

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

diff --git a/libavcodec/x86/svq1enc.asm b/libavcodec/x86/svq1enc.asm
index a87632836d..a43d3b4029 100644
--- a/libavcodec/x86/svq1enc.asm
+++ b/libavcodec/x86/svq1enc.asm
@@ -55,7 +55,9 @@ cglobal ssd_int8_vs_int16, 3, 3, 3, pix1, pix2, size
     RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 SSD_INT8_VS_INT16
+%endif
 INIT_XMM sse2
 SSD_INT8_VS_INT16
diff --git a/libavcodec/x86/svq1enc_init.c b/libavcodec/x86/svq1enc_init.c
index 40b4b0e183..aaebbb92cc 100644
--- a/libavcodec/x86/svq1enc_init.c
+++ b/libavcodec/x86/svq1enc_init.c
@@ -33,9 +33,11 @@ av_cold void ff_svq1enc_init_x86(SVQ1EncContext *c)
 {
     int cpu_flags = av_get_cpu_flags();
 
+#if ARCH_X86_32
     if (EXTERNAL_MMX(cpu_flags)) {
         c->ssd_int8_vs_int16 = ff_ssd_int8_vs_int16_mmx;
     }
+#endif
     if (EXTERNAL_SSE2(cpu_flags)) {
         c->ssd_int8_vs_int16 = ff_ssd_int8_vs_int16_sse2;
     }
-- 
2.34.1



More information about the ffmpeg-devel mailing list