diff --git a/modules/3dnow/memcpy.c b/modules/3dnow/memcpy.c index 37f33e936792139f61de96e93d0e200f059cf4ba..34b1f8789fca822d40d828c0083384b4867247ee 100644 --- a/modules/3dnow/memcpy.c +++ b/modules/3dnow/memcpy.c @@ -34,6 +34,9 @@ static int Activate( vlc_object_t *p_this ) { + if( !(vlc_CPU() & CPU_CAPABILITY_3DNOW) ) + return VLC_EGENERIC; + VLC_UNUSED(p_this); vlc_fastmem_register( fast_memcpy, NULL ); diff --git a/modules/altivec/memcpy.c b/modules/altivec/memcpy.c index 2d91ea226591068cef924f38f9d335f534f893b0..cd329c1e5f8e1bf5411ba3e8d240b07da6f6479a 100644 --- a/modules/altivec/memcpy.c +++ b/modules/altivec/memcpy.c @@ -49,6 +49,9 @@ static void * fast_memcpy ( void * to, const void * from, size_t len ); *****************************************************************************/ static int Activate ( vlc_object_t *p_this ) { + if( !(vlc_CPU() & CPU_CAPABILITY_ALTIVEC) ) + return VLC_EGENERIC; + VLC_UNUSED(p_this); vlc_fastmem_register( fast_memcpy, NULL ); return VLC_SUCCESS; diff --git a/modules/mmx/memcpy.c b/modules/mmx/memcpy.c index 53ae7ae41354bef2edac1070c77d2977131e0202..8aa55acaadde1139140e04d9c013eb521e01e5a1 100644 --- a/modules/mmx/memcpy.c +++ b/modules/mmx/memcpy.c @@ -34,6 +34,9 @@ static int Activate( vlc_object_t *p_this ) { + if( !(vlc_CPU() & CPU_CAPABILITY_MMX) ) + return VLC_EGENERIC; + VLC_UNUSED(p_this); vlc_fastmem_register( fast_memcpy, NULL ); diff --git a/modules/mmxext/memcpy.c b/modules/mmxext/memcpy.c index 9e59bf5f2abd945062596d63cae33a673a1253df..344bff7433209669621495e4dc8edce5e9dd8ef7 100644 --- a/modules/mmxext/memcpy.c +++ b/modules/mmxext/memcpy.c @@ -34,6 +34,9 @@ static int Activate( vlc_object_t *p_this ) { + if( !(vlc_CPU() & CPU_CAPABILITY_MMXEXT) ) + return VLC_EGENERIC; + VLC_UNUSED(p_this); vlc_fastmem_register( fast_memcpy, NULL ); diff --git a/modules/video_chroma/i420_rgb.c b/modules/video_chroma/i420_rgb.c index cfaeb734a5679c1d6f0d73cf46406ef2f7004415..e74ec66eeea9352bc326b02950d6490158a4eadd 100644 --- a/modules/video_chroma/i420_rgb.c +++ b/modules/video_chroma/i420_rgb.c @@ -35,6 +35,7 @@ #include <vlc_common.h> #include <vlc_plugin.h> #include <vlc_filter.h> +#include <vlc_cpu.h> #include "i420_rgb.h" #if defined (MODULE_NAME_IS_i420_rgb) @@ -83,14 +84,17 @@ vlc_module_begin () set_description( N_("I420,IYUV,YV12 to " "RGB2,RV15,RV16,RV24,RV32 conversions") ) set_capability( "video filter2", 80 ) +# define CPU_CAPABILITY 0 #elif defined (MODULE_NAME_IS_i420_rgb_mmx) set_description( N_( "MMX I420,IYUV,YV12 to " "RV15,RV16,RV24,RV32 conversions") ) set_capability( "video filter2", 100 ) +# define CPU_CAPABILITY CPU_CAPABILITY_MMX #elif defined (MODULE_NAME_IS_i420_rgb_sse2) set_description( N_( "SSE2 I420,IYUV,YV12 to " "RV15,RV16,RV24,RV32 conversions") ) set_capability( "video filter2", 120 ) +# define CPU_CAPABILITY CPU_CAPABILITY_SSE2 #endif set_callbacks( Activate, Deactivate ) vlc_module_end () @@ -107,6 +111,10 @@ static int Activate( vlc_object_t *p_this ) size_t i_tables_size; #endif +#if CPU_CAPABILITY + if( !(vlc_CPU() & CPU_CAPABILITY) ) + return VLC_EGENERIC; +#endif if( p_filter->fmt_out.video.i_width & 1 || p_filter->fmt_out.video.i_height & 1 ) { diff --git a/modules/video_chroma/i420_yuy2.c b/modules/video_chroma/i420_yuy2.c index 09a904f951593daaf124516cc71212867c77e361..1d36b06f36a6930524d8f074a1ab2d80e4e6c519 100644 --- a/modules/video_chroma/i420_yuy2.c +++ b/modules/video_chroma/i420_yuy2.c @@ -33,6 +33,7 @@ #include <vlc_common.h> #include <vlc_plugin.h> #include <vlc_filter.h> +#include <vlc_cpu.h> #if defined (MODULE_NAME_IS_i420_yuy2_altivec) && defined(HAVE_ALTIVEC_H) # include <altivec.h> @@ -87,16 +88,20 @@ vlc_module_begin () #if defined (MODULE_NAME_IS_i420_yuy2) set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) ) set_capability( "video filter2", 80 ) +# define CPU_CAPABILITY 0 #elif defined (MODULE_NAME_IS_i420_yuy2_mmx) set_description( N_("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) ) set_capability( "video filter2", 160 ) +# define CPU_CAPABILITY CPU_CAPABILITY_MMX #elif defined (MODULE_NAME_IS_i420_yuy2_sse2) set_description( N_("SSE2 conversions from " SRC_FOURCC " to " DEST_FOURCC) ) set_capability( "video filter2", 250 ) +# define CPU_CAPABILITY CPU_CAPABILITY_SSE2 #elif defined (MODULE_NAME_IS_i420_yuy2_altivec) set_description( _("AltiVec conversions from " SRC_FOURCC " to " DEST_FOURCC) ); set_capability( "video filter2", 250 ) +# define CPU_CAPABILITY CPU_CAPABILITY_ALTIVEC #endif set_callbacks( Activate, NULL ) vlc_module_end () @@ -110,6 +115,10 @@ static int Activate( vlc_object_t *p_this ) { filter_t *p_filter = (filter_t *)p_this; +#if CPU_CAPABILITY + if( !(vlc_CPU() & CPU_CAPABILITY) ) + return VLC_EGENERIC; +#endif if( p_filter->fmt_in.video.i_width & 1 || p_filter->fmt_in.video.i_height & 1 ) { diff --git a/modules/video_chroma/i422_yuy2.c b/modules/video_chroma/i422_yuy2.c index fc426ffbc714bec0542c1fd78ba22b8f531488c2..142057fd684ecbd66590bf824ed0a7c2c324cf4f 100644 --- a/modules/video_chroma/i422_yuy2.c +++ b/modules/video_chroma/i422_yuy2.c @@ -33,6 +33,7 @@ #include <vlc_common.h> #include <vlc_plugin.h> #include <vlc_filter.h> +#include <vlc_cpu.h> #include "i422_yuy2.h" @@ -70,12 +71,15 @@ vlc_module_begin () #if defined (MODULE_NAME_IS_i422_yuy2) set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) ) set_capability( "video filter2", 80 ) +# define CPU_CAPABILITY 0 #elif defined (MODULE_NAME_IS_i422_yuy2_mmx) set_description( N_("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) ) set_capability( "video filter2", 100 ) +# define CPU_CAPABILITY CPU_CAPABILITY_MMX #elif defined (MODULE_NAME_IS_i422_yuy2_sse2) set_description( N_("SSE2 conversions from " SRC_FOURCC " to " DEST_FOURCC) ) set_capability( "video filter2", 120 ) +# define CPU_CAPABILITY CPU_CAPABILITY_SSE2 #endif set_callbacks( Activate, NULL ) vlc_module_end () @@ -89,6 +93,10 @@ static int Activate( vlc_object_t *p_this ) { filter_t *p_filter = (filter_t *)p_this; +#if CPU_CAPABILITY + if( !(vlc_CPU() & CPU_CAPABILITY) ) + return VLC_EGENERIC; +#endif if( p_filter->fmt_in.video.i_width & 1 || p_filter->fmt_in.video.i_height & 1 ) {