[multimedia/kwave] /: use standard memcpy

Mark Penner null at kde.org
Tue Feb 11 00:28:25 GMT 2025


Git commit fbff057976e8988e01de0430705a8c75573bcd29 by Mark Penner.
Committed on 11/02/2025 at 00:23.
Pushed by mrp into branch 'master'.

use standard memcpy

the old custom memcpy implementations don't compile correctly with some compilers
and are not usually faster than the modern standard memcpy anyway

BUG: 487934
BUG: 499512

M  +1    -4    .flatpak-manifest.json
M  +0    -6    AUTHORS
M  +0    -40   CMakeLists.txt
M  +0    -3    LICENSES
M  +0    -15   config.h.cmake
M  +0    -7    doc/devel.docbook
M  +0    -14   doc/en/index.docbook
M  +0    -1    doxy.cfg.in
M  +0    -11   kwave/main.cpp
M  +0    -37   libkwave/CMakeLists.txt
M  +0    -1    libkwave/MultiPlaybackSink.cpp
M  +0    -1    libkwave/TrackWriter.cpp
D  +0    -429  libkwave/cpu_accel.cpp
D  +0    -53   libkwave/cputest.h
D  +0    -702  libkwave/memcpy.c
M  +0    -14   libkwave/memcpy.h

https://invent.kde.org/multimedia/kwave/-/commit/fbff057976e8988e01de0430705a8c75573bcd29

