1
mirror of https://github.com/mpv-player/mpv synced 2024-12-24 07:33:46 +01:00

runtime cpudetect the liba52 way part 2 (downmix.c)

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3911 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
michael 2001-12-30 21:53:56 +00:00
parent 1d213cc5e4
commit d5ea3b4e44
3 changed files with 14 additions and 11 deletions

View File

@ -43,6 +43,7 @@ void bit_allocate (a52_state_t * state, a52_ba_t * ba, int bndstart,
int downmix_init (int input, int flags, sample_t * level, int downmix_init (int input, int flags, sample_t * level,
sample_t clev, sample_t slev); sample_t clev, sample_t slev);
void downmix_accel_init(uint32_t mm_accel);
int downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level, int downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level,
sample_t clev, sample_t slev); sample_t clev, sample_t slev);
extern void (*downmix) (sample_t * samples, int acmod, int output, sample_t bias, extern void (*downmix) (sample_t * samples, int acmod, int output, sample_t bias,

View File

@ -24,18 +24,16 @@
*/ */
#include "config.h" #include "config.h"
#include "../cpudetect.h"
#include <string.h> #include <string.h>
#include <inttypes.h> #include <inttypes.h>
#include "a52.h" #include "a52.h"
#include "a52_internal.h" #include "a52_internal.h"
#include "mm_accel.h"
#define CONVERT(acmod,output) (((output) << 3) + (acmod)) #define CONVERT(acmod,output) (((output) << 3) + (acmod))
//#undef HAVE_SSE
//#undef HAVE_MMX
void (*downmix)(sample_t * samples, int acmod, int output, sample_t bias, void (*downmix)(sample_t * samples, int acmod, int output, sample_t bias,
sample_t clev, sample_t slev)= NULL; sample_t clev, sample_t slev)= NULL;
@ -48,6 +46,16 @@ static void downmix_C (sample_t * samples, int acmod, int output, sample_t bias,
static void upmix_MMX (sample_t * samples, int acmod, int output); static void upmix_MMX (sample_t * samples, int acmod, int output);
static void upmix_C (sample_t * samples, int acmod, int output); static void upmix_C (sample_t * samples, int acmod, int output);
void downmix_accel_init(uint32_t mm_accel)
{
upmix= upmix_C;
downmix= downmix_C;
#ifdef ARCH_X86
if(mm_accel & MM_ACCEL_X86_MMX) upmix= upmix_MMX;
if(mm_accel & MM_ACCEL_X86_SSE) downmix= downmix_SSE;
#endif
}
int downmix_init (int input, int flags, sample_t * level, int downmix_init (int input, int flags, sample_t * level,
sample_t clev, sample_t slev) sample_t clev, sample_t slev)
{ {
@ -77,13 +85,6 @@ int downmix_init (int input, int flags, sample_t * level,
}; };
int output; int output;
upmix= upmix_C;
downmix= downmix_C;
#ifdef ARCH_X86
if(gCpuCaps.hasMMX) upmix= upmix_MMX;
if(gCpuCaps.hasSSE) downmix= downmix_SSE;
#endif
output = flags & A52_CHANNEL_MASK; output = flags & A52_CHANNEL_MASK;
if (output > A52_DOLBY) if (output > A52_DOLBY)
return -1; return -1;

View File

@ -57,6 +57,7 @@ sample_t * a52_init (uint32_t mm_accel)
int i; int i;
imdct_init (mm_accel); imdct_init (mm_accel);
downmix_accel_init(mm_accel);
samples = memalign (16, 256 * 12 * sizeof (sample_t)); samples = memalign (16, 256 * 12 * sizeof (sample_t));
if (samples == NULL) if (samples == NULL)