annotate liba52/resample.c @ 23914:43718b819ab4

Another missed case-range
author reimar
date Mon, 30 Jul 2007 13:55:51 +0000
parents d6219ce521e9
children 170fc6d9dfa1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
1
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
2 // a52_resample_init should find the requested converter (from type flags ->
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
3 // given number of channels) and set up some function pointers...
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
4
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
5 // a52_resample() should do the conversion.
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
6
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
7 #include <inttypes.h>
3626
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
8 #include <stdio.h>
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
9 #include "a52.h"
3908
0cc94b1eec0f runtime cpudetect in liba52 way
michael
parents: 3907
diff changeset
10 #include "mm_accel.h"
3567
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
11 #include "../config.h"
4247
2dbd637ffe05 mangle for win32 in liba52 (includes dummy mangle.h pointing to the one in main)
atmos4
parents: 3909
diff changeset
12 #include "mangle.h"
3567
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
13
3626
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
14 int (* a52_resample) (float * _f, int16_t * s16)=NULL;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
15
3909
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
16 #include "resample_c.c"
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
17
16173
d6219ce521e9 liba52 asm optimizations ported to amd64
aurel
parents: 11849
diff changeset
18 #if defined(ARCH_X86) || defined(ARCH_X86_64)
3909
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
19 #include "resample_mmx.c"
3567
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
20 #endif
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
21
11849
459ba3f14302 Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents: 4247
diff changeset
22 #ifdef HAVE_ALTIVEC
459ba3f14302 Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents: 4247
diff changeset
23 #include "resample_altivec.c"
459ba3f14302 Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents: 4247
diff changeset
24 #endif
459ba3f14302 Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents: 4247
diff changeset
25
3909
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
26 void* a52_resample_init(uint32_t mm_accel,int flags,int chans){
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
27 void* tmp;
3626
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
28
16173
d6219ce521e9 liba52 asm optimizations ported to amd64
aurel
parents: 11849
diff changeset
29 #if defined(ARCH_X86) || defined(ARCH_X86_64)
3909
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
30 if(mm_accel&MM_ACCEL_X86_MMX){
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
31 tmp=a52_resample_MMX(flags,chans);
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
32 if(tmp){
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
33 if(a52_resample==NULL) fprintf(stderr, "Using MMX optimized resampler\n");
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
34 a52_resample=tmp;
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
35 return tmp;
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
36 }
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
37 }
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
38 #endif
11849
459ba3f14302 Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents: 4247
diff changeset
39 #ifdef HAVE_ALTIVEC
459ba3f14302 Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents: 4247
diff changeset
40 if(mm_accel&MM_ACCEL_PPC_ALTIVEC){
459ba3f14302 Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents: 4247
diff changeset
41 tmp=a52_resample_altivec(flags,chans);
459ba3f14302 Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents: 4247
diff changeset
42 if(tmp){
459ba3f14302 Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents: 4247
diff changeset
43 if(a52_resample==NULL) fprintf(stderr, "Using AltiVec optimized resampler\n");
459ba3f14302 Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents: 4247
diff changeset
44 a52_resample=tmp;
459ba3f14302 Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents: 4247
diff changeset
45 return tmp;
459ba3f14302 Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents: 4247
diff changeset
46 }
459ba3f14302 Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents: 4247
diff changeset
47 }
459ba3f14302 Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents: 4247
diff changeset
48 #endif
459ba3f14302 Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents: 4247
diff changeset
49
3909
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
50 tmp=a52_resample_C(flags,chans);
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
51 if(tmp){
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
52 if(a52_resample==NULL) fprintf(stderr, "No accelerated resampler found\n");
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
53 a52_resample=tmp;
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
54 return tmp;
3626
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
55 }
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
56
3909
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
57 fprintf(stderr, "Unimplemented resampler for mode 0x%X -> %d channels conversion - Contact MPlayer developers!\n", flags, chans);
ef32c8bdee81 c, mmx versions separated. a52 style runtime stuff
arpi
parents: 3908
diff changeset
58 return NULL;
3626
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
59 }