diff --git a/.flatpak-manifest.json b/.flatpak-manifest.json
index 884706593..3f8bc9dd8 100644
--- a/.flatpak-manifest.json
+++ b/.flatpak-manifest.json
@@ -75,10 +75,7 @@
         {
             "name": "kwave",
             "buildsystem": "cmake-ninja",
-            "config-opts": [
-                "-DCMAKE_BUILD_TYPE=RelWithDebInfo",
-                "-DWITH_OPTIMIZED_MEMCPY=OFF"
-                ],
+            "config-opts": ["-DCMAKE_BUILD_TYPE=RelWithDebInfo"],
             "builddir": true,
             "sources": [
                 {
diff --git a/AUTHORS b/AUTHORS
index bc05a46fa..8aa343696 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -67,9 +67,6 @@ Gustavo Pichorim Boiko <gustavo.boiko at kdemail.net>
 Michal Malek <michalm at jabster.pl>
         * parts of plugins/export_k3b/K3BExportPlugin.cpp
 
-Aaron Holtzman <aholtzma at ess.engr.uvic.ca>
-        * libkwave/cpu_accel.cpp
-
 Bertrand Songis <bsongis at gmail.com>
         * french translation fixes
         * substitutes for patented libaudiofile code, debian bug 419124 [historic]
@@ -116,9 +113,6 @@ Martin Hinsch <vidas at sourceforge.net>
 Matthias Kretz, <kretz at kde.org>
         * cmake/FindAlsa.cmake
 
-Miguel Freitas
-        * parts of libkwave/memcpy.c
-
 Richard Laerkaeng, <richard at goteborg.utfors.se>
         * cmake/FindOggVorbis.cmake
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 834a14600..f6d43ce56 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,7 +38,6 @@ set (RELEASE_SERVICE_VERSION_MICRO "70")
 # OPTION(WITH_OGG_OPUS   "enable support for ogg/opus files [default=on]" ON)
 # OPTION(WITH_OGG_VORBIS "enable support for ogg/vorbis files [default=on]" ON)
 # OPTION(WITH_OSS        "enable playback/recording via OSS [default=on]" ON)
-# OPTION(WITH_OPTIMIZED_MEMCPY "enable optimized memcpy [default=on]" ON)
 # OPTION(WITH_PULSEAUDIO "enable playback/recording via PulseAudio [default=on]" ON)
 # OPTION(WITH_QT_AUDIO   "enable playback via Qt Multimedia [default=on]" ON)
 
@@ -93,45 +92,6 @@ EXECUTE_PROCESS(
 GET_FILENAME_COMPONENT(COMPILER_SHORT "${CMAKE_C_COMPILER}" NAME_WE CACHE)
 MESSAGE(STATUS "Building with ${COMPILER_SHORT} version ${COMPILER_VERSION}")
 
-#############################################################################
-### check for the CPU we build for                                        ###
-
-EXECUTE_PROCESS(
-    COMMAND ${CMAKE_C_COMPILER} -dumpmachine
-    OUTPUT_VARIABLE MACHINE
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-)
-MESSAGE(STATUS "Building for target ${MACHINE}")
-
-OPTION(WITH_OPTIMIZED_MEMCPY "enable optimized memcpy [default=on]" ON)
-IF (WITH_OPTIMIZED_MEMCPY)
-
-    STRING(REGEX MATCH "(i.86-*)|(athlon-*)|(pentium-*)" _mach_x86 ${MACHINE})
-    IF (_mach_x86)
-        MESSAGE(STATUS "Found target optimized memcpy() for X86 (from xine)")
-        SET(ARCH_X86 1)
-    ENDIF (_mach_x86)
-
-    STRING(REGEX MATCH "(x86_64-*)|(X86_64-*)|(AMD64-*)|(amd64-*)" _mach_x86_64 ${MACHINE})
-    IF (_mach_x86_64)
-        MESSAGE(STATUS "Found target optimized memcpy() for X86_64 (from xine)")
-        SET(ARCH_X86_64 1)
-    ENDIF (_mach_x86_64)
-
-    STRING(REGEX MATCH "(ppc-*)|(powerpc-*)" _mach_ppc ${MACHINE})
-    IF (_mach_ppc)
-        MESSAGE(STATUS "Found target optimized memcpy() for PPC (from xine)")
-        SET(ARCH_PPC 1)
-    ENDIF (_mach_ppc)
-
-    IF (NOT ARCH_X86 AND NOT ARCH_X86_64 AND NOT ARCH_PPC)
-        MESSAGE(STATUS "No platform specific memcpy available")
-    ENDIF (NOT ARCH_X86 AND NOT ARCH_X86_64 AND NOT ARCH_PPC)
-
-ELSE (WITH_OPTIMIZED_MEMCPY)
-    MESSAGE(STATUS "Platform specific memcpy is disabled")
-ENDIF (WITH_OPTIMIZED_MEMCPY)
-
 #############################################################################
 ### path to additional cmake modules and includes                         ###
 
diff --git a/LICENSES b/LICENSES
index 4f7779263..2c8d4fd04 100644
--- a/LICENSES
+++ b/LICENSES
@@ -311,8 +311,6 @@ COMPLETE LIST OF FILES AND THEIR LICENSE
         libkwave/ConfirmCancelProxy.h                   GPL2+
         libkwave/Connect.cpp                            GPL2+
         libkwave/Connect.h                              GPL2+
-        libkwave/cpu_accel.cpp                          GPL2+ / Aaron Holtzman <aholtzma at ess.engr.uvic.ca>
-        libkwave/cputest.h                              GPL2+
         libkwave/Curve.cpp                              GPL2+
         libkwave/Curve.h                                GPL2+
         libkwave/Decoder.cpp                            GPL2+
@@ -345,7 +343,6 @@ COMPLETE LIST OF FILES AND THEIR LICENSE
         libkwave/Logger.cpp                             GPL2+
         libkwave/Logger.h                               GPL2+
         libkwave/Matrix.h                               GPL2+ (Martin Hinsch)
-        libkwave/memcpy.c                               GPL2+ / xine
         libkwave/memcpy.h                               GPL2+
         libkwave/MessageBox.cpp                         GPL2+
         libkwave/MessageBox.h                           GPL2+
diff --git a/config.h.cmake b/config.h.cmake
index ad423c0bb..726dc2d5e 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -15,21 +15,6 @@
  *                                                                         *
  ***************************************************************************/
 
-/* use ppc target optimizations (from xine) */
-#cmakedefine ARCH_PPC
-
-/* use ix86 target optimizations (from xine) */
-#cmakedefine ARCH_X86
-
-/* use X86_64 target optimizations (from xine) */
-#cmakedefine ARCH_X86_64
-
-/* use target optimized memcpy */
-#cmakedefine WITH_OPTIMIZED_MEMCPY
-
-/* use target optimized memcpy using AVX assembler code */
-#cmakedefine HAVE_AVX
-
 /* support playback/recording via ALSA */
 #cmakedefine HAVE_ALSA_SUPPORT
 
diff --git a/doc/devel.docbook b/doc/devel.docbook
index 6f65e1dea..58f5a9dbf 100644
--- a/doc/devel.docbook
+++ b/doc/devel.docbook
@@ -411,13 +411,6 @@
 		    [<literal>on</literal>/<literal>off</literal>,
 		    default=<literal>on</literal>]
 		</para></listitem>
-		<listitem><para>
-		    <literal>WITH_OPTIMIZED_MEMCPY</literal>
-		    use an optimized version of memcpy, available for
-		    X86, X86_64 and PPC platforms
-		    [<literal>on</literal>/<literal>off</literal>,
-		    default=<literal>on</literal>]
-		</para></listitem>
 		<listitem><para>
 		    <literal>WITH_OSS</literal>
 		    enable playback/recording via OSS
diff --git a/doc/en/index.docbook b/doc/en/index.docbook
index 19c7f78ea..81f218cc7 100644
--- a/doc/en/index.docbook
+++ b/doc/en/index.docbook
@@ -7550,13 +7550,6 @@
     <sect1 id="minor_contributors"><title>Minor contributors, copyright holders and others</title>
     <para>
     	<itemizedlist>
-	    <listitem>
-	    	<para><emphasis role="bold">
-		    Aaron Holtzman <email>aholtzma at ess.engr.uvic.ca</email>
-		</emphasis></para><para>
-		    libkwave/cpu_accel.cpp
-		</para>
-	    </listitem>
 	    <listitem>
 	    	<para><emphasis role="bold">
 		    Bertrand Songis <email>bsongis at gmail.com</email>
@@ -7661,13 +7654,6 @@
 		    cmake/FindAlsa.cmake
 		</para>
 	    </listitem>
-	    <listitem>
-	    	<para><emphasis role="bold">
-		    Miguel Freitas
-		</emphasis></para><para>
-		    parts of libkwave/memcpy.c
-		</para>
-	    </listitem>
 	    <listitem>
 	    	<para><emphasis role="bold">
 		    Richard Laerkaeng, <email>richard at goteborg.utfors.se</email>
diff --git a/doxy.cfg.in b/doxy.cfg.in
index 883587ff3..7d44e00f7 100644
--- a/doxy.cfg.in
+++ b/doxy.cfg.in
@@ -2020,7 +2020,6 @@ PREDEFINED             = DEBUG \
                          HAVE_FLAC \
                          HAVE_LIBSAMPLERATE \
                          HAVE_MP3 \
-                         HAVE_OPTIMIZED_MEMCPY \
                          HAVE_PULSEAUDIO_SUPPORT \
                          HAVE_OSS_SUPPORT \
                          HAVE_OGG_OPUS \
diff --git a/kwave/main.cpp b/kwave/main.cpp
index e8b42be29..7457a5caa 100644
--- a/kwave/main.cpp
+++ b/kwave/main.cpp
@@ -148,11 +148,6 @@ static void addDataStrings(KAboutData &aboutdata)
         QString());
 }
 
-#ifdef WITH_OPTIMIZED_MEMCPY
-/* forward declaration to libkwave/memcpy.c */
-extern "C" void probe_fast_memcpy(void);
-#endif /* WITH_OPTIMIZED_MEMCPY */
-
 //***************************************************************************
 int main(int argc, char **argv)
 {
@@ -233,12 +228,6 @@ int main(int argc, char **argv)
     /* let Kwave be a "unique" application, only one instance */
     KDBusService service(KDBusService::Unique);
 
-     /* check for an optimized version of memcpy() */
-#ifdef WITH_OPTIMIZED_MEMCPY
-    probe_fast_memcpy();
-    qDebug("\n");
-#endif /* WITH_OPTIMIZED_MEMCPY */
-
     // check whether to start up without splash screen or in iconic mode
     // which implicitly also disables the splash screen
     Kwave::Splash splash(_("pics/kwave-splash.png"));
diff --git a/libkwave/CMakeLists.txt b/libkwave/CMakeLists.txt
index c8a5b5398..d82dcb9e9 100644
--- a/libkwave/CMakeLists.txt
+++ b/libkwave/CMakeLists.txt
@@ -24,42 +24,6 @@
 
 #############################################################################
 
-IF (WITH_OPTIMIZED_MEMCPY)
-
-    # use "default" visibility for memcpy.c (which is our one and only C file)
-    SET(CMAKE_C_VISIBILITY_PRESET default)
-
-    CHECK_INCLUDE_FILES(sys/times.h HAVE_SYS_TIMES_H)
-
-    SET(_inc_c stdint.h stdio.h)
-    CHECK_INCLUDE_FILES("${_inc_c}" HAVE_REQUIRED_STD_C_HEADERS)
-    IF (NOT HAVE_REQUIRED_STD_C_HEADERS)
-        MESSAGE(FATAL_ERROR "
-            unable to find one or more of the following C header files:
-            ${_inc_c}")
-    ENDIF (NOT HAVE_REQUIRED_STD_C_HEADERS)
-
-    SET(libkwave_LIB_SRCS_memcpy cpu_accel.cpp memcpy.c)
-
-    SET(_try_src_dir "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp")
-    SET(_try_avx_assembler "${_try_src_dir}/cmake_try_avx_assembler.c")
-    WRITE_FILE("${_try_avx_assembler}" "
-        int main()
-        {
-            __asm __volatile(\"vmovaps %ymm1, %ymm0\");
-            return 0;
-        }
-    ")
-    MESSAGE(STATUS "Detecting compiler support for AVX inline assembler")
-    TRY_COMPILE(HAVE_AVX ${CMAKE_BINARY_DIR} ${_try_avx_assembler} OUTPUT_VARIABLE _out)
-    IF (HAVE_AVX)
-        MESSAGE(STATUS "Detecting compiler support for AVX inline assembler - Success")
-    ELSE (HAVE_AVX)
-        MESSAGE(STATUS "Detecting compiler support for AVX inline assembler - not available")
-    ENDIF (HAVE_AVX)
-
-ENDIF (WITH_OPTIMIZED_MEMCPY)
-
 SET(libkwave_LIB_SRCS
     ClipBoard.cpp
     CodecBase.cpp
@@ -226,7 +190,6 @@ SET(libkwave_LIB_SRCS
     undo/UndoTransactionGuard.h
 
     ${libkwave_LIB_SRCS_samplerate}
-    ${libkwave_LIB_SRCS_memcpy}
 )
 
 #############################################################################
diff --git a/libkwave/MultiPlaybackSink.cpp b/libkwave/MultiPlaybackSink.cpp
index 2469485c7..c515c2c54 100644
--- a/libkwave/MultiPlaybackSink.cpp
+++ b/libkwave/MultiPlaybackSink.cpp
@@ -26,7 +26,6 @@
 #include "libkwave/MultiPlaybackSink.h"
 #include "libkwave/PlayBackDevice.h"
 #include "libkwave/PlaybackSink.h"
-#include "libkwave/memcpy.h"
 
 //***************************************************************************
 Kwave::MultiPlaybackSink::MultiPlaybackSink(unsigned int tracks,
diff --git a/libkwave/TrackWriter.cpp b/libkwave/TrackWriter.cpp
index 91f86b74f..071d1e9bd 100644
--- a/libkwave/TrackWriter.cpp
+++ b/libkwave/TrackWriter.cpp
@@ -23,7 +23,6 @@
 #include "libkwave/Track.h"
 #include "libkwave/TrackWriter.h"
 #include "libkwave/Utils.h"
-#include "libkwave/memcpy.h"
 
 /** minimum time between emitting the "progress()" signal [ms] */
 #define MIN_PROGRESS_INTERVAL 100
diff --git a/libkwave/cpu_accel.cpp b/libkwave/cpu_accel.cpp
deleted file mode 100644
index 16a24275c..000000000
--- a/libkwave/cpu_accel.cpp
+++ /dev/null
@@ -1,429 +0,0 @@
-/*
- * cpu_accel.c
- * Copyright (C) 1999-2001 Aaron Holtzman <aholtzma at ess.engr.uvic.ca>
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- *
- * mpeg2dec is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpeg2dec is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- * 2014-05-26
- *   Copied this source into the Kwave project and adapted it to compile
- *   cleanly within this new environment
- *   by Thomas Eschenbacher <Thomas.Eschenbacher at gmx.de>
- *   marked most changes with "#ifdef XINE_COMPILE"
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-
-#if defined(HAVE_MLIB) && defined(MLIB_LAZYLOAD)
-#include <dlfcn.h>
-#endif
-
-#if defined (__SVR4) && defined (__sun)
-#include <sys/systeminfo.h>
-#endif
-
-#ifdef XINE_COMPILE
-#define LOG_MODULE "cpu_accel"
-#define LOG_VERBOSE
-#endif /* XINE_COMPILE */
-
-/*
-#define LOG
-*/
-
-#ifdef XINE_COMPILE
-
-#include <xine/xineutils.h>
-
-#else /* XINE_COMPILE */
-
-#include "cputest.h"
-#define lprintf printf
-
-#endif /* XINE_COMPILE */
-
-#if defined(PIC) && ! defined(__PIC__)
-#define __PIC__
-#endif
-
-#if defined(__i386__) || defined(__x86_64__)
-
-#include <signal.h>
-#include <setjmp.h>
-
-static jmp_buf sigill_return;
-
-static __attribute__((noreturn)) void sigill_handler (int n) {
-  (void)n;
-  longjmp(sigill_return, 1);
-}
-
-static uint32_t arch_accel (void)
-{
-  /* made static to avoid clobbering by longjmp (THE, 2014-05-30) */
-  static uint32_t caps = 0;
-
-#if defined(__x86_64__) || \
-  ( defined(__SSE__) && defined(__SSE2__) && defined(__MMX__) )
-  /* No need to test for this on AMD64, we know what the
-     platform has.  */
-  caps = MM_ACCEL_X86_MMX | MM_ACCEL_X86_SSE | MM_ACCEL_X86_MMXEXT |
-         MM_ACCEL_X86_SSE2
-#  if defined(__3dNOW__)
-    | MM_ACCEL_X86_3DNOW
-#  endif
-    ;
-#endif
-
-  void (*old_sigill_handler)(int);
-  uint32_t eax, ebx, ecx, edx;
-
-#if defined(__x86_64__)
-#define cpuid(op,eax,ebx,ecx,edx)       \
-    __asm__ ("push %%rbx\n\t"           \
-         "cpuid\n\t"                    \
-         "movl %%ebx,%1\n\t"            \
-         "pop %%rbx"                    \
-         : "=a" (eax),                  \
-           "=r" (ebx),                  \
-           "=c" (ecx),                  \
-           "=d" (edx)                   \
-         : "a" (op)                     \
-         : "cc")
-#elif !defined(__PIC__)
-#define cpuid(op,eax,ebx,ecx,edx)       \
-    __asm__ ("cpuid"                    \
-         : "=a" (eax),                  \
-           "=b" (ebx),                  \
-           "=c" (ecx),                  \
-           "=d" (edx)                   \
-         : "a" (op)                     \
-         : "cc")
-#else   /* PIC version : save ebx */
-#define cpuid(op,eax,ebx,ecx,edx)       \
-    __asm__ ("pushl %%ebx\n\t"          \
-         "cpuid\n\t"                    \
-         "movl %%ebx,%1\n\t"            \
-         "popl %%ebx"                   \
-         : "=a" (eax),                  \
-           "=r" (ebx),                  \
-           "=c" (ecx),                  \
-           "=d" (edx)                   \
-         : "a" (op)                     \
-         : "cc")
-#endif
-
-#ifndef __x86_64__
-  __asm__ ("pushfl\n\t"
-       "pushfl\n\t"
-       "popl %0\n\t"
-       "movl %0,%1\n\t"
-       "xorl $0x200000,%0\n\t"
-       "pushl %0\n\t"
-       "popfl\n\t"
-       "pushfl\n\t"
-       "popl %0\n\t"
-       "popfl"
-       : "=r" (eax),
-       "=r" (ebx)
-       :
-       : "cc");
-
-  if (eax == ebx) {
-    /* no cpuid */
-    return 0;
-  }
-
-  cpuid (0x00000000, eax, ebx, ecx, edx);
-  if (!eax) {
-    /* vendor string only */
-    return 0;
-  }
-
-  int AMD = (ebx == 0x68747541) && (ecx == 0x444d4163) && (edx == 0x69746e65);
-
-#endif /* __x86_64__ */
-
-  cpuid (0x00000001, eax, ebx, ecx, edx);
-
-#ifndef __x86_64__
-  if (edx & 0x00800000) {
-    /* MMX */
-    caps |= MM_ACCEL_X86_MMX;
-  }
-
-  if (edx & 0x02000000) {
-    /* SSE - identical to AMD MMX extensions */
-    caps |= MM_ACCEL_X86_SSE | MM_ACCEL_X86_MMXEXT;
-  }
-
-  if (edx & 0x04000000) {
-    /* SSE2 */
-    caps |= MM_ACCEL_X86_SSE2;
-  }
-#endif /* __x86_64__ */
-
-  if (ecx & 0x00000001) {
-    caps |= MM_ACCEL_X86_SSE3;
-  }
-  if (ecx & 0x00000200) {
-    caps |= MM_ACCEL_X86_SSSE3;
-  }
-  if (ecx & 0x00080000) {
-    caps |= MM_ACCEL_X86_SSE4;
-  }
-  if (ecx & 0x00100000) {
-    caps |= MM_ACCEL_X86_SSE42;
-  }
-
-  /* Check OXSAVE and AVX bits */
-  if ((ecx & 0x18000000) == 0x18000000) {
-    /* test OS support for AVX */
-
-    old_sigill_handler = signal (SIGILL, sigill_handler);
-
-    if (setjmp(sigill_return)) {
-      lprintf("OS doesn't support AVX instructions.\n");
-    } else {
-      /* Get value of extended control register 0 */
-      __asm__ (".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c" (0));
-      if ((eax & 0x6) == 0x6) {
-        caps |= MM_ACCEL_X86_AVX;
-      }
-
-    }
-
-    signal(SIGILL, old_sigill_handler);
-  }
-
-#ifndef __x86_64__
-  cpuid (0x80000000, eax, ebx, ecx, edx);
-  if (eax >= 0x80000001) {
-    cpuid (0x80000001, eax, ebx, ecx, edx);
-
-    if (edx & 0x80000000) {
-      /* AMD 3DNow  extensions */
-      caps |= MM_ACCEL_X86_3DNOW;
-    }
-
-    if (AMD && (edx & 0x00400000)) {
-      /* AMD MMX extensions */
-      caps |= MM_ACCEL_X86_MMXEXT;
-    }
-  }
-#endif /* __x86_64__ */
-
-#ifndef __x86_64__
-  /* test OS support for SSE */
-  if (caps & MM_ACCEL_X86_SSE) {
-    old_sigill_handler = signal (SIGILL, sigill_handler);
-
-    if (setjmp(sigill_return)) {
-      lprintf("OS doesn't support SSE instructions.\n");
-      caps &= ~(MM_ACCEL_X86_SSE|MM_ACCEL_X86_SSE2|
-                MM_ACCEL_X86_SSE3|MM_ACCEL_X86_SSSE3|
-                MM_ACCEL_X86_SSE4|MM_ACCEL_X86_SSE42);
-    } else {
-      __asm__ volatile ("xorps %xmm0, %xmm0");
-    }
-
-    signal(SIGILL, old_sigill_handler);
-  }
-
-#endif /* x86_64 */
-
-  return caps;
-}
-
-#endif /* i386 or x86_64 */
-
-#if defined(ARCH_PPC) && defined(ENABLE_ALTIVEC)
-#include <signal.h>
-#include <setjmp.h>
-
-static sigjmp_buf jmpbuf;
-static volatile sig_atomic_t canjump = 0;
-
-static void sigill_handler (int sig)
-{
-  if (!canjump) {
-    signal (sig, SIG_DFL);
-    raise (sig);
-  }
-
-  canjump = 0;
-  siglongjmp (jmpbuf, 1);
-}
-
-static uint32_t arch_accel (void)
-{
-  /* FIXME: Autodetect cache line size via AUX ELF vector or otherwise */
-  uint32_t flags = 0;
-
-  signal (SIGILL, sigill_handler);
-  if (sigsetjmp (jmpbuf, 1)) {
-    signal (SIGILL, SIG_DFL);
-    return flags;
-  }
-
-  canjump = 1;
-#ifndef HOST_OS_DARWIN
-  __asm__ volatile ("mtspr 256, %0\n\t"
-                    "vand %%v0, %%v0, %%v0"
-                    :
-                    : "r" (-1));
-#else
-  __asm__ volatile ("mtspr 256, r0\n\t"
-                    "vand v0, v0, v0"
-                    :
-                    : "r" (-1));
-#endif
-
-  signal (SIGILL, SIG_DFL);
-  return flags|MM_ACCEL_PPC_ALTIVEC;
-}
-#endif /* ARCH_PPC */
-
-#if defined(ARCH_SPARC) && defined(ENABLE_VIS)
-#if defined (__SVR4) && defined (__sun)
-static uint32_t arch_accel (void)
-{
-  uint32_t flags = 0;
-  long len;
-  char isalist_[257], *isalist, *s1, *last, *token;
-
-  len = sysinfo(SI_ISALIST, isalist_, 257);
-
-  if (len > 257) {
-    isalist = malloc(len);
-    sysinfo(SI_ISALIST, isalist, len);
-  }
-  else {
-    isalist = isalist_;
-  }
-
-  s1 = isalist;
-  while (token = strtok_r(s1, " ", &last)) {
-    if (strlen(token) > 4) {
-      if (strcmp(token + (strlen(token) - 4), "+vis") == 0) {
-        flags |= MM_ACCEL_SPARC_VIS;
-      }
-    }
-
-    if (strlen(token) > 5) {
-      if (strcmp(token + (strlen(token) - 5), "+vis2") == 0) {
-        flags |= MM_ACCEL_SPARC_VIS2;
-      }
-    }
-
-    s1 = NULL;
-  }
-
-  if (isalist != isalist_) {
-    free(isalist);
-  }
-  return flags;
-}
-#else
-#include <signal.h>
-#include <setjmp.h>
-
-static sigjmp_buf jmpbuf;
-static volatile sig_atomic_t canjump = 0;
-
-static void sigill_handler (int sig)
-{
-  if (!canjump) {
-    signal(sig, SIG_DFL);
-    raise(sig);
-  }
-
-  canjump = 0;
-  siglongjmp(jmpbuf, 1);
-}
-
-static uint32_t arch_accel (void)
-{
-  uint32_t flags = 0;
-
-  signal(SIGILL, sigill_handler);
-  if (sigsetjmp(jmpbuf, 1)) {
-    signal(SIGILL, SIG_DFL);
-    return flags;
-  }
-
-  canjump = 1;
-
-  /* pdist %f0, %f0, %f0 */
-  __asm__ __volatile__(".word\t0x81b007c0");
-
-  canjump = 0;
-  flags |= MM_ACCEL_SPARC_VIS;
-
-  if (sigsetjmp(jmpbuf, 1)) {
-    signal(SIGILL, SIG_DFL);
-    return flags;
-  }
-
-  canjump = 1;
-
-  /* edge8n %g0, %g0, %g0 */
-  __asm__ __volatile__(".word\t0x81b00020");
-
-  canjump = 0;
-  flags |= MM_ACCEL_SPARC_VIS2;
-
-  signal(SIGILL, SIG_DFL);
-  return flags;
-}
-#endif
-#endif /* ARCH_SPARC */
-
-uint32_t xine_mm_accel (void)
-{
-  static int initialized = 0;
-  static uint32_t accel = 0;
-
-  if (!initialized) {
-#ifdef HAVE_MLIB
-#ifdef MLIB_LAZYLOAD
-    void *hndl;
-
-    if ((hndl = dlopen("libmlib.so.2", RTLD_LAZY | RTLD_GLOBAL |
-                                       RTLD_NODELETE)) != NULL) {
-      dlclose(hndl);
-      accel |= MM_ACCEL_MLIB;
-    }
-#else
-    accel |= MM_ACCEL_MLIB;
-#endif
-#endif
-
-#if defined(__i386__) || defined(__x86_64__) || \
-    (defined(ARCH_PPC) && defined(ENABLE_ALTIVEC)) || \
-    (defined(ARCH_SPARC) && defined(ENABLE_VIS))
-    accel |= arch_accel();
-#endif
-
-    initialized = 1;
-  }
-
-  return accel;
-}
diff --git a/libkwave/cputest.h b/libkwave/cputest.h
deleted file mode 100644
index 9ffabdcc6..000000000
--- a/libkwave/cputest.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/***************************************************************************
-               cputest.h -  defines with CPU capabilities
-                     -------------------
-    begin                : Mon Dec 06 2004
-    copyright            : (C) 2004 by Thomas Eschenbacher
-    email                : Thomas Eschenbacher <thomas.eschenbacher at gmx.de>
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#ifndef CPUTEST_H
-#define CPUTEST_H
-
-/* x86 accelerations */
-#define MM_ACCEL_X86_MMX        0x80000000
-#define MM_ACCEL_X86_3DNOW      0x40000000
-#define MM_ACCEL_X86_MMXEXT     0x20000000
-#define MM_ACCEL_X86_SSE        0x10000000
-#define MM_ACCEL_X86_SSE2       0x08000000
-#define MM_ACCEL_X86_SSE3       0x04000000
-#define MM_ACCEL_X86_SSSE3      0x02000000
-#define MM_ACCEL_X86_SSE4       0x01000000
-#define MM_ACCEL_X86_SSE42      0x00800000
-#define MM_ACCEL_X86_AVX        0x00400000
-
-/* x86 compat defines */
-#define MM_MMX                  MM_ACCEL_X86_MMX
-#define MM_3DNOW                MM_ACCEL_X86_3DNOW
-#define MM_MMXEXT               MM_ACCEL_X86_MMXEXT
-#define MM_SSE                  MM_ACCEL_X86_SSE
-#define MM_SSE2                 MM_ACCEL_X86_SSE2
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-uint32_t xine_mm_accel (void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* CPUTEST_H */
-
-/***************************************************************************/
-/***************************************************************************/
diff --git a/libkwave/memcpy.c b/libkwave/memcpy.c
deleted file mode 100644
index cc25c2d66..000000000
--- a/libkwave/memcpy.c
+++ /dev/null
@@ -1,702 +0,0 @@
-/*
- * Copyright (C) 2001-2014 the xine project <xine-user at lists.sourceforge.net>
- *
- * This file is part of xine, a free video player.
- *
- * xine is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * xine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- * These are the MMX/MMX2/SSE optimized versions of memcpy
- *
- * This code was adapted from Linux Kernel sources by Nick Kurshev to
- * the mplayer program. (http://mplayer.sourceforge.net)
- *
- * Miguel Freitas split the #ifdefs into several specialized functions that
- * are benchmarked at runtime by xine. Some original comments from Nick
- * have been preserved documenting some MMX/SSE oddities.
- * Also added kernel memcpy function that seems faster than libc one.
- *
- * 2004-12-06
- *   Copied this source into the Kwave project and adapted it to compile
- *   cleanly within this new environment
- *   by Thomas Eschenbacher <Thomas.Eschenbacher at gmx.de>
- *   Marked most changes with "#ifdef XINE_COMPILE"
- *
- * 2009-09-12
- *   synced with latest cvs version from sourceforge.net,
- *   xine/xine-lib/src/xine-utils/memcpy.c, rev. 1.44, 2007-07-20 20:00:36
- *
- * 2014-05-26
- *   synced with latest hg version, xine-lib-1-2-02e5a69f56c9
- *
- * 2015-09-19
- *   keyword "extern" was missing for probe_fast_memcpy()
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef HAVE_SYS_TIMES_H
-#include <sys/times.h>
-#else
-#include <time.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h> /* for uint_64 */
-
-#ifndef XINE_COMPILE
-
-#include "cputest.h"
-#include <stdio.h>
-
-#define _(m) m
-#define xprintf printf
-
-extern void probe_fast_memcpy(void) ;
-extern void *(* xine_fast_memcpy)(void *to, const void *from, size_t len);
-
-#define LOG_MODULE "memcpy"
-#define LOG_VERBOSE
-#define HAVE_AVX
-
-#else /* XINE_COMPILE */
-
-/*
-#define LOG
-*/
-
-#include <xine/xine_internal.h>
-#include "../xine-engine/xine_private.h"
-
-#endif /* XINE_COMPILE */
-
-void *(* xine_fast_memcpy)(void *to, const void *from, size_t len);
-
-/* Original comments from mplayer (file: aclib.c)
- This part of code was taken by me from Linux-2.4.3 and slightly modified
-for MMX, MMX2, SSE instruction set. I have done it since linux uses page aligned
-blocks but mplayer uses weakly ordered data and original sources can not
-speedup them. Only using PREFETCHNTA and MOVNTQ together have effect!
-
->From IA-32 Intel Architecture Software Developer's Manual Volume 1,
-
-Order Number 245470:
-"10.4.6. Cacheability Control, Prefetch, and Memory Ordering Instructions"
-
-Data referenced by a program can be temporal (data will be used again) or
-non-temporal (data will be referenced once and not reused in the immediate
-future). To make efficient use of the processor's caches, it is generally
-desirable to cache temporal data and not cache non-temporal data. Overloading
-the processor's caches with non-temporal data is sometimes referred to as
-"polluting the caches".
-The non-temporal data is written to memory with Write-Combining semantics.
-
-The PREFETCHh instructions permits a program to load data into the processor
-at a suggested cache level, so that it is closer to the processors load and
-store unit when it is needed. If the data is already present in a level of
-the cache hierarchy that is closer to the processor, the PREFETCHh instruction
-will not result in any data movement.
-But we should you PREFETCHNTA: Non-temporal data fetch data into location
-close to the processor, minimizing cache pollution.
-
-The MOVNTQ (store quadword using non-temporal hint) instruction stores
-packed integer data from an MMX register to memory, using a non-temporal hint.
-The MOVNTPS (store packed single-precision floating-point values using
-non-temporal hint) instruction stores packed floating-point data from an
-XMM register to memory, using a non-temporal hint.
-
-The SFENCE (Store Fence) instruction controls write ordering by creating a
-fence for memory store operations. This instruction guarantees that the results
-of every store instruction that precedes the store fence in program order is
-globally visible before any store instruction that follows the fence. The
-SFENCE instruction provides an efficient way of ensuring ordering between
-procedures that produce weakly-ordered data and procedures that consume that
-data.
-
-If you have questions please contact with me: Nick Kurshev: nickols_k at mail.ru.
-*/
-
-/*  mmx v.1 Note: Since we added alignment of destinition it speedups
-    of memory copying on PentMMX, Celeron-1 and P2 upto 12% versus
-    standard (non MMX-optimized) version.
-    Note: on K6-2+ it speedups memory copying upto 25% and
-          on K7 and P3 about 500% (5 times).
-*/
-
-/* Additional notes on gcc assembly and processors: [MF]
-prefetch is specific for AMD processors, the intel ones should be
-prefetch0, prefetch1, prefetch2 which are not recognized by my gcc.
-prefetchnta is supported both on athlon and pentium 3.
-
-therefore i will take off prefetchnta instructions from the mmx1 version
-to avoid problems on pentium mmx and k6-2.
-
-quote of the day:
-"Using prefetches efficiently is more of an art than a science"
-*/
-
-
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
-
-/* for small memory blocks (<256 bytes) this version is faster */
-#define small_memcpy(to,from,n)\
-{\
-register uintptr_t dummy;\
-__asm__ __volatile__(\
-  "rep; movsb"\
-  :"=&D"(to), "=&S"(from), "=&c"(dummy)\
-  :"0" (to), "1" (from),"2" (n)\
-  : "memory");\
-}
-
-/* linux kernel __memcpy (from: /include/asm/string.h) */
-static __inline__ void * linux_kernel_memcpy_impl (
-			       void * to,
-			       const void * from,
-			       size_t n)
-{
-int d0, d1, d2;
-
-  if( n < 4 ) {
-    small_memcpy(to,from,n);
-  }
-  else
-    __asm__ __volatile__(
-    "rep ; movsl\n\t"
-    "testb $2,%b4\n\t"
-    "je 1f\n\t"
-    "movsw\n"
-    "1:\ttestb $1,%b4\n\t"
-    "je 2f\n\t"
-    "movsb\n"
-    "2:"
-    : "=&c" (d0), "=&D" (d1), "=&S" (d2)
-    :"0" (n/4), "q" (n),"1" ((uintptr_t) to),"2" ((uintptr_t) from)
-    : "memory");
-
-  return (to);
-}
-
-#define AVX_MMREG_SIZE 32
-#define SSE_MMREG_SIZE 16
-#define MMX_MMREG_SIZE 8
-
-#define MMX1_MIN_LEN 0x800  /* 2K blocks */
-#define MIN_LEN 0x40  /* 64-byte blocks */
-
-/* SSE note: i tried to move 128 bytes a time instead of 64 but it
-didn't make any measureable difference. i'm using 64 for the sake of
-simplicity. [MF] */
-static void * sse_memcpy(void * to, const void * from, size_t len)
-{
-  void *retval;
-  size_t i;
-  retval = to;
-
-  /* PREFETCH has effect even for MOVSB instruction ;) */
-  __asm__ __volatile__ (
-    "   prefetchnta (%0)\n"
-    "   prefetchnta 32(%0)\n"
-    "   prefetchnta 64(%0)\n"
-    "   prefetchnta 96(%0)\n"
-    "   prefetchnta 128(%0)\n"
-    "   prefetchnta 160(%0)\n"
-    "   prefetchnta 192(%0)\n"
-    "   prefetchnta 224(%0)\n"
-    "   prefetchnta 256(%0)\n"
-    "   prefetchnta 288(%0)\n"
-    : : "r" (from) );
-
-  if(len >= MIN_LEN)
-  {
-    register uintptr_t delta;
-    /* Align destinition to MMREG_SIZE -boundary */
-    delta = ((uintptr_t)to)&(SSE_MMREG_SIZE-1);
-    if(delta)
-    {
-      delta=SSE_MMREG_SIZE-delta;
-      len -= delta;
-      small_memcpy(to, from, delta);
-    }
-    i = len >> 6; /* len/64 */
-    len&=63;
-    if(((uintptr_t)from) & 15)
-      /* if SRC is misaligned */
-      for(; i>0; i--)
-      {
-        __asm__ __volatile__ (
-        "prefetchnta 320(%0)\n"
-       "prefetchnta 352(%0)\n"
-        "movups (%0), %%xmm0\n"
-        "movups 16(%0), %%xmm1\n"
-        "movups 32(%0), %%xmm2\n"
-        "movups 48(%0), %%xmm3\n"
-        "movntps %%xmm0, (%1)\n"
-        "movntps %%xmm1, 16(%1)\n"
-        "movntps %%xmm2, 32(%1)\n"
-        "movntps %%xmm3, 48(%1)\n"
-        :: "r" (from), "r" (to) : "memory");
-        from = ((const unsigned char *)from) + 64;
-        to = ((unsigned char *)to) + 64;
-      }
-    else
-      /*
-         Only if SRC is aligned on 16-byte boundary.
-         It allows to use movaps instead of movups, which required data
-         to be aligned or a general-protection exception (#GP) is generated.
-      */
-      for(; i>0; i--)
-      {
-        __asm__ __volatile__ (
-        "prefetchnta 320(%0)\n"
-       "prefetchnta 352(%0)\n"
-        "movaps (%0), %%xmm0\n"
-        "movaps 16(%0), %%xmm1\n"
-        "movaps 32(%0), %%xmm2\n"
-        "movaps 48(%0), %%xmm3\n"
-        "movntps %%xmm0, (%1)\n"
-        "movntps %%xmm1, 16(%1)\n"
-        "movntps %%xmm2, 32(%1)\n"
-        "movntps %%xmm3, 48(%1)\n"
-        :: "r" (from), "r" (to) : "memory");
-        from = ((const unsigned char *)from) + 64;
-        to = ((unsigned char *)to) + 64;
-      }
-    /* since movntq is weakly-ordered, a "sfence"
-     * is needed to become ordered again. */
-    __asm__ __volatile__ ("sfence":::"memory");
-  }
-  /*
-   *	Now do the tail of the block
-   */
-  if(len) linux_kernel_memcpy_impl(to, from, len);
-  return retval;
-}
-
-#ifdef HAVE_AVX
-static void * avx_memcpy(void * to, const void * from, size_t len)
-{
-  void *retval;
-  size_t i;
-  retval = to;
-
-  /* PREFETCH has effect even for MOVSB instruction ;) */
-  __asm__ __volatile__ (
-    "   prefetchnta (%0)\n"
-    "   prefetchnta 32(%0)\n"
-    "   prefetchnta 64(%0)\n"
-    "   prefetchnta 96(%0)\n"
-    "   prefetchnta 128(%0)\n"
-    "   prefetchnta 160(%0)\n"
-    "   prefetchnta 192(%0)\n"
-    "   prefetchnta 224(%0)\n"
-    "   prefetchnta 256(%0)\n"
-    "   prefetchnta 288(%0)\n"
-    : : "r" (from) );
-
-  if(len >= MIN_LEN)
-  {
-    register uintptr_t delta;
-    /* Align destinition to MMREG_SIZE -boundary */
-    delta = ((uintptr_t)to)&(AVX_MMREG_SIZE-1);
-    if(delta)
-    {
-      delta=AVX_MMREG_SIZE-delta;
-      len -= delta;
-      small_memcpy(to, from, delta);
-    }
-    i = len >> 7; /* len/128 */
-    len&=127;
-    if(((uintptr_t)from) & 31)
-      /* if SRC is misaligned */
-      for(; i>0; i--)
-      {
-        __asm__ __volatile__ (
-        "prefetchnta 320(%0)\n"
-        "prefetchnta 352(%0)\n"
-        "prefetchnta 384(%0)\n"
-        "prefetchnta 416(%0)\n"
-        "vmovups    (%0), %%ymm0\n"
-        "vmovups  32(%0), %%ymm1\n"
-        "vmovups  64(%0), %%ymm2\n"
-        "vmovups  96(%0), %%ymm3\n"
-        "vmovntps %%ymm0,   (%1)\n"
-        "vmovntps %%ymm1, 32(%1)\n"
-        "vmovntps %%ymm2, 64(%1)\n"
-        "vmovntps %%ymm3, 96(%1)\n"
-        :: "r" (from), "r" (to) : "memory");
-        from = ((const unsigned char *)from) + 128;
-        to = ((unsigned char *)to) + 128;
-      }
-    else
-      /*
-         Only if SRC is aligned on 16-byte boundary.
-         It allows to use movaps instead of movups, which required data
-         to be aligned or a general-protection exception (#GP) is generated.
-      */
-      for(; i>0; i--)
-      {
-        __asm__ __volatile__ (
-        "prefetchnta 320(%0)\n"
-        "prefetchnta 352(%0)\n"
-        "prefetchnta 384(%0)\n"
-        "prefetchnta 416(%0)\n"
-        "vmovaps    (%0), %%ymm0\n"
-        "vmovaps  32(%0), %%ymm1\n"
-        "vmovaps  64(%0), %%ymm2\n"
-        "vmovaps  96(%0), %%ymm3\n"
-        "vmovntps %%ymm0,   (%1)\n"
-        "vmovntps %%ymm1, 32(%1)\n"
-        "vmovntps %%ymm2, 64(%1)\n"
-        "vmovntps %%ymm3, 96(%1)\n"
-        :: "r" (from), "r" (to) : "memory");
-        from = ((const unsigned char *)from) + 128;
-        to = ((unsigned char *)to) + 128;
-      }
-    /* since movntq is weakly-ordered, a "sfence"
-     * is needed to become ordered again. */
-    __asm__ __volatile__ ("sfence":::"memory");
-    __asm__ __volatile__ ("vzeroupper");
-  }
-  /*
-   *	Now do the tail of the block
-   */
-  if(len) linux_kernel_memcpy_impl(to, from, len);
-  return retval;
-}
-#endif /* HAVE_AVX */
-
-static void * mmx_memcpy(void * to, const void * from, size_t len)
-{
-  void *retval;
-  size_t i;
-  retval = to;
-
-  if(len >= MMX1_MIN_LEN)
-  {
-    register uintptr_t delta;
-    /* Align destinition to MMREG_SIZE -boundary */
-    delta = ((uintptr_t)to)&(MMX_MMREG_SIZE-1);
-    if(delta)
-    {
-      delta=MMX_MMREG_SIZE-delta;
-      len -= delta;
-      small_memcpy(to, from, delta);
-    }
-    i = len >> 6; /* len/64 */
-    len&=63;
-    for(; i>0; i--)
-    {
-      __asm__ __volatile__ (
-      "movq (%0), %%mm0\n"
-      "movq 8(%0), %%mm1\n"
-      "movq 16(%0), %%mm2\n"
-      "movq 24(%0), %%mm3\n"
-      "movq 32(%0), %%mm4\n"
-      "movq 40(%0), %%mm5\n"
-      "movq 48(%0), %%mm6\n"
-      "movq 56(%0), %%mm7\n"
-      "movq %%mm0, (%1)\n"
-      "movq %%mm1, 8(%1)\n"
-      "movq %%mm2, 16(%1)\n"
-      "movq %%mm3, 24(%1)\n"
-      "movq %%mm4, 32(%1)\n"
-      "movq %%mm5, 40(%1)\n"
-      "movq %%mm6, 48(%1)\n"
-      "movq %%mm7, 56(%1)\n"
-      :: "r" (from), "r" (to) : "memory");
-      from = ((const unsigned char *)from) + 64;
-      to = ((unsigned char *)to) + 64;
-    }
-    __asm__ __volatile__ ("emms":::"memory");
-  }
-  /*
-   *	Now do the tail of the block
-   */
-  if(len) linux_kernel_memcpy_impl(to, from, len);
-  return retval;
-}
-
-static void * mmx2_memcpy(void * to, const void * from, size_t len)
-{
-  void *retval;
-  size_t i;
-  retval = to;
-
-  /* PREFETCH has effect even for MOVSB instruction ;) */
-  __asm__ __volatile__ (
-    "   prefetchnta (%0)\n"
-    "   prefetchnta 32(%0)\n"
-    "   prefetchnta 64(%0)\n"
-    "   prefetchnta 96(%0)\n"
-    "   prefetchnta 128(%0)\n"
-    "   prefetchnta 160(%0)\n"
-    "   prefetchnta 192(%0)\n"
-    "   prefetchnta 224(%0)\n"
-    "   prefetchnta 256(%0)\n"
-    "   prefetchnta 288(%0)\n"
-    : : "r" (from) );
-
-  if(len >= MIN_LEN)
-  {
-    register uintptr_t delta;
-    /* Align destinition to MMREG_SIZE -boundary */
-    delta = ((uintptr_t)to)&(MMX_MMREG_SIZE-1);
-    if(delta)
-    {
-      delta=MMX_MMREG_SIZE-delta;
-      len -= delta;
-      small_memcpy(to, from, delta);
-    }
-    i = len >> 6; /* len/64 */
-    len&=63;
-    for(; i>0; i--)
-    {
-      __asm__ __volatile__ (
-      "prefetchnta 320(%0)\n"
-      "prefetchnta 352(%0)\n"
-      "movq (%0), %%mm0\n"
-      "movq 8(%0), %%mm1\n"
-      "movq 16(%0), %%mm2\n"
-      "movq 24(%0), %%mm3\n"
-      "movq 32(%0), %%mm4\n"
-      "movq 40(%0), %%mm5\n"
-      "movq 48(%0), %%mm6\n"
-      "movq 56(%0), %%mm7\n"
-      "movntq %%mm0, (%1)\n"
-      "movntq %%mm1, 8(%1)\n"
-      "movntq %%mm2, 16(%1)\n"
-      "movntq %%mm3, 24(%1)\n"
-      "movntq %%mm4, 32(%1)\n"
-      "movntq %%mm5, 40(%1)\n"
-      "movntq %%mm6, 48(%1)\n"
-      "movntq %%mm7, 56(%1)\n"
-      :: "r" (from), "r" (to) : "memory");
-      from = ((const unsigned char *)from) + 64;
-      to = ((unsigned char *)to) + 64;
-    }
-     /* since movntq is weakly-ordered, a "sfence"
-     * is needed to become ordered again. */
-    __asm__ __volatile__ ("sfence":::"memory");
-    __asm__ __volatile__ ("emms":::"memory");
-  }
-  /*
-   *	Now do the tail of the block
-   */
-  if(len) linux_kernel_memcpy_impl(to, from, len);
-  return retval;
-}
-
-static void *linux_kernel_memcpy(void *to, const void *from, size_t len) {
-  return linux_kernel_memcpy_impl(to,from,len);
-}
-#endif /* ARCH_X86 */
-
-static const struct {
-  const char name[16];
-  void *(*const  function)(void *to, const void *from, size_t len);
-
-  uint32_t cpu_require;
-} memcpy_method[] =
-{
-  { "", NULL, 0 },
-  { "libc", memcpy, 0 },
-#if (defined(ARCH_X86) || defined(ARCH_X86_64))
-  { "linux kernel", linux_kernel_memcpy, 0 },
-  { "MMX ", mmx_memcpy, MM_MMX },
-  { "MMXEXT", mmx2_memcpy, MM_MMXEXT },
-  { "SSE", sse_memcpy, MM_MMXEXT|MM_SSE },
-# ifdef HAVE_AVX
-  { "AVX", avx_memcpy, MM_ACCEL_X86_AVX },
-# endif /* HAVE_AVX */
-#endif /* ARCH_X86 */
-  { "", NULL, 0 }
-};
-
-static uint64_t memcpy_timing[sizeof(memcpy_method)/sizeof(memcpy_method[0])] = { 0, };
-
-#ifdef HAVE_POSIX_TIMERS
-/* Prefer clock_gettime() where available. */
-
-# ifndef CLOCK_THREAD_CPUTIME_ID
-/*  not defined in NetBSD (bug #535) */
-#   define CLOCK_THREAD_CPUTIME_ID CLOCK_MONOTONIC
-# endif
-
-static int64_t _x_gettime(void)
-{
-  struct timespec tm;
-  return (clock_gettime (CLOCK_THREAD_CPUTIME_ID, &tm) == -1)
-       ? times (NULL)
-       : (int64_t)tm.tv_sec * 1e9 + tm.tv_nsec;
-}
-#  define rdtsc(x) _x_gettime()
-
-#elif (defined(ARCH_X86) || defined(ARCH_X86_64)) && defined(HAVE_SYS_TIMES_H)
-static int64_t rdtsc(int config_flags)
-{
-  int64_t x;
-
-  /* that should prevent us from trying cpuid with old cpus */
-  if( config_flags & MM_MMX ) {
-    __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
-    return x;
-  } else {
-    return times(NULL);
-  }
-}
-#else
-
-static uint64_t rdtsc(int config_flags)
-{
-  (void)config_flags;
-  /* FIXME: implement an equivalent for using optimized memcpy on other
-            architectures */
-#ifdef HAVE_SYS_TIMES_H
-  struct tms tp;
-  return times(&tp);
-#else
-	return clock();
-#endif /* HAVE_SYS_TIMES_H */
-}
-#endif
-
-#ifdef XINE_COMPILE
-static void update_fast_memcpy(void *user_data, xine_cfg_entry_t *entry) {
-  static int   config_flags = -1;
-  xine_t      *xine = (xine_t *) user_data;
-  int          method;
-
-  config_flags = xine_mm_accel();
-
-  method = entry->num_value;
-
-  if (method != 0
-      && (config_flags & memcpy_method[method].cpu_require) ==
-      memcpy_method[method].cpu_require ) {
-    lprintf("using %s memcpy()\n", memcpy_method[method].name );
-    xine_fast_memcpy = memcpy_method[method].function;
-    return;
-  } else {
-    xprintf(xine, XINE_VERBOSITY_DEBUG, "xine: will probe memcpy on startup\n" );
-  }
-}
-#endif /* XINE_COMPILE */
-
-#define BUFSIZE 1024*1024
-#ifdef XINE_COMPILE
-void xine_probe_fast_memcpy(xine_t *xine)
-#else
-void probe_fast_memcpy(void)
-#endif /* XINE_COMPILE */
-{
-  uint64_t          t;
-  char             *buf1, *buf2;
-  int               i, j, best;
-  int               config_flags = -1;
-
-#ifdef XINE_COMPILE
-
-  static const char *const memcpy_methods[] = {
-    "probe", "libc",
-#if (defined(ARCH_X86) || defined(ARCH_X86_64))
-    "kernel", "mmx", "mmxext", "sse",
-# ifdef HAVE_AVX
-    "avx",
-# endif /* HAVE_AVX */
-#endif
-    NULL
-  };
-
-  config_flags = xine_mm_accel();
-
-  best = xine->config->register_enum (xine->config, "engine.performance.memcpy_method", 0,
-				      (char **)memcpy_methods,
-				      _("memcopy method used by xine"),
-				      _("The copying of large memory blocks is one of the most "
-					"expensive operations on todays computers. Therefore xine "
-					"provides various tuned methods to do this copying. "
-					"Usually, the best method is detected automatically."),
-				      20, update_fast_memcpy, (void *) xine);
-
-  /* check if function is configured and valid for this machine */
-  if( best != 0 &&
-      best < sizeof(memcpy_methods)/sizeof(memcpy_method[0]) &&
-     (config_flags & memcpy_method[best].cpu_require) ==
-      memcpy_method[best].cpu_require ) {
-    lprintf("using %s memcpy()\n", memcpy_method[best].name );
-    xine_fast_memcpy = memcpy_method[best].function;
-    return;
-  }
-#else /* XINE_COMPILE */
-  config_flags = xine_mm_accel();
-#endif /* XINE_COMPILE */
-  best = 0;
-
-  xine_fast_memcpy = memcpy;
-
-  if( (buf1 = malloc(BUFSIZE)) == NULL )
-    return;
-
-  if( (buf2 = malloc(BUFSIZE)) == NULL ) {
-    free(buf1);
-    return;
-  }
-
-  xprintf(_("Benchmarking memcpy methods (smaller is better):\n"));
-  /* make sure buffers are present on physical memory */
-  memset(buf1,0,BUFSIZE);
-  memset(buf2,0,BUFSIZE);
-
-  /* some initial activity to ensure that we're not running slowly :-) */
-  for(j=0;j<50;j++) {
-    memcpy_method[1].function(buf2,buf1,BUFSIZE);
-    memcpy_method[1].function(buf1,buf2,BUFSIZE);
-  }
-
-  for(i=1; memcpy_method[i].name[0]; i++)
-  {
-    if( (config_flags & memcpy_method[i].cpu_require) !=
-         memcpy_method[i].cpu_require )
-      continue;
-
-    t = rdtsc(config_flags);
-    for(j=0;j<50;j++) {
-      memcpy_method[i].function(buf2,buf1,BUFSIZE);
-      memcpy_method[i].function(buf1,buf2,BUFSIZE);
-    }
-
-    t = rdtsc(config_flags) - t;
-    memcpy_timing[i] = t;
-
-    xprintf("\t%s : %lld\n", memcpy_method[i].name, (long long int)t);
-
-    if( best == 0 || t < memcpy_timing[best] )
-      best = i;
-  }
-
-#ifdef XINE_COMPILE
-  xine->config->update_num (xine->config, "engine.performance.memcpy_method", best);
-#else /* XINE_COMPILE */
-  xprintf("using -> '%s'\n", memcpy_method[best].name);
-  xine_fast_memcpy = memcpy_method[best].function;
-#endif /* XINE_COMPILE */
-
-  free(buf1);
-  free(buf2);
-}
-
diff --git a/libkwave/memcpy.h b/libkwave/memcpy.h
index de8d8b365..e67e86744 100644
--- a/libkwave/memcpy.h
+++ b/libkwave/memcpy.h
@@ -19,25 +19,11 @@
 
 #include "config.h"
 
-#ifdef WITH_OPTIMIZED_MEMCPY
-
-#include <stdlib.h> /* for size_t */
-
-/** use optimized memcpy() from xine */
-#define MEMCPY xine_fast_memcpy
-
-/* forward declaration to libkwave/memcpy.c */
-extern "C" void *(* xine_fast_memcpy)(void *to, const void *from, size_t len);
-
-#else /* WITH_OPTIMIZED_MEMCPY */
-
 #include <string.h> /* for memcpy from libc */
 
 /** use standard memcpy() from libc */
 #define MEMCPY memcpy
 
-#endif /* WITH_OPTIMIZED_MEMCPY */
-
 #endif /* MEMCPY_H */
 
 //***************************************************************************


More information about the kde-doc-english mailing list