Mercurial > mplayer.hg
annotate liba52/resample.c @ 31020:529614f44431
First steps to support -vo gl with SDL-based Window handling.
author | reimar |
---|---|
date | Sat, 24 Apr 2010 16:46:47 +0000 |
parents | 25337a2147e7 |
children |
rev | line source |
---|---|
25483 | 1 /* |
2 * resample.c | |
3 * Copyright (C) 2001 Árpád Gereöffy | |
4 * | |
5 * This file is part of a52dec, a free ATSC A-52 stream decoder. | |
6 * See http://liba52.sourceforge.net/ for updates. | |
7 * | |
8 * File added for use with MPlayer and not part of original a52dec. | |
9 * | |
10 * a52dec is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; either version 2 of the License, or | |
13 * (at your option) any later version. | |
14 * | |
15 * a52dec is distributed in the hope that it will be useful, | |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 * GNU General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU General Public License | |
21 * along with this program; if not, write to the Free Software | |
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 */ | |
3412
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
24 |
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
25 // 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
|
26 // given number of channels) and set up some function pointers... |
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
27 |
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
28 // a52_resample() should do the conversion. |
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
29 |
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
30 #include <inttypes.h> |
3626 | 31 #include <stdio.h> |
3412
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
32 #include "a52.h" |
3908 | 33 #include "mm_accel.h" |
26544 | 34 #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
|
35 #include "mangle.h" |
3567 | 36 |
3626 | 37 int (* a52_resample) (float * _f, int16_t * s16)=NULL; |
38 | |
3909 | 39 #include "resample_c.c" |
40 | |
28290 | 41 #if ARCH_X86 || ARCH_X86_64 |
3909 | 42 #include "resample_mmx.c" |
3567 | 43 #endif |
3412
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
44 |
28290 | 45 #if HAVE_ALTIVEC |
11849
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
46 #include "resample_altivec.c" |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
47 #endif |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
48 |
3909 | 49 void* a52_resample_init(uint32_t mm_accel,int flags,int chans){ |
50 void* tmp; | |
3626 | 51 |
28290 | 52 #if ARCH_X86 || ARCH_X86_64 |
3909 | 53 if(mm_accel&MM_ACCEL_X86_MMX){ |
54 tmp=a52_resample_MMX(flags,chans); | |
55 if(tmp){ | |
56 if(a52_resample==NULL) fprintf(stderr, "Using MMX optimized resampler\n"); | |
57 a52_resample=tmp; | |
58 return tmp; | |
59 } | |
60 } | |
61 #endif | |
28290 | 62 #if HAVE_ALTIVEC |
11849
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
63 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
|
64 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
|
65 if(tmp){ |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
66 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
|
67 a52_resample=tmp; |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
68 return tmp; |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
69 } |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
70 } |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
71 #endif |
25484
943f37a4323d
cosmetics: Remove trailing whitespace, reformat one comment.
diego
parents:
25483
diff
changeset
|
72 |
3909 | 73 tmp=a52_resample_C(flags,chans); |
74 if(tmp){ | |
75 if(a52_resample==NULL) fprintf(stderr, "No accelerated resampler found\n"); | |
76 a52_resample=tmp; | |
77 return tmp; | |
3626 | 78 } |
25484
943f37a4323d
cosmetics: Remove trailing whitespace, reformat one comment.
diego
parents:
25483
diff
changeset
|
79 |
3909 | 80 fprintf(stderr, "Unimplemented resampler for mode 0x%X -> %d channels conversion - Contact MPlayer developers!\n", flags, chans); |
81 return NULL; | |
3626 | 82 } |