[vlc-devel] commit: Process-wide memcpy/memset accelarations ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sat May 3 16:25:24 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Sat May 3 15:41:17 2008 +0300| [b04c6c66f43e941f33469519f1ff7d15faeeb929]
Process-wide memcpy/memset accelarations
(CPU features don't change across libvlc instances)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b04c6c66f43e941f33469519f1ff7d15faeeb929
---
include/vlc_common.h | 9 +++++++++
src/libvlc.sym | 2 ++
src/misc/cpu.c | 26 ++++++++++++++++++++++++++
3 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/include/vlc_common.h b/include/vlc_common.h
index 4fd14f8..707e932 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -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_FPU (1<<31)
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
diff --git a/src/libvlc.sym b/src/libvlc.sym
index 27b3f93..c361703 100644
--- a/src/libvlc.sym
+++ b/src/libvlc.sym
@@ -403,6 +403,8 @@ vlc_iconv_open
__vlc_list_find
vlc_list_release
vlc_lldiv
+vlc_memcpy
+vlc_memset
vlc_module_create
vlc_module_set
__vlc_mutex_destroy
diff --git a/src/misc/cpu.c b/src/misc/cpu.c
index cfd5b28..0467c28 100644
--- a/src/misc/cpu.c
+++ b/src/misc/cpu.c
@@ -356,3 +356,29 @@ unsigned vlc_CPU (void)
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);
+}
More information about the vlc-devel
mailing list