annotate mp3lib/decod386.c @ 1941:2668fc1b8839

Fix for mp3 decoding on alpha/64bit platforms wupposed by Bob McElrath.
author atmos4
date Sun, 23 Sep 2001 01:44:37 +0000
parents 2052e18abd9d
children 853be3ebe862
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 * Mpeg Layer-1,2,3 audio decoder
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 * ------------------------------
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 * copyright (c) 1995,1996,1997 by Michael Hipp, All rights reserved.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 * See also 'README'
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 * slighlty optimized for machines without autoincrement/decrement.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 * The performance is highly compiler dependend. Maybe
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 * the decode.c version for 'normal' processor may be faster
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 * even for Intel processors.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13
1318
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
14 #include "../config.h"
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15
1318
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
16 #if 0
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
17 /* old WRITE_SAMPLE */
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
18 /* is portable */
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
19 #define WRITE_SAMPLE(samples,sum,clip) { \
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
20 if( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; } \
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
21 else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; }\
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
22 else { *(samples) = sum; } \
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
23 }
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
24 #else
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 /* new WRITE_SAMPLE */
1318
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
26
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
27 /*
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
28 * 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
29 * 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
30 *
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
31 * Here's how it works:
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
32 * ((((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
33 * 0x0010000080000000LL in hex. It computes 0x0010000080000000LL + sum
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
34 * 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
35 * 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
36 * 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
37 * 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
38 * 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
39 *
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
40 * (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
41 */
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
42
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
43 /*
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
44 * 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
45 * 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
46 * from the first 32-bit word.
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
47 * 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
48 * 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
49 * 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
50 */
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
51 #if WORDS_BIGENDIAN
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
52 #define MANTISSA_OFFSET 1
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
53 #else
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
54 #define MANTISSA_OFFSET 0
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
55 #endif
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
56
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 /* sizeof(int) == 4 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 #define WRITE_SAMPLE(samples,sum,clip) { \
1941
2668fc1b8839 Fix for mp3 decoding on alpha/64bit platforms wupposed by Bob McElrath.
atmos4
parents: 1318
diff changeset
59 double dtemp; int v; \
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 dtemp = ((((65536.0 * 65536.0 * 16)+(65536.0 * 0.5))* 65536.0)) + (sum);\
1318
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
61 v = (((int *)&dtemp)[MANTISSA_OFFSET] - 0x80000000); \
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 if( v > 32767) { *(samples) = 0x7fff; (clip)++; } \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 else if( v < -32768) { *(samples) = -0x8000; (clip)++; } \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 else { *(samples) = v; } \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 }
1318
2052e18abd9d mp3 audio decoding didn't work on big-endian architectures
jkeil
parents: 1258
diff changeset
66 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 #define WRITE_SAMPLE(samples,sum,clip) { \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 double dtemp; int v; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 dtemp = ((((65536.0 * 65536.0 * 16)+(65536.0 * 0.5))* 65536.0)) + (sum);\
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 v = ((*(int *)&dtemp) - 0x80000000); \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 if( v > 32767) { *(samples) = 0x7fff; (clip)++; } \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 else if( v < -32768) { *(samples) = -0x8000; (clip)++; } \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 else { *(samples) = v; } \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 static int synth_1to1_mono(real *bandPtr,unsigned char *samples,int *pnt)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 short samples_tmp[64];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 short *tmp1 = samples_tmp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 int i,ret;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 int pnt1 = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 ret = synth_1to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 samples += *pnt;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 for(i=0;i<32;i++) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 *( (short *) samples) = *tmp1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 samples += 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 tmp1 += 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 *pnt += 64;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 return ret;
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
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101 static int synth_1to1_mono2stereo(real *bandPtr,unsigned char *samples,int *pnt)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 int i,ret;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 ret = synth_1to1(bandPtr,0,samples,pnt);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106 samples = samples + *pnt - 128;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 for(i=0;i<32;i++) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 ((short *)samples)[1] = ((short *)samples)[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 samples+=4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 return ret;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116
732
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
117 #ifdef USE_FAKE_MONO
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
118 static int synth_1to1_l(real *bandPtr,int channel,unsigned char *out,int *pnt)
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
119 {
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
120 int i,ret;
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
121
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
122 ret = synth_1to1(bandPtr,channel,out,pnt);
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
123 out = out + *pnt - 128;
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
124
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
125 for(i=0;i<32;i++) {
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
126 ((short *)out)[1] = ((short *)out)[0];
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
127 out+=4;
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
128 }
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
129
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
130 return ret;
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
131 }
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
132
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
133
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
134 static int synth_1to1_r(real *bandPtr,int channel,unsigned char *out,int *pnt)
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
135 {
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
136 int i,ret;
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
137
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
138 ret = synth_1to1(bandPtr,channel,out,pnt);
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
139 out = out + *pnt - 128;
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
140
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
141 for(i=0;i<32;i++) {
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
142 ((short *)out)[0] = ((short *)out)[1];
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
143 out+=4;
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
144 }
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
145
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
146 return ret;
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
147 }
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
148 #endif
e14114170e01 applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents: 1
diff changeset
149
1245
03b7e2955a20 Added newest MMX-optimized decore which speedups decoding at least on 13% for any cpu.
nick
parents: 787
diff changeset
150 synth_func_t synth_func;
03b7e2955a20 Added newest MMX-optimized decore which speedups decoding at least on 13% for any cpu.
nick
parents: 787
diff changeset
151
1258
50b8a3a5eeed Portability and old binutils support
nick
parents: 1245
diff changeset
152 #ifdef HAVE_MMX
1941
2668fc1b8839 Fix for mp3 decoding on alpha/64bit platforms wupposed by Bob McElrath.
atmos4
parents: 1318
diff changeset
153 int synth_1to1_MMX( real *bandPtr ,int channel,short * samples)
1245
03b7e2955a20 Added newest MMX-optimized decore which speedups decoding at least on 13% for any cpu.
nick
parents: 787
diff changeset
154 {
1941
2668fc1b8839 Fix for mp3 decoding on alpha/64bit platforms wupposed by Bob McElrath.
atmos4
parents: 1318
diff changeset
155 real *mybandPtr __attribute__((aligned(16))) = bandPtr;
2668fc1b8839 Fix for mp3 decoding on alpha/64bit platforms wupposed by Bob McElrath.
atmos4
parents: 1318
diff changeset
156 short *mysamples __attribute__((aligned(16))) = samples;
2668fc1b8839 Fix for mp3 decoding on alpha/64bit platforms wupposed by Bob McElrath.
atmos4
parents: 1318
diff changeset
157 static short buffs[2][2][0x110] __attribute__((aligned(16)));
2668fc1b8839 Fix for mp3 decoding on alpha/64bit platforms wupposed by Bob McElrath.
atmos4
parents: 1318
diff changeset
158 static int bo __attribute__((aligned(16))) = 1;
2668fc1b8839 Fix for mp3 decoding on alpha/64bit platforms wupposed by Bob McElrath.
atmos4
parents: 1318
diff changeset
159 synth_1to1_MMX_s(mybandPtr, channel, mysamples, (short *) buffs, &bo);
1245
03b7e2955a20 Added newest MMX-optimized decore which speedups decoding at least on 13% for any cpu.
nick
parents: 787
diff changeset
160 return 0;
1258
50b8a3a5eeed Portability and old binutils support
nick
parents: 1245
diff changeset
161 }
50b8a3a5eeed Portability and old binutils support
nick
parents: 1245
diff changeset
162 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163 static int synth_1to1(real *bandPtr,int channel,unsigned char *out,int *pnt)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165 static real buffs[2][2][0x110];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166 static const int step = 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 static int bo = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168 short *samples = (short *) (out + *pnt);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170 real *b0,(*buf)[0x110];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171 int clip = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172 int bo1;
1258
50b8a3a5eeed Portability and old binutils support
nick
parents: 1245
diff changeset
173 #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
174 if ( synth_func )
787
9bc104531aec mp3lib sse support - disabled by default
arpi_esp
parents: 736
diff changeset
175 {
9bc104531aec mp3lib sse support - disabled by default
arpi_esp
parents: 736
diff changeset
176 int ret;
1245
03b7e2955a20 Added newest MMX-optimized decore which speedups decoding at least on 13% for any cpu.
nick
parents: 787
diff changeset
177 ret=(*synth_func)( bandPtr,channel,samples);
736
59b0a9ec8604 K7 3dnow-dsp support
nickols_k
parents: 732
diff changeset
178 *pnt+=128;
59b0a9ec8604 K7 3dnow-dsp support
nickols_k
parents: 732
diff changeset
179 return ret;
59b0a9ec8604 K7 3dnow-dsp support
nickols_k
parents: 732
diff changeset
180 }
1258
50b8a3a5eeed Portability and old binutils support
nick
parents: 1245
diff changeset
181 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 if(!channel) { /* channel=0 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 bo--;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 bo &= 0xf;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185 buf = buffs[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 else {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 samples++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 buf = buffs[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 if(bo & 0x1) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 b0 = buf[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194 bo1 = bo;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195 dct64(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197 else {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 b0 = buf[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199 bo1 = bo+1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 dct64(buf[0]+bo,buf[1]+bo+1,bandPtr);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 register int j;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 real *window = decwin + 16 - bo1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 for (j=16;j;j--,b0+=0x10,window+=0x20,samples+=step)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 real sum;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 sum = window[0x0] * b0[0x0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 sum -= window[0x1] * b0[0x1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212 sum += window[0x2] * b0[0x2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 sum -= window[0x3] * b0[0x3];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 sum += window[0x4] * b0[0x4];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 sum -= window[0x5] * b0[0x5];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 sum += window[0x6] * b0[0x6];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217 sum -= window[0x7] * b0[0x7];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218 sum += window[0x8] * b0[0x8];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219 sum -= window[0x9] * b0[0x9];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220 sum += window[0xA] * b0[0xA];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 sum -= window[0xB] * b0[0xB];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 sum += window[0xC] * b0[0xC];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223 sum -= window[0xD] * b0[0xD];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224 sum += window[0xE] * b0[0xE];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225 sum -= window[0xF] * b0[0xF];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227 WRITE_SAMPLE(samples,sum,clip);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
228 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
231 real sum;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232 sum = window[0x0] * b0[0x0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233 sum += window[0x2] * b0[0x2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234 sum += window[0x4] * b0[0x4];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235 sum += window[0x6] * b0[0x6];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236 sum += window[0x8] * b0[0x8];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 sum += window[0xA] * b0[0xA];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238 sum += window[0xC] * b0[0xC];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239 sum += window[0xE] * b0[0xE];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240 WRITE_SAMPLE(samples,sum,clip);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 b0-=0x10,window-=0x20,samples+=step;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
242 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243 window += bo1<<1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
245 for (j=15;j;j--,b0-=0x10,window-=0x20,samples+=step)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
246 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
247 real sum;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
248 sum = -window[-0x1] * b0[0x0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
249 sum -= window[-0x2] * b0[0x1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
250 sum -= window[-0x3] * b0[0x2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
251 sum -= window[-0x4] * b0[0x3];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252 sum -= window[-0x5] * b0[0x4];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
253 sum -= window[-0x6] * b0[0x5];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
254 sum -= window[-0x7] * b0[0x6];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
255 sum -= window[-0x8] * b0[0x7];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
256 sum -= window[-0x9] * b0[0x8];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
257 sum -= window[-0xA] * b0[0x9];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
258 sum -= window[-0xB] * b0[0xA];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
259 sum -= window[-0xC] * b0[0xB];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
260 sum -= window[-0xD] * b0[0xC];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
261 sum -= window[-0xE] * b0[0xD];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262 sum -= window[-0xF] * b0[0xE];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263 sum -= window[-0x0] * b0[0xF];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
265 WRITE_SAMPLE(samples,sum,clip);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
268 *pnt += 128;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
269
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
270 return clip;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
271
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
272 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
273