# define CPU_CAPABILITY_NEON (0)
# endif
-/** Are floating point oeprations fast?
+VLC_EXPORT( unsigned, vlc_CPU, ( void ) );
+
+/** Are floating point operations fast?
* If this bit is not set, you should try to use fixed-point instead.
*/
-# define CPU_CAPABILITY_FPU (1<<31)
+# if defined (__i386__) || defined (__x86_64__)
+# define HAVE_FPU 1
-VLC_EXPORT( unsigned, vlc_CPU, ( void ) );
+# elif defined (__powerpc__) || defined (__ppc__) || defined (__pc64__)
+# define HAVE_FPU 1
+
+# elif defined (__arm__)
+# define HAVE_FPU 0 /* revisit later? */
+
+# elif defined (__sparc__)
+# define HAVE_FPU 1
+
+# else
+# define HAVE_FPU 0
+
+# endif
typedef void *(*vlc_memcpy_t) (void *tgt, const void *src, size_t n);
typedef void *(*vlc_memset_t) (void *tgt, int c, size_t n);
mad_synth_init( &p_sys->mad_synth );
mad_stream_options( &p_sys->mad_stream, MAD_OPTION_IGNORECRC );
- if( vlc_CPU() & CPU_CAPABILITY_FPU )
- p_filter->fmt_out.i_codec = VLC_CODEC_FL32;
- else
- p_filter->fmt_out.i_codec = VLC_CODEC_FI32;
+ p_filter->fmt_out.i_codec = HAVE_FPU ? VLC_CODEC_FL32 : VLC_CODEC_FI32;
p_filter->fmt_out.audio.i_format = p_filter->fmt_out.i_codec;
p_filter->fmt_out.audio.i_bitspersample =
aout_BitsPerSample( p_filter->fmt_out.i_codec );
/* Choose the linear PCM format (read the comment above about FPU
and float32) */
- if( vlc_CPU() & CPU_CAPABILITY_FPU )
+ if( HAVE_FPU )
{
i_vlc_pcm_format = VLC_CODEC_FL32;
i_snd_pcm_format = SND_PCM_FORMAT_FLOAT;
msg_Dbg(p_aout, "%d audio channels", ss.channels);
ss.rate = p_aout->output.output.i_rate;
- if (vlc_CPU() & CPU_CAPABILITY_FPU)
+ if (HAVE_FPU)
{
ss.format = PA_SAMPLE_FLOAT32NE;
p_aout->output.output.i_format = VLC_CODEC_FL32;
date_Set( &p_sys->date, 0 );
p_dec->fmt_out.i_cat = AUDIO_ES;
- if (vlc_CPU() & CPU_CAPABILITY_FPU)
+ if (HAVE_FPU)
p_dec->fmt_out.i_codec = VLC_CODEC_FL32;
else
p_dec->fmt_out.i_codec = VLC_CODEC_S16N;
/* Set the faad config */
cfg = faacDecGetCurrentConfiguration( p_sys->hfaad );
- if (vlc_CPU() & CPU_CAPABILITY_FPU)
+ if (HAVE_FPU)
cfg->outputFormat = FAAD_FMT_FLOAT;
else
cfg->outputFormat = FAAD_FMT_16BIT;
}
/* Do the actual reordering */
- if( vlc_CPU() & CPU_CAPABILITY_FPU )
+ if( HAVE_FPU )
for( i = 0; i < i_samples; i++ )
for( j = 0; j < i_nb_channels; j++ )
p_out[i * i_nb_channels + pi_chan_table[j]] =
p_dec->fmt_out.audio.i_original_channels =
p_dec->fmt_out.audio.i_physical_channels =
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
- if (vlc_CPU () & CPU_CAPABILITY_FPU)
+ if (HAVE_FPU)
{
p_dec->fmt_out.i_codec = VLC_CODEC_FL32;
p_dec->fmt_out.audio.i_bitspersample = 32;
{
/* Non-S/PDIF mixer only deals with float32 or fixed32. */
p_aout->mixer_format.i_format
- = (vlc_CPU() & CPU_CAPABILITY_FPU) ?
- VLC_CODEC_FL32 : VLC_CODEC_FI32;
+ = HAVE_FPU ? VLC_CODEC_FL32 : VLC_CODEC_FI32;
aout_FormatPrepare( &p_aout->mixer_format );
}
else
"These options allow you to enable special CPU optimizations. " \
"You should always leave all these enabled." )
-#define FPU_TEXT N_("Enable FPU support")
-#define FPU_LONGTEXT N_( \
- "If your processor has a floating point calculation unit, VLC can take " \
- "advantage of it.")
-
#define MMX_TEXT N_("Enable CPU MMX support")
#define MMX_LONGTEXT N_( \
"If your processor supports the MMX instructions set, VLC can take " \
set_category( CAT_ADVANCED )
set_subcategory( SUBCAT_ADVANCED_CPU )
add_category_hint( N_("CPU"), CPU_CAT_LONGTEXT, true )
- add_bool( "fpu", 1, NULL, FPU_TEXT, FPU_LONGTEXT, true )
- change_need_restart ()
+ add_obsolete_bool( "fpu" )
#if defined( __i386__ ) || defined( __x86_64__ )
add_bool( "mmx", 1, NULL, MMX_TEXT, MMX_LONGTEXT, true )
change_need_restart ()
if( priv->b_color )
priv->b_color = config_GetInt( p_libvlc, "color" ) > 0;
- if( !config_GetInt( p_libvlc, "fpu" ) )
- cpu_flags &= ~CPU_CAPABILITY_FPU;
-
char p_capabilities[200];
#define PRINT_CAPABILITY( capability, string ) \
if( vlc_CPU() & capability ) \
#endif
- PRINT_CAPABILITY( CPU_CAPABILITY_FPU, "FPU" );
+#if HAVE_FPU
+ strncat( p_capabilities, "FPU ",
+ sizeof(p_capabilities) - strlen( p_capabilities) );
+ p_capabilities[sizeof(p_capabilities) - 1] = '\0';
+#endif
+
msg_Dbg( p_libvlc, "CPU has capabilities %s", p_capabilities );
/*
: "cc" );
# endif
- i_capabilities |= CPU_CAPABILITY_FPU;
-
# if defined (__i386__) && !defined (__i486__) && !defined (__i586__) \
&& !defined (__i686__) && !defined (__pentium4__) \
&& !defined (__k6__) && !defined (__athlon__) && !defined (__k8__)
out:
#elif defined( __arm__ )
-# if defined( __ARM_EABI__ ) && !defined( __SOFTFP__ )
-// i_capabilities |= CPU_CAPABILITY_FPU;
-# endif
# if defined( __ARM_NEON__ )
i_capabilities |= CPU_CAPABILITY_NEON;
# endif
#elif defined( __powerpc__ ) || defined( __ppc__ ) || defined( __powerpc64__ ) \
|| defined( __ppc64__ )
- i_capabilities |= CPU_CAPABILITY_FPU;
-
# if defined(__APPLE__)
int selectors[2] = { CTL_HW, HW_VECTORUNIT };
int i_has_altivec = 0;
# endif
-#elif defined( __sparc__ )
- i_capabilities |= CPU_CAPABILITY_FPU;
-
-#elif defined( _MSC_VER ) && !defined( UNDER_CE )
- i_capabilities |= CPU_CAPABILITY_FPU;
-
#endif
return i_capabilities;
}