diff options
author | gpoirier <gpoirier@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-06-16 13:40:00 +0000 |
---|---|---|
committer | gpoirier <gpoirier@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-06-16 13:40:00 +0000 |
commit | fe8651b4cf5e4e0e460fd99cca3ac92b25029de1 (patch) | |
tree | 07b09305bb808fdc738311081cddf50eceb3f5b1 /libmpeg2 | |
parent | 1e93d2b2baa0c0d09c1096725751dd9103c3d552 (diff) | |
download | mpv-fe8651b4cf5e4e0e460fd99cca3ac92b25029de1.tar.bz2 mpv-fe8651b4cf5e4e0e460fd99cca3ac92b25029de1.tar.xz |
Use MPlayer's CPU detection module instead of libmpeg2's,
initial patch by Jim Huang jserv A linux2°cc°ntu°edu°tw,
reworked by me according to The Guru's advices ;-)
Original thread:
Date: Jun 15, 2006 8:35 AM
Subject: [MPlayer-dev-eng] [PATCH] Remove duplicated CPU detection in libmpeg2
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18730 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpeg2')
-rw-r--r-- | libmpeg2/cpu_accel.c | 23 | ||||
-rw-r--r-- | libmpeg2/mpeg2.h | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/libmpeg2/cpu_accel.c b/libmpeg2/cpu_accel.c index 715b126642..ee90a583ae 100644 --- a/libmpeg2/cpu_accel.c +++ b/libmpeg2/cpu_accel.c @@ -26,6 +26,7 @@ */ #include "config.h" +#include "cpudetect.h" #include <inttypes.h> @@ -35,8 +36,16 @@ #ifdef ACCEL_DETECT #if defined(ARCH_X86) || defined(ARCH_X86_64) + +/* MPlayer imports libmpeg2 as decoder, which detects MMX / 3DNow! + * instructions via assembly. However, it is regarded as duplicaed work + * in MPlayer, so that we enforce to use MPlayer's implementation. + */ +#define USE_MPLAYER_CPUDETECT + static inline uint32_t arch_accel (void) { +#if !defined(USE_MPLAYER_CPUDETECT) uint32_t eax, ebx, ecx, edx; int AMD; uint32_t caps; @@ -109,6 +118,20 @@ static inline uint32_t arch_accel (void) caps |= MPEG2_ACCEL_X86_MMXEXT; return caps; +#else /* USE_MPLAYER_CPUDETECT: Use MPlayer's cpu capability property */ + caps = 0; + if (gCpuCaps.hasMMX) + caps |= MPEG2_ACCEL_X86_MMX; + if (gCpuCaps.hasSSE2) + caps |= MPEG2_ACCEL_X86_SSE2; + if (gCpuCaps.hasMMX2) + caps |= MPEG2_ACCEL_X86_MMXEXT; + if (gCpuCaps.has3DNow) + caps |= MPEG2_ACCEL_X86_3DNOW; + + return caps; + +#endif /* USE_MPLAYER_CPUDETECT */ } #endif /* ARCH_X86 || ARCH_X86_64 */ diff --git a/libmpeg2/mpeg2.h b/libmpeg2/mpeg2.h index 388d885a85..fc65165769 100644 --- a/libmpeg2/mpeg2.h +++ b/libmpeg2/mpeg2.h @@ -159,6 +159,7 @@ void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf); #define MPEG2_ACCEL_X86_MMX 1 #define MPEG2_ACCEL_X86_3DNOW 2 #define MPEG2_ACCEL_X86_MMXEXT 4 +#define MPEG2_ACCEL_X86_SSE2 8 #define MPEG2_ACCEL_PPC_ALTIVEC 1 #define MPEG2_ACCEL_ALPHA 1 #define MPEG2_ACCEL_ALPHA_MVI 2 |