Commit 2337ee69 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Checks for CPU capability at run-time (on x86 and PPC)

parent e6b44f79
......@@ -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 );
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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 )
{
......
......@@ -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 )
{
......
......@@ -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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment