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

Process-wide memcpy/memset accelarations

(CPU features don't change across libvlc instances)
parent 0b776c28
...@@ -883,6 +883,15 @@ VLC_EXPORT( int, __vlc_execve, ( vlc_object_t *p_object, int i_argc, char *const ...@@ -883,6 +883,15 @@ VLC_EXPORT( int, __vlc_execve, ( vlc_object_t *p_object, int i_argc, char *const
#define CPU_CAPABILITY_ALTIVEC (1<<16) #define CPU_CAPABILITY_ALTIVEC (1<<16)
#define CPU_CAPABILITY_FPU (1<<31) #define CPU_CAPABILITY_FPU (1<<31)
VLC_EXPORT( unsigned, vlc_CPU, ( void ) ); VLC_EXPORT( unsigned, vlc_CPU, ( void ) );
VLC_EXPORT( void *, vlc_memcpy, ( void *, const void *, size_t ) );
VLC_EXPORT( void *, vlc_memset, ( void *, int, size_t ) );
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);
VLC_EXPORT( void, vlc_fastmem_register, (vlc_memcpy_t cpy, vlc_memset_t set) );
VLC_EXPORT( void *, vlc_memcpy, ( vlc_object_t *, void *, const void *, size_t ) );
VLC_EXPORT( void *, vlc_memset, ( vlc_object_t *, void *, int, size_t ) );
/***************************************************************************** /*****************************************************************************
* I18n stuff * I18n stuff
......
...@@ -403,6 +403,8 @@ vlc_iconv_open ...@@ -403,6 +403,8 @@ vlc_iconv_open
__vlc_list_find __vlc_list_find
vlc_list_release vlc_list_release
vlc_lldiv vlc_lldiv
vlc_memcpy
vlc_memset
vlc_module_create vlc_module_create
vlc_module_set vlc_module_set
__vlc_mutex_destroy __vlc_mutex_destroy
......
...@@ -356,3 +356,29 @@ unsigned vlc_CPU (void) ...@@ -356,3 +356,29 @@ unsigned vlc_CPU (void)
return cpu_flags; return cpu_flags;
} }
static vlc_memcpy_t pf_vlc_memcpy = memcpy;
static vlc_memcpy_t pf_vlc_memset = memset;
void vlc_fastmem_register (vlc_memcpy_t cpy, vlc_memset_t set)
{
if (cpy)
pf_vlc_memcpy = cpy;
if (set)
pf_vlc_memset = set;
}
/**
* vlc_memcpy: fast CPU-dependent memcpy
*/
void *vlc_memcpy (void *tgt, const void *src, size_t n)
{
return pf_vlc_memcpy (tgt, src, n);
}
/**
* vlc_memset: fast CPU-dependent memset
*/
void *vlc_memset (void *tgt, int c, size_t n)
{
return pf_vlc_memset (tgt, c, n);
}
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