annotate mp3lib/decod386.c @ 25400:fb8ad8ae4dfd

The function parameter 'preferred_language' should be const char *.
author ulion
date Mon, 17 Dec 2007 01:06:17 +0000
parents 49aa1cef1867
children e7c989f7a7c9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15167
07e7a572bd84 Mark modified imported files as such to comply with (L)GPL ¡ø2a.
diego
parents: 13188
diff changeset
1 /*
18783
0783dd397f74 CVS --> Subversion in copyright notices
diego
parents: 16989
diff changeset
2 * Modified for use with MPlayer, for details see the changelog at
0783dd397f74 CVS --> Subversion in copyright notices
diego
parents: 16989
diff changeset
3 * http://svn.mplayerhq.hu/mplayer/trunk/
15167
07e7a572bd84 Mark modified imported files as such to comply with (L)GPL ¡ø2a.
diego
parents: 13188
diff changeset
4 * $Id$
07e7a572bd84 Mark modified imported files as such to comply with (L)GPL ¡ø2a.
diego
parents: 13188
diff changeset
5 */
07e7a572bd84 Mark modified imported files as such to comply with (L)GPL ¡ø2a.
diego
parents: 13188
diff changeset
6
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 * Mpeg Layer-1,2,3 audio decoder
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 * ------------------------------
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 * copyright (c) 1995,1996,1997 by Michael Hipp, All rights reserved.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 * See also 'README'
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 * slighlty optimized for machines without autoincrement/decrement.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 * The performance is highly compiler dependend. Maybe
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 * the decode.c version for 'normal' processor may be faster
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 * even for Intel processors.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19
16989
e7a129082fda Unify include paths, -I.. is in CFLAGS.
diego
parents: 15167
diff changeset
20 #include "config.h"
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21
1318
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
22 #if 0
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
23 /* old WRITE_SAMPLE */
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
24 /* is portable */
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
25 #define WRITE_SAMPLE(samples,sum,clip) { \
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
26 if( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; } \
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
27 else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; }\
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
28 else { *(samples) = sum; } \
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
29 }
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
30 #else
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 /* new WRITE_SAMPLE */
1318
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
32
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
33 /*
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
34 * should be the same as the "old WRITE_SAMPLE" macro above, but uses
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
35 * some tricks to avoid double->int conversions and floating point compares.
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
36 *
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
37 * Here's how it works:
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
38 * ((((65536.0 * 65536.0 * 16)+(65536.0 * 0.5))* 65536.0)) is
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
39 * 0x0010000080000000LL in hex. It computes 0x0010000080000000LL + sum
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
40 * as a double IEEE fp value and extracts the low-order 32-bits from the
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
41 * IEEE fp representation stored in memory. The 2^56 bit in the constant
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
42 * is intended to force the bits of "sum" into the least significant bits
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
43 * of the double mantissa. After an integer substraction of 0x80000000
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
44 * we have the original double value "sum" converted to an 32-bit int value.
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
45 *
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
46 * (Is that really faster than the clean and simple old version of the macro?)
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
47 */
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
48
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
49 /*
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
50 * On a SPARC cpu, we fetch the low-order 32-bit from the second 32-bit
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
51 * word of the double fp value stored in memory. On an x86 cpu, we fetch it
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
52 * from the first 32-bit word.
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
53 * I'm not sure if the WORDS_BIGENDIAN feature test covers all possible memory
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
54 * layouts of double floating point values an all cpu architectures. If
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
55 * it doesn't work for you, just enable the "old WRITE_SAMPLE" macro.
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
56 */
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
57 #if WORDS_BIGENDIAN
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
58 #define MANTISSA_OFFSET 1
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
59 #else
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
60 #define MANTISSA_OFFSET 0
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
61 #endif
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
62
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 /* sizeof(int) == 4 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 #define WRITE_SAMPLE(samples,sum,clip) { \
7299
131497b1f6ad - GCC 3.x (SPARC) is too clever for the double->int conversion trick used in
jkeil
parents: 4321
diff changeset
65 union { double dtemp; int itemp[2]; } u; int v; \
131497b1f6ad - GCC 3.x (SPARC) is too clever for the double->int conversion trick used in
jkeil
parents: 4321
diff changeset
66 u.dtemp = ((((65536.0 * 65536.0 * 16)+(65536.0 * 0.5))* 65536.0)) + (sum);\
131497b1f6ad - GCC 3.x (SPARC) is too clever for the double->int conversion trick used in
jkeil
parents: 4321
diff changeset
67 v = u.itemp[MANTISSA_OFFSET] - 0x80000000; \
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 if( v > 32767) { *(samples) = 0x7fff; (clip)++; } \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 else if( v < -32768) { *(samples) = -0x8000; (clip)++; } \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 else { *(samples) = v; } \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 }
1318
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
72 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 #define WRITE_SAMPLE(samples,sum,clip) { \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 double dtemp; int v; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 dtemp = ((((65536.0 * 65536.0 * 16)+(65536.0 * 0.5))* 65536.0)) + (sum);\
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 v = ((*(int *)&dtemp) - 0x80000000); \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 if( v > 32767) { *(samples) = 0x7fff; (clip)++; } \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 else if( v < -32768) { *(samples) = -0x8000; (clip)++; } \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 else { *(samples) = v; } \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85
13188
f60bc2314146 small gcc warning fixes
rathann
parents: 12291
diff changeset
86 static int synth_1to1(real *bandPtr,int channel,unsigned char *out,int *pnt);
f60bc2314146 small gcc warning fixes
rathann
parents: 12291
diff changeset
87
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 static int synth_1to1_mono2stereo(real *bandPtr,unsigned char *samples,int *pnt)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 int i,ret;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 ret = synth_1to1(bandPtr,0,samples,pnt);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 samples = samples + *pnt - 128;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 for(i=0;i<32;i++) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 ((short *)samples)[1] = ((short *)samples)[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 samples+=4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 return ret;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102
12134
83822b2b0a17 some more globals
alex
parents: 9002
diff changeset
103 static synth_func_t synth_func;
1245
03b7e2955a20 Added newest MMX-optimized decore which speedups decoding at least on 13% for any cpu.
nick
parents: 787
diff changeset
104
9002
60d144a16088 An altivec-optimized DCT64 for mp3lib
arpi
parents: 8560
diff changeset
105 #ifdef HAVE_ALTIVEC
60d144a16088 An altivec-optimized DCT64 for mp3lib
arpi
parents: 8560
diff changeset
106 #define dct64_base(a,b,c) if(gCpuCaps.hasAltiVec) dct64_altivec(a,b,c); else dct64(a,b,c)
60d144a16088 An altivec-optimized DCT64 for mp3lib
arpi
parents: 8560
diff changeset
107 #else /* HAVE_ALTIVEC */
60d144a16088 An altivec-optimized DCT64 for mp3lib
arpi
parents: 8560
diff changeset
108 #define dct64_base(a,b,c) dct64(a,b,c)
60d144a16088 An altivec-optimized DCT64 for mp3lib
arpi
parents: 8560
diff changeset
109 #endif /* HAVE_ALTIVEC */
60d144a16088 An altivec-optimized DCT64 for mp3lib
arpi
parents: 8560
diff changeset
110
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 static int synth_1to1(real *bandPtr,int channel,unsigned char *out,int *pnt)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 static real buffs[2][2][0x110];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 static const int step = 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115 static int bo = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116 short *samples = (short *) (out + *pnt);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 real *b0,(*buf)[0x110];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 int clip = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 int bo1;
8543
60fe896e437c decode_i586.c version uses %ebp for its own use, so:
arpi
parents: 7299
diff changeset
120
60fe896e437c decode_i586.c version uses %ebp for its own use, so:
arpi
parents: 7299
diff changeset
121 *pnt += 128;
60fe896e437c decode_i586.c version uses %ebp for its own use, so:
arpi
parents: 7299
diff changeset
122
4149
9dde9f96f860 runtime cpudetect suppport
alex
parents: 1942
diff changeset
123 /* optimized for x86 */
23495
059d7c379fb3 Enable SIMD optmizations for mp3lib on AMD64
zuxy
parents: 23356
diff changeset
124 #ifdef ARCH_X86
1245
03b7e2955a20 Added newest MMX-optimized decore which speedups decoding at least on 13% for any cpu.
nick
parents: 787
diff changeset
125 if ( synth_func )
787
9bc104531aec mp3lib sse support - disabled by default
arpi_esp
parents: 736
diff changeset
126 {
8543
60fe896e437c decode_i586.c version uses %ebp for its own use, so:
arpi
parents: 7299
diff changeset
127 // printf("Calling %p, bandPtr=%p channel=%d samples=%p\n",synth_func,bandPtr,channel,samples);
60fe896e437c decode_i586.c version uses %ebp for its own use, so:
arpi
parents: 7299
diff changeset
128 // FIXME: synth_func() may destroy EBP, don't rely on stack contents!!!
60fe896e437c decode_i586.c version uses %ebp for its own use, so:
arpi
parents: 7299
diff changeset
129 return (*synth_func)( bandPtr,channel,samples);
736
59b0a9ec8604 K7 3dnow-dsp support
nickols_k
parents: 732
diff changeset
130 }
1258
50b8a3a5eeed Portability and old binutils support
nick
parents: 1245
diff changeset
131 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 if(!channel) { /* channel=0 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
133 bo--;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
134 bo &= 0xf;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
135 buf = buffs[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 else {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138 samples++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139 buf = buffs[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142 if(bo & 0x1) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 b0 = buf[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 bo1 = bo;
9002
60d144a16088 An altivec-optimized DCT64 for mp3lib
arpi
parents: 8560
diff changeset
145 dct64_base(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 else {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148 b0 = buf[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 bo1 = bo+1;
9002
60d144a16088 An altivec-optimized DCT64 for mp3lib
arpi
parents: 8560
diff changeset
150 dct64_base(buf[0]+bo,buf[1]+bo+1,bandPtr);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
151 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154 register int j;
8560
1320f1b3229d fixing that f*cking linker 'bug' e.g. naming config with libmp3lame
alex
parents: 8543
diff changeset
155 real *window = mp3lib_decwin + 16 - bo1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157 for (j=16;j;j--,b0+=0x10,window+=0x20,samples+=step)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 real sum;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160 sum = window[0x0] * b0[0x0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161 sum -= window[0x1] * b0[0x1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
162 sum += window[0x2] * b0[0x2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163 sum -= window[0x3] * b0[0x3];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164 sum += window[0x4] * b0[0x4];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165 sum -= window[0x5] * b0[0x5];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166 sum += window[0x6] * b0[0x6];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 sum -= window[0x7] * b0[0x7];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168 sum += window[0x8] * b0[0x8];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169 sum -= window[0x9] * b0[0x9];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170 sum += window[0xA] * b0[0xA];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171 sum -= window[0xB] * b0[0xB];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172 sum += window[0xC] * b0[0xC];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 sum -= window[0xD] * b0[0xD];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174 sum += window[0xE] * b0[0xE];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175 sum -= window[0xF] * b0[0xF];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177 WRITE_SAMPLE(samples,sum,clip);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181 real sum;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 sum = window[0x0] * b0[0x0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 sum += window[0x2] * b0[0x2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 sum += window[0x4] * b0[0x4];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185 sum += window[0x6] * b0[0x6];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 sum += window[0x8] * b0[0x8];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 sum += window[0xA] * b0[0xA];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 sum += window[0xC] * b0[0xC];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 sum += window[0xE] * b0[0xE];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 WRITE_SAMPLE(samples,sum,clip);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 b0-=0x10,window-=0x20,samples+=step;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 window += bo1<<1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195 for (j=15;j;j--,b0-=0x10,window-=0x20,samples+=step)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197 real sum;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 sum = -window[-0x1] * b0[0x0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199 sum -= window[-0x2] * b0[0x1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 sum -= window[-0x3] * b0[0x2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 sum -= window[-0x4] * b0[0x3];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 sum -= window[-0x5] * b0[0x4];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203 sum -= window[-0x6] * b0[0x5];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 sum -= window[-0x7] * b0[0x6];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 sum -= window[-0x8] * b0[0x7];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 sum -= window[-0x9] * b0[0x8];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 sum -= window[-0xA] * b0[0x9];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208 sum -= window[-0xB] * b0[0xA];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 sum -= window[-0xC] * b0[0xB];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 sum -= window[-0xD] * b0[0xC];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 sum -= window[-0xE] * b0[0xD];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212 sum -= window[-0xF] * b0[0xE];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 sum -= window[-0x0] * b0[0xF];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 WRITE_SAMPLE(samples,sum,clip);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219 return clip;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222
12291
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
223 #ifdef USE_FAKE_MONO
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
224 static int synth_1to1_l(real *bandPtr,int channel,unsigned char *out,int *pnt)
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
225 {
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
226 int i,ret;
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
227
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
228 ret = synth_1to1(bandPtr,channel,out,pnt);
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
229 out = out + *pnt - 128;
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
230
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
231 for(i=0;i<32;i++) {
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
232 ((short *)out)[1] = ((short *)out)[0];
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
233 out+=4;
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
234 }
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
235
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
236 return ret;
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
237 }
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
238
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
239 static int synth_1to1_r(real *bandPtr,int channel,unsigned char *out,int *pnt)
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
240 {
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
241 int i,ret;
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
242
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
243 ret = synth_1to1(bandPtr,channel,out,pnt);
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
244 out = out + *pnt - 128;
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
245
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
246 for(i=0;i<32;i++) {
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
247 ((short *)out)[0] = ((short *)out)[1];
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
248 out+=4;
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
249 }
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
250
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
251 return ret;
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
252 }
4e6f75467d64 reorder funcs to avoid warnings/errors (gccs are nowadays are more pickier about code than gcc2.95 with -ansi)
alex
parents: 12134
diff changeset
253 #endif