Skip to content
Snippets Groups Projects
Commit 00d1f50e authored by Lyndon Brown's avatar Lyndon Brown Committed by Jean-Baptiste Kempf
Browse files

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]: libmpeg2@c80d1dc2
parent b83abff2
No related branches found
No related tags found
1 merge request!421libmpeg2: enable SSE2 & purge MMX/MMXEXT
Pipeline #120429 passed with stage
in 12 minutes and 34 seconds
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment