[FFmpeg-cvslog] avcodec/x86/mpegvideoenc: Remove obsolete MMX(EXT) functions

Andreas Rheinhardt git at videolan.org
Wed Jun 22 15:28:19 EEST 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Jun  7 02:06:41 2022 +0200| [7284ab789d5fe271b9d6a1666ab5ea6be8724cca] | committer: Andreas Rheinhardt

avcodec/x86/mpegvideoenc: Remove obsolete MMX(EXT) functions

x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2) for x64. So given that the only systems that
benefit from these functions are truely ancient 32bit x86s
they are removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7284ab789d5fe271b9d6a1666ab5ea6be8724cca
---

 libavcodec/x86/mpegvideoenc.c          | 95 +---------------------------------
 libavcodec/x86/mpegvideoenc_template.c | 10 ----
 2 files changed, 1 insertion(+), 104 deletions(-)

diff --git a/libavcodec/x86/mpegvideoenc.c b/libavcodec/x86/mpegvideoenc.c
index 3691cce26c..612e7ff758 100644
--- a/libavcodec/x86/mpegvideoenc.c
+++ b/libavcodec/x86/mpegvideoenc.c
@@ -42,34 +42,9 @@ DECLARE_ALIGNED(16, static const uint16_t, inv_zigzag_direct16)[64] = {
 
 #if HAVE_6REGS
 
-#if HAVE_MMX_INLINE
-#define COMPILE_TEMPLATE_MMXEXT 0
-#define COMPILE_TEMPLATE_SSE2   0
-#define COMPILE_TEMPLATE_SSSE3  0
-#define RENAME(a)      a ## _mmx
-#define RENAME_FDCT(a) a ## _mmx
-#include "mpegvideoenc_template.c"
-#endif /* HAVE_MMX_INLINE */
-
-#if HAVE_MMXEXT_INLINE
-#undef COMPILE_TEMPLATE_SSSE3
-#undef COMPILE_TEMPLATE_SSE2
-#undef COMPILE_TEMPLATE_MMXEXT
-#define COMPILE_TEMPLATE_MMXEXT 1
-#define COMPILE_TEMPLATE_SSE2   0
-#define COMPILE_TEMPLATE_SSSE3  0
-#undef RENAME
-#undef RENAME_FDCT
-#define RENAME(a)      a ## _mmxext
-#define RENAME_FDCT(a) a ## _mmxext
-#include "mpegvideoenc_template.c"
-#endif /* HAVE_MMXEXT_INLINE */
-
 #if HAVE_SSE2_INLINE
-#undef COMPILE_TEMPLATE_MMXEXT
 #undef COMPILE_TEMPLATE_SSE2
 #undef COMPILE_TEMPLATE_SSSE3
-#define COMPILE_TEMPLATE_MMXEXT 0
 #define COMPILE_TEMPLATE_SSE2   1
 #define COMPILE_TEMPLATE_SSSE3  0
 #undef RENAME
@@ -80,10 +55,8 @@ DECLARE_ALIGNED(16, static const uint16_t, inv_zigzag_direct16)[64] = {
 #endif /* HAVE_SSE2_INLINE */
 
 #if HAVE_SSSE3_INLINE
-#undef COMPILE_TEMPLATE_MMXEXT
 #undef COMPILE_TEMPLATE_SSE2
 #undef COMPILE_TEMPLATE_SSSE3
-#define COMPILE_TEMPLATE_MMXEXT 0
 #define COMPILE_TEMPLATE_SSE2   1
 #define COMPILE_TEMPLATE_SSSE3  1
 #undef RENAME
@@ -96,62 +69,6 @@ DECLARE_ALIGNED(16, static const uint16_t, inv_zigzag_direct16)[64] = {
 #endif /* HAVE_6REGS */
 
 #if HAVE_INLINE_ASM
-#if HAVE_MMX_INLINE
-static void  denoise_dct_mmx(MpegEncContext *s, int16_t *block){
-    const int intra= s->mb_intra;
-    int *sum= s->dct_error_sum[intra];
-    uint16_t *offset= s->dct_offset[intra];
-
-    s->dct_count[intra]++;
-
-    __asm__ volatile(
-        "pxor %%mm7, %%mm7                      \n\t"
-        "1:                                     \n\t"
-        "pxor %%mm0, %%mm0                      \n\t"
-        "pxor %%mm1, %%mm1                      \n\t"
-        "movq (%0), %%mm2                       \n\t"
-        "movq 8(%0), %%mm3                      \n\t"
-        "pcmpgtw %%mm2, %%mm0                   \n\t"
-        "pcmpgtw %%mm3, %%mm1                   \n\t"
-        "pxor %%mm0, %%mm2                      \n\t"
-        "pxor %%mm1, %%mm3                      \n\t"
-        "psubw %%mm0, %%mm2                     \n\t"
-        "psubw %%mm1, %%mm3                     \n\t"
-        "movq %%mm2, %%mm4                      \n\t"
-        "movq %%mm3, %%mm5                      \n\t"
-        "psubusw (%2), %%mm2                    \n\t"
-        "psubusw 8(%2), %%mm3                   \n\t"
-        "pxor %%mm0, %%mm2                      \n\t"
-        "pxor %%mm1, %%mm3                      \n\t"
-        "psubw %%mm0, %%mm2                     \n\t"
-        "psubw %%mm1, %%mm3                     \n\t"
-        "movq %%mm2, (%0)                       \n\t"
-        "movq %%mm3, 8(%0)                      \n\t"
-        "movq %%mm4, %%mm2                      \n\t"
-        "movq %%mm5, %%mm3                      \n\t"
-        "punpcklwd %%mm7, %%mm4                 \n\t"
-        "punpckhwd %%mm7, %%mm2                 \n\t"
-        "punpcklwd %%mm7, %%mm5                 \n\t"
-        "punpckhwd %%mm7, %%mm3                 \n\t"
-        "paddd (%1), %%mm4                      \n\t"
-        "paddd 8(%1), %%mm2                     \n\t"
-        "paddd 16(%1), %%mm5                    \n\t"
-        "paddd 24(%1), %%mm3                    \n\t"
-        "movq %%mm4, (%1)                       \n\t"
-        "movq %%mm2, 8(%1)                      \n\t"
-        "movq %%mm5, 16(%1)                     \n\t"
-        "movq %%mm3, 24(%1)                     \n\t"
-        "add $16, %0                            \n\t"
-        "add $32, %1                            \n\t"
-        "add $16, %2                            \n\t"
-        "cmp %3, %0                             \n\t"
-            " jb 1b                             \n\t"
-        : "+r" (block), "+r" (sum), "+r" (offset)
-        : "r"(block+64)
-    );
-}
-#endif /* HAVE_MMX_INLINE */
-
 #if HAVE_SSE2_INLINE
 static void  denoise_dct_sse2(MpegEncContext *s, int16_t *block){
     const int intra= s->mb_intra;
@@ -218,17 +135,6 @@ av_cold void ff_dct_encode_init_x86(MpegEncContext *s)
     if (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX) {
 #if HAVE_MMX_INLINE
         int cpu_flags = av_get_cpu_flags();
-        if (INLINE_MMX(cpu_flags)) {
-#if HAVE_6REGS
-            s->dct_quantize = dct_quantize_mmx;
-#endif
-            s->denoise_dct  = denoise_dct_mmx;
-        }
-#endif
-#if HAVE_6REGS && HAVE_MMXEXT_INLINE
-        if (INLINE_MMXEXT(cpu_flags))
-            s->dct_quantize = dct_quantize_mmxext;
-#endif
 #if HAVE_SSE2_INLINE
         if (INLINE_SSE2(cpu_flags)) {
 #if HAVE_6REGS
@@ -240,6 +146,7 @@ av_cold void ff_dct_encode_init_x86(MpegEncContext *s)
 #if HAVE_6REGS && HAVE_SSSE3_INLINE
         if (INLINE_SSSE3(cpu_flags))
             s->dct_quantize = dct_quantize_ssse3;
+#endif
 #endif
     }
 }
diff --git a/libavcodec/x86/mpegvideoenc_template.c b/libavcodec/x86/mpegvideoenc_template.c
index 30c06a6b2c..b5b0a5ffa2 100644
--- a/libavcodec/x86/mpegvideoenc_template.c
+++ b/libavcodec/x86/mpegvideoenc_template.c
@@ -57,15 +57,6 @@
 #define MMREG_WIDTH "8"
 #define MM "%%mm"
 #define MOVQ "movq"
-#if COMPILE_TEMPLATE_MMXEXT
-#define SPREADW(a) "pshufw $0, "a", "a" \n\t"
-#define PMAXW(a,b) "pmaxsw "a", "b"     \n\t"
-#define PMAX(a,b) \
-            "pshufw $0x0E, "a", "b"     \n\t"\
-            PMAXW(b, a)\
-            "pshufw $0x01, "a", "b"     \n\t"\
-            PMAXW(b, a)
-#else
 #define SPREADW(a) \
             "punpcklwd "a", "a"         \n\t"\
             "punpcklwd "a", "a"         \n\t"
@@ -81,7 +72,6 @@
             PMAXW(b, a)
 
 #endif
-#endif
 
 #if COMPILE_TEMPLATE_SSSE3
 #define SAVE_SIGN(a,b) \



More information about the ffmpeg-cvslog mailing list