[vlc-commits] [Git][videolan/vlc][master] libmpeg2: switch SIMD selection to auto-detect mode

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Jul 24 07:30:53 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
00d1f50e by Lyndon Brown at 2021-07-24T07:11:06+00:00
libmpeg2: switch SIMD selection to auto-detect mode

this:
 - enables SSE2 (when available at runtime), which was added 13 years ago
   ([1]) but we never enabled use of it until now.
 - removes use of the MMX/MMXEXT availability testing functions, helping
   pave the way towards our goal of purging all MMX/MMXEXT code.
 - makes the code cleaner and reduces maintenance burden.
 - allows us to pick up use of new SIMD variant additions, if any more are
   ever added (unlikely) without having to explicitly add code to enable it.

as pointed out in review, the `mpeg2_init()` call makes a call to
`mpeg2_accel()` with `MPEG2_ACCEL_DETECT` itself, so there is no need to
make such a call ourselves, thus the `mpeg2_init()` call alone is
sufficient. the entire code block can thus be safely removed.

[1]: https://code.videolan.org/videolan/libmpeg2/-/commit/c80d1dc2f1c78fbb6bc01635a7e5946ce2732683

- - - - -


1 changed file:

- modules/codec/libmpeg2.c


Changes:

=====================================
modules/codec/libmpeg2.c
=====================================
@@ -148,7 +148,6 @@ static int OpenDecoder( vlc_object_t *p_this )
 {
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
-    uint32_t i_accel = 0;
 
     if( p_dec->fmt_in.i_codec != VLC_CODEC_MPGV )
         return VLC_EGENERIC;
@@ -198,34 +197,6 @@ static int OpenDecoder( vlc_object_t *p_this )
     p_sys->p_gop_user_data = NULL;
     p_sys->i_gop_user_data = 0;
 
-#if defined( __i386__ ) || defined( __x86_64__ )
-    if( vlc_CPU_MMX() )
-        i_accel |= MPEG2_ACCEL_X86_MMX;
-    if( vlc_CPU_MMXEXT() )
-        i_accel |= MPEG2_ACCEL_X86_MMXEXT;
-#elif defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc64__ )
-    if( vlc_CPU_ALTIVEC() )
-        i_accel |= MPEG2_ACCEL_PPC_ALTIVEC;
-
-#elif defined(__arm__)
-# ifdef MPEG2_ACCEL_ARM
-    i_accel |= MPEG2_ACCEL_ARM;
-# endif
-# ifdef MPEG2_ACCEL_ARM_NEON
-    if( vlc_CPU_ARM_NEON() )
-        i_accel |= MPEG2_ACCEL_ARM_NEON;
-# endif
-
-    /* TODO: sparc */
-#else
-    /* If we do not know this CPU, trust libmpeg2's feature detection */
-    i_accel = MPEG2_ACCEL_DETECT;
-
-#endif
-
-    /* Set CPU acceleration features */
-    mpeg2_accel( i_accel );
-
     /* Initialize decoder */
     p_sys->p_mpeg2dec = mpeg2_init();
     if( p_sys->p_mpeg2dec == NULL)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/00d1f50eff60f30ac77ffe8f4df6af4668affcbd

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/00d1f50eff60f30ac77ffe8f4df6af4668affcbd
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list