diff mbox series

[FFmpeg-devel,37/41] swscale/x86/rgb2rgb: Disable overridden functions on x64

Message ID DB6PR0101MB2214C20D3CA81712825ECEF28FA79@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:55 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
the MMX and 3dnow implementations (overridden by MMXEXT)
and a single MMXEXT function (overridden by SSE2)
at compile-time for x64.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libswscale/x86/rgb2rgb.c          |  6 ++++++
 libswscale/x86/rgb2rgb_template.c | 10 ++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c
index 0ab139aca4..d8dfbbca35 100644
--- a/libswscale/x86/rgb2rgb.c
+++ b/libswscale/x86/rgb2rgb.c
@@ -91,9 +91,11 @@  DECLARE_ALIGNED(8, extern const uint64_t, ff_bgr2UVOffset);
 #define COMPILE_TEMPLATE_AVX 0
 
 //MMX versions
+#if ARCH_X86_32
 #undef RENAME
 #define RENAME(a) a ## _mmx
 #include "rgb2rgb_template.c"
+#endif
 
 // MMXEXT versions
 #undef RENAME
@@ -116,6 +118,7 @@  DECLARE_ALIGNED(8, extern const uint64_t, ff_bgr2UVOffset);
 #define RENAME(a) a ## _avx
 #include "rgb2rgb_template.c"
 
+#if ARCH_X86_32
 //3DNOW versions
 #undef RENAME
 #undef COMPILE_TEMPLATE_MMXEXT
@@ -128,6 +131,7 @@  DECLARE_ALIGNED(8, extern const uint64_t, ff_bgr2UVOffset);
 #define COMPILE_TEMPLATE_AMD3DNOW 1
 #define RENAME(a) a ## _3dnow
 #include "rgb2rgb_template.c"
+#endif
 
 /*
  RGB15->RGB16 original by Strepto/Astral
@@ -165,10 +169,12 @@  av_cold void rgb2rgb_init_x86(void)
     int cpu_flags = av_get_cpu_flags();
 
 #if HAVE_INLINE_ASM
+#if ARCH_X86_32
     if (INLINE_MMX(cpu_flags))
         rgb2rgb_init_mmx();
     if (INLINE_AMD3DNOW(cpu_flags))
         rgb2rgb_init_3dnow();
+#endif
     if (INLINE_MMXEXT(cpu_flags))
         rgb2rgb_init_mmxext();
     if (INLINE_SSE2(cpu_flags))
diff --git a/libswscale/x86/rgb2rgb_template.c b/libswscale/x86/rgb2rgb_template.c
index ae2469e663..ae7af550e0 100644
--- a/libswscale/x86/rgb2rgb_template.c
+++ b/libswscale/x86/rgb2rgb_template.c
@@ -1822,7 +1822,7 @@  static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_
 #endif /* HAVE_7REGS */
 #endif /* !COMPILE_TEMPLATE_SSE2 */
 
-#if !COMPILE_TEMPLATE_AMD3DNOW && !COMPILE_TEMPLATE_AVX
+#if !COMPILE_TEMPLATE_AMD3DNOW && !COMPILE_TEMPLATE_AVX && (ARCH_X86_32 || COMPILE_TEMPLATE_SSE2)
 static void RENAME(interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dest,
                                     int width, int height, int src1Stride,
                                     int src2Stride, int dstStride)
@@ -2185,7 +2185,7 @@  static void RENAME(extract_odd)(const uint8_t *src, uint8_t *dst, x86_reg count)
     }
 }
 
-#if !COMPILE_TEMPLATE_AMD3DNOW
+#if !COMPILE_TEMPLATE_AMD3DNOW && ARCH_X86_32
 static void RENAME(extract_even2)(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, x86_reg count)
 {
     dst0+=   count;
@@ -2465,7 +2465,7 @@  static void RENAME(uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, co
         );
 }
 
-#if !COMPILE_TEMPLATE_AMD3DNOW
+#if !COMPILE_TEMPLATE_AMD3DNOW && ARCH_X86_32
 static void RENAME(uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
                                  int width, int height,
                                  int lumStride, int chromStride, int srcStride)
@@ -2519,7 +2519,9 @@  static av_cold void RENAME(rgb2rgb_init)(void)
     yuy2toyv12         = RENAME(yuy2toyv12);
     vu9_to_vu12        = RENAME(vu9_to_vu12);
     yvu9_to_yuy2       = RENAME(yvu9_to_yuy2);
+#if ARCH_X86_32
     uyvytoyuv422       = RENAME(uyvytoyuv422);
+#endif
     yuyvtoyuv422       = RENAME(yuyvtoyuv422);
 #endif /* !COMPILE_TEMPLATE_AMD3DNOW */
 
@@ -2534,7 +2536,7 @@  static av_cold void RENAME(rgb2rgb_init)(void)
     uyvytoyuv420       = RENAME(uyvytoyuv420);
 #endif /* !COMPILE_TEMPLATE_SSE2 */
 
-#if !COMPILE_TEMPLATE_AMD3DNOW && !COMPILE_TEMPLATE_AVX
+#if !COMPILE_TEMPLATE_AMD3DNOW && !COMPILE_TEMPLATE_AVX && (ARCH_X86_32 || COMPILE_TEMPLATE_SSE2)
     interleaveBytes    = RENAME(interleaveBytes);
 #endif /* !COMPILE_TEMPLATE_AMD3DNOW && !COMPILE_TEMPLATE_AVX */
 #if !COMPILE_TEMPLATE_AVX || HAVE_AVX_EXTERNAL