synced with r21741
[mplayer/glamo.git] / liba52 / resample.c
blobe130afef867bac3cec76d712c03c5ca21ae90f0f
2 // a52_resample_init should find the requested converter (from type flags ->
3 // given number of channels) and set up some function pointers...
5 // a52_resample() should do the conversion.
7 #include <inttypes.h>
8 #include <stdio.h>
9 #include "a52.h"
10 #include "mm_accel.h"
11 #include "../config.h"
12 #include "mangle.h"
14 int (* a52_resample) (float * _f, int16_t * s16)=NULL;
16 #include "resample_c.c"
18 #if defined(ARCH_X86) || defined(ARCH_X86_64)
19 #include "resample_mmx.c"
20 #endif
22 #ifdef HAVE_ALTIVEC
23 #include "resample_altivec.c"
24 #endif
26 void* a52_resample_init(uint32_t mm_accel,int flags,int chans){
27 void* tmp;
29 #if defined(ARCH_X86) || defined(ARCH_X86_64)
30 if(mm_accel&MM_ACCEL_X86_MMX){
31 tmp=a52_resample_MMX(flags,chans);
32 if(tmp){
33 if(a52_resample==NULL) fprintf(stderr, "Using MMX optimized resampler\n");
34 a52_resample=tmp;
35 return tmp;
38 #endif
39 #ifdef HAVE_ALTIVEC
40 if(mm_accel&MM_ACCEL_PPC_ALTIVEC){
41 tmp=a52_resample_altivec(flags,chans);
42 if(tmp){
43 if(a52_resample==NULL) fprintf(stderr, "Using AltiVec optimized resampler\n");
44 a52_resample=tmp;
45 return tmp;
48 #endif
50 tmp=a52_resample_C(flags,chans);
51 if(tmp){
52 if(a52_resample==NULL) fprintf(stderr, "No accelerated resampler found\n");
53 a52_resample=tmp;
54 return tmp;
57 fprintf(stderr, "Unimplemented resampler for mode 0x%X -> %d channels conversion - Contact MPlayer developers!\n", flags, chans);
58 return NULL;