Commit 5015984b authored by Eric Petit's avatar Eric Petit

+ deinterlace.c : added an Altivec version of Merge() - makes the

     filter more than 100% faster here (blend mode). Feel free to check
     if I haven't broken anything, first time doing Altivec ;)
parent 77b003f2
dnl Autoconf settings for vlc dnl Autoconf settings for vlc
dnl $Id: configure.ac,v 1.152 2004/01/22 01:20:39 jlj Exp $ dnl $Id: configure.ac,v 1.153 2004/01/23 15:36:23 titer Exp $
AC_INIT(vlc,0.7.1-cvs) AC_INIT(vlc,0.7.1-cvs)
...@@ -995,7 +995,7 @@ AC_CACHE_CHECK([if \$CC groks AltiVec C extensions], ...@@ -995,7 +995,7 @@ AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
CFLAGS="${CFLAGS_save}"]) CFLAGS="${CFLAGS_save}"])
if test "${ac_cv_c_altivec}" != "no"; then if test "${ac_cv_c_altivec}" != "no"; then
AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.) AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
AX_ADD_CFLAGS([vlc idctaltivec motionaltivec memcpyaltivec],[${ac_cv_c_altivec}]) AX_ADD_CFLAGS([vlc idctaltivec motionaltivec memcpyaltivec deinterlace],[${ac_cv_c_altivec}])
ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}" ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
fi fi
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* deinterlace.c : deinterlacer plugin for vlc * deinterlace.c : deinterlacer plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001, 2002, 2003 VideoLAN * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
* $Id: deinterlace.c,v 1.18 2003/12/22 14:32:56 sam Exp $ * $Id: deinterlace.c,v 1.19 2004/01/23 15:36:23 titer Exp $
* *
* Author: Sam Hocevar <sam@zoy.org> * Author: Sam Hocevar <sam@zoy.org>
* *
...@@ -55,7 +55,8 @@ static void RenderMean ( vout_thread_t *, picture_t *, picture_t * ); ...@@ -55,7 +55,8 @@ static void RenderMean ( vout_thread_t *, picture_t *, picture_t * );
static void RenderBlend ( vout_thread_t *, picture_t *, picture_t * ); static void RenderBlend ( vout_thread_t *, picture_t *, picture_t * );
static void RenderLinear ( vout_thread_t *, picture_t *, picture_t *, int ); static void RenderLinear ( vout_thread_t *, picture_t *, picture_t *, int );
static void Merge ( void *, const void *, const void *, size_t ); static void MergeGeneric ( void *, const void *, const void *, size_t );
static void MergeAltivec ( void *, const void *, const void *, size_t );
static int SendEvents ( vlc_object_t *, char const *, static int SendEvents ( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * ); vlc_value_t, vlc_value_t, void * );
...@@ -107,6 +108,8 @@ struct vout_sys_t ...@@ -107,6 +108,8 @@ struct vout_sys_t
vout_thread_t *p_vout; vout_thread_t *p_vout;
vlc_mutex_t filter_lock; vlc_mutex_t filter_lock;
void (*pf_merge) ( void *, const void *, const void *, size_t );
}; };
/***************************************************************************** /*****************************************************************************
...@@ -138,6 +141,15 @@ static int Create( vlc_object_t *p_this ) ...@@ -138,6 +141,15 @@ static int Create( vlc_object_t *p_this )
p_vout->p_sys->last_date = 0; p_vout->p_sys->last_date = 0;
vlc_mutex_init( p_vout, &p_vout->p_sys->filter_lock ); vlc_mutex_init( p_vout, &p_vout->p_sys->filter_lock );
if( p_vout->p_libvlc->i_cpu & CPU_CAPABILITY_ALTIVEC )
{
p_vout->p_sys->pf_merge = MergeAltivec;
}
else
{
p_vout->p_sys->pf_merge = MergeGeneric;
}
/* Look what method was requested */ /* Look what method was requested */
var_Create( p_vout, "deinterlace-mode", VLC_VAR_STRING ); var_Create( p_vout, "deinterlace-mode", VLC_VAR_STRING );
var_Change( p_vout, "deinterlace-mode", VLC_VAR_INHERITVALUE, &val, NULL ); var_Change( p_vout, "deinterlace-mode", VLC_VAR_INHERITVALUE, &val, NULL );
...@@ -617,6 +629,8 @@ static void RenderBob( vout_thread_t *p_vout, ...@@ -617,6 +629,8 @@ static void RenderBob( vout_thread_t *p_vout,
} }
} }
#define Merge p_vout->p_sys->pf_merge
/***************************************************************************** /*****************************************************************************
* RenderLinear: BOB with linear interpolation * RenderLinear: BOB with linear interpolation
*****************************************************************************/ *****************************************************************************/
...@@ -774,8 +788,10 @@ static void RenderBlend( vout_thread_t *p_vout, ...@@ -774,8 +788,10 @@ static void RenderBlend( vout_thread_t *p_vout,
} }
} }
static void Merge( void *_p_dest, const void *_p_s1, #undef Merge
const void *_p_s2, size_t i_bytes )
static void MergeGeneric( void *_p_dest, const void *_p_s1,
const void *_p_s2, size_t i_bytes )
{ {
uint8_t* p_dest = (uint8_t*)_p_dest; uint8_t* p_dest = (uint8_t*)_p_dest;
const uint8_t *p_s1 = (const uint8_t *)_p_s1; const uint8_t *p_s1 = (const uint8_t *)_p_s1;
...@@ -802,6 +818,41 @@ static void Merge( void *_p_dest, const void *_p_s1, ...@@ -802,6 +818,41 @@ static void Merge( void *_p_dest, const void *_p_s1,
} }
} }
static void MergeAltivec( void *_p_dest, const void *_p_s1,
const void *_p_s2, size_t i_bytes )
{
#ifdef CAN_COMPILE_C_ALTIVEC
uint8_t *p_dest = (uint8_t*)_p_dest;
const uint8_t *p_s1 = (const uint8_t *)_p_s1;
const uint8_t *p_s2 = (const uint8_t *)_p_s2;
uint8_t *p_end = p_dest + i_bytes - 16;
if( ( (int)p_s1 & 0xF ) | ( (int)p_s2 & 0xF ) |
( (int)p_dest & 0xF ) )
{
/* TODO Handle non 16-bytes aligned planes */
MergeGeneric( _p_dest, _p_s1, _p_s2, i_bytes );
return;
}
while( p_dest < p_end )
{
vec_st( vec_avg( vec_ld( 0, p_s1 ), vec_ld( 0, p_s2 ) ),
0, p_dest );
p_s1 += 16;
p_s2 += 16;
p_dest += 16;
}
p_end += 16;
while( p_dest < p_end )
{
*p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*p_s2++) ) >> 1;
}
#endif
}
/***************************************************************************** /*****************************************************************************
* SendEvents: forward mouse and keyboard events to the parent p_vout * SendEvents: forward mouse and keyboard events to the parent p_vout
*****************************************************************************/ *****************************************************************************/
......
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