Commit 7bdcbe8a authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Check for AltiVec at build-time if possible (untested)

parent b830aae4
......@@ -59,7 +59,13 @@ VLC_API unsigned vlc_CPU(void);
# elif defined (__ppc__) || defined (__ppc64__) || defined (__powerpc__)
# define HAVE_FPU 1
# define CPU_CAPABILITY_ALTIVEC (1<<16)
# define VLC_CPU_ALTIVEC 2
# ifdef ALTIVEC
# define vlc_CPU_ALTIVEC() (1)
# else
# define vlc_CPU_ALTIVEC() ((vlc_CPU() & VLC_CPU_ALTIVEC) != 0)
# endif
# elif defined (__arm__)
# if defined (__VFP_FP__) && !defined (__SOFTFP__)
......
......@@ -200,7 +200,7 @@ static int OpenDecoder( vlc_object_t *p_this )
if( cpu & CPU_CAPABILITY_MMXEXT )
i_accel |= MPEG2_ACCEL_X86_MMXEXT;
#elif defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc64__ )
if( vlc_CPU() & CPU_CAPABILITY_ALTIVEC )
if( vlc_CPU_ALTIVEC() )
i_accel |= MPEG2_ACCEL_PPC_ALTIVEC;
#elif defined(__arm__)
......
......@@ -88,20 +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
# define vlc_CPU_capable() (1)
#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
# define vlc_CPU_capable() (vlc_CPU() & 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
# define vlc_CPU_capable() (vlc_CPU() & 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
# define vlc_CPU_capable() (vlc_CPU_ALTIVEC())
#endif
set_callbacks( Activate, NULL )
vlc_module_end ()
......@@ -115,10 +115,8 @@ static int Activate( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
#if CPU_CAPABILITY
if( !(vlc_CPU() & CPU_CAPABILITY) )
if( !vlc_CPU_capable() )
return VLC_EGENERIC;
#endif
if( p_filter->fmt_in.video.i_width & 1
|| p_filter->fmt_in.video.i_height & 1 )
{
......
......@@ -628,7 +628,7 @@ int Open( vlc_object_t *p_this )
IVTCClearState( p_filter );
#if defined(CAN_COMPILE_C_ALTIVEC)
if( chroma->pixel_size == 1 && (vlc_CPU() & CPU_CAPABILITY_ALTIVEC) )
if( chroma->pixel_size == 1 && vlc_CPU_ALTIVEC() )
{
p_sys->pf_merge = MergeAltivec;
p_sys->pf_end_merge = NULL;
......
......@@ -142,7 +142,7 @@ static int OpenPostproc( vlc_object_t *p_this )
if( i_cpu & CPU_CAPABILITY_3DNOW )
i_flags |= PP_CPU_CAPS_3DNOW;
#elif defined(__ppc__) || defined(__ppc64__) || defined(__powerpc__)
if( vlc_CPU() & CPU_CAPABILITY_ALTIVEC )
if( vlc_CPU_ALTIVEC() )
i_flags |= PP_CPU_CAPS_ALTIVEC;
#endif
......
......@@ -242,7 +242,7 @@ static int GetSwsCpuMask(void)
if( i_cpu & CPU_CAPABILITY_3DNOW )
i_sws_cpu |= SWS_CPU_CAPS_3DNOW;
#elif defined(__ppc__) || defined(__ppc64__) || defined(__powerpc__)
if( vlc_CPU() & CPU_CAPABILITY_ALTIVEC )
if( vlc_CPU_ALTIVEC() )
i_sws_cpu |= SWS_CPU_CAPS_ALTIVEC;
#endif
......
......@@ -308,11 +308,11 @@ out:
int i_error = sysctl( selectors, 2, &i_has_altivec, &i_length, NULL, 0);
if( i_error == 0 && i_has_altivec != 0 )
i_capabilities |= CPU_CAPABILITY_ALTIVEC;
i_capabilities |= VLC_CPU_ALTIVEC;
# elif defined( CAN_COMPILE_ALTIVEC )
if (vlc_CPU_check ("Altivec", Altivec_test))
i_capabilities |= CPU_CAPABILITY_ALTIVEC;
i_capabilities |= VLC_CPU_ALTIVEC;
# endif
......@@ -364,8 +364,7 @@ void vlc_CPU_dump (vlc_object_t *obj)
PRINT_CAPABILITY(CPU_CAPABILITY_SSE4A, "SSE4A");
#elif defined (__powerpc__) || defined (__ppc__) || defined (__ppc64__)
if (vlc_CPU() & CPU_CAPABILITY_ALTIVEC)
p += sprintf (p, "AltiVec");
if (vlc_CPU_ALTIVEC()) p += sprintf (p, "AltiVec");
#elif defined (__arm__)
if (vlc_CPU_ARM_NEON()) p += sprintf (p, "ARM_NEON ");
......
......@@ -106,7 +106,7 @@ static void vlc_CPU_init (void)
#elif defined (__powerpc__) || defined (__powerpc64__)
if (!strcmp (cap, "altivec supported"))
core_caps |= CPU_CAPABILITY_ALTIVEC;
core_caps |= VLC_CPU_ALTIVEC;
#endif
}
......
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