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

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

diff --git a/libavcodec/x86/fmtconvert.asm b/libavcodec/x86/fmtconvert.asm
index 8f62a0a093..5b7578825a 100644
--- a/libavcodec/x86/fmtconvert.asm
+++ b/libavcodec/x86/fmtconvert.asm
@@ -71,8 +71,10 @@ cglobal int32_to_float_fmul_scalar, 4, 4, %1, dst, src, mul, len
     RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_XMM sse
 INT32_TO_FLOAT_FMUL_SCALAR 5
+%endif
 INIT_XMM sse2
 INT32_TO_FLOAT_FMUL_SCALAR 3
 
@@ -117,8 +119,10 @@ cglobal int32_to_float_fmul_array8, 5, 5, 5, c, dst, src, mul, len
     RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_XMM sse
 INT32_TO_FLOAT_FMUL_ARRAY8
+%endif
 INIT_XMM sse2
 INT32_TO_FLOAT_FMUL_ARRAY8
 
diff --git a/libavcodec/x86/fmtconvert_init.c b/libavcodec/x86/fmtconvert_init.c
index df097054e4..0883cd8a56 100644
--- a/libavcodec/x86/fmtconvert_init.c
+++ b/libavcodec/x86/fmtconvert_init.c
@@ -43,10 +43,12 @@ av_cold void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx
 #if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
+#if ARCH_X86_32
     if (EXTERNAL_SSE(cpu_flags)) {
         c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_sse;
         c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_sse;
     }
+#endif
     if (EXTERNAL_SSE2(cpu_flags)) {
         c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_sse2;
         c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_sse2;
-- 
2.34.1



More information about the ffmpeg-devel mailing list