annotate Plugins/Input/mpg123/dct64.c @ 1117:38ff0b6b019b trunk

[svn] - fix an oops
author nenolod
date Tue, 30 May 2006 22:34:42 -0700
parents b5ae09a6c2f1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
2 /*
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
3 * Discrete Cosine Tansform (DCT) for subband synthesis
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
4 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
5 * -funroll-loops (for gcc) will remove the loops for better performance
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
6 * using loops in the source-code enhances readabillity
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
7 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
8
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
9 /*
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
10 * TODO: write an optimized version for the down-sampling modes
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
11 * (in these modes the bands 16-31 (2:1) or 8-31 (4:1) are zero
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
12 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
13
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
14 #include "mpg123.h"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
15
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
16 void
1098
b5ae09a6c2f1 [svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents: 970
diff changeset
17 mpgdec_dct64(mpgdec_real * out0, mpgdec_real * out1, mpgdec_real * samples)
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
18 {
970
0f294f2b0a9b [svn] - integer-mode decoding accuracy improvements
nenolod
parents: 61
diff changeset
19 mpgdec_real bufs[64];
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
20
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
21 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
22 register int i, j;
970
0f294f2b0a9b [svn] - integer-mode decoding accuracy improvements
nenolod
parents: 61
diff changeset
23 register mpgdec_real *b1, *b2, *bs, *costab;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
24
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
25 b1 = samples;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
26 bs = bufs;
1098
b5ae09a6c2f1 [svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents: 970
diff changeset
27 costab = mpgdec_pnts[0] + 16;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
28 b2 = b1 + 32;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
29
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
30 for (i = 15; i >= 0; i--)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
31 *bs++ = (*b1++ + *--b2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
32 for (i = 15; i >= 0; i--)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
33 *bs++ = (*--b2 - *b1++) * *--costab;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
34
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
35 b1 = bufs;
1098
b5ae09a6c2f1 [svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents: 970
diff changeset
36 costab = mpgdec_pnts[1] + 8;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
37 b2 = b1 + 16;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
38
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
39 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
40 for (i = 7; i >= 0; i--)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
41 *bs++ = (*b1++ + *--b2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
42 for (i = 7; i >= 0; i--)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
43 *bs++ = (*--b2 - *b1++) * *--costab;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
44 b2 += 32;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
45 costab += 8;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
46 for (i = 7; i >= 0; i--)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
47 *bs++ = (*b1++ + *--b2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
48 for (i = 7; i >= 0; i--)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
49 *bs++ = (*b1++ - *--b2) * *--costab;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
50 b2 += 32;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
51 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
52
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
53 bs = bufs;
1098
b5ae09a6c2f1 [svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents: 970
diff changeset
54 costab = mpgdec_pnts[2];
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
55 b2 = b1 + 8;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
56
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
57 for (j = 2; j; j--) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
58 for (i = 3; i >= 0; i--)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
59 *bs++ = (*b1++ + *--b2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
60 for (i = 3; i >= 0; i--)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
61 *bs++ = (*--b2 - *b1++) * costab[i];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
62 b2 += 16;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
63 for (i = 3; i >= 0; i--)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
64 *bs++ = (*b1++ + *--b2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
65 for (i = 3; i >= 0; i--)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
66 *bs++ = (*b1++ - *--b2) * costab[i];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
67 b2 += 16;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
68 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
69
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
70 b1 = bufs;
1098
b5ae09a6c2f1 [svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents: 970
diff changeset
71 costab = mpgdec_pnts[3];
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
72 b2 = b1 + 4;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
73
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
74 for (j = 4; j; j--) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
75 *bs++ = (*b1++ + *--b2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
76 *bs++ = (*b1++ + *--b2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
77 *bs++ = (*--b2 - *b1++) * costab[1];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
78 *bs++ = (*--b2 - *b1++) * costab[0];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
79 b2 += 8;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
80 *bs++ = (*b1++ + *--b2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
81 *bs++ = (*b1++ + *--b2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
82 *bs++ = (*b1++ - *--b2) * costab[1];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
83 *bs++ = (*b1++ - *--b2) * costab[0];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
84 b2 += 8;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
85 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
86 bs = bufs;
1098
b5ae09a6c2f1 [svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents: 970
diff changeset
87 costab = mpgdec_pnts[4];
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
88
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
89 for (j = 8; j; j--) {
970
0f294f2b0a9b [svn] - integer-mode decoding accuracy improvements
nenolod
parents: 61
diff changeset
90 mpgdec_real v0, v1;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
91
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
92 v0 = *b1++;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
93 v1 = *b1++;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
94 *bs++ = (v0 + v1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
95 *bs++ = (v0 - v1) * (*costab);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
96 v0 = *b1++;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
97 v1 = *b1++;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
98 *bs++ = (v0 + v1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
99 *bs++ = (v1 - v0) * (*costab);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
100 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
101
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
102 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
103
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
104 {
970
0f294f2b0a9b [svn] - integer-mode decoding accuracy improvements
nenolod
parents: 61
diff changeset
105 register mpgdec_real *b1;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
106 register int i;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
107
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
108 for (b1 = bufs, i = 8; i; i--, b1 += 4)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
109 b1[2] += b1[3];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
110
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
111 for (b1 = bufs, i = 4; i; i--, b1 += 8) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
112 b1[4] += b1[6];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
113 b1[6] += b1[5];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
114 b1[5] += b1[7];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
115 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
116
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
117 for (b1 = bufs, i = 2; i; i--, b1 += 16) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
118 b1[8] += b1[12];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
119 b1[12] += b1[10];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
120 b1[10] += b1[14];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
121 b1[14] += b1[9];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
122 b1[9] += b1[13];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
123 b1[13] += b1[11];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
124 b1[11] += b1[15];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
125 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
126 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
127
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
128 out0[0x10 * 16] = bufs[0];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
129 out0[0x10 * 15] = bufs[16 + 0] + bufs[16 + 8];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
130 out0[0x10 * 14] = bufs[8];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
131 out0[0x10 * 13] = bufs[16 + 8] + bufs[16 + 4];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
132 out0[0x10 * 12] = bufs[4];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
133 out0[0x10 * 11] = bufs[16 + 4] + bufs[16 + 12];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
134 out0[0x10 * 10] = bufs[12];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
135 out0[0x10 * 9] = bufs[16 + 12] + bufs[16 + 2];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
136 out0[0x10 * 8] = bufs[2];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
137 out0[0x10 * 7] = bufs[16 + 2] + bufs[16 + 10];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
138 out0[0x10 * 6] = bufs[10];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
139 out0[0x10 * 5] = bufs[16 + 10] + bufs[16 + 6];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
140 out0[0x10 * 4] = bufs[6];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
141 out0[0x10 * 3] = bufs[16 + 6] + bufs[16 + 14];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
142 out0[0x10 * 2] = bufs[14];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
143 out0[0x10 * 1] = bufs[16 + 14] + bufs[16 + 1];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
144 out0[0x10 * 0] = bufs[1];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
145
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
146 out1[0x10 * 0] = bufs[1];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
147 out1[0x10 * 1] = bufs[16 + 1] + bufs[16 + 9];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
148 out1[0x10 * 2] = bufs[9];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
149 out1[0x10 * 3] = bufs[16 + 9] + bufs[16 + 5];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
150 out1[0x10 * 4] = bufs[5];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
151 out1[0x10 * 5] = bufs[16 + 5] + bufs[16 + 13];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
152 out1[0x10 * 6] = bufs[13];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
153 out1[0x10 * 7] = bufs[16 + 13] + bufs[16 + 3];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
154 out1[0x10 * 8] = bufs[3];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
155 out1[0x10 * 9] = bufs[16 + 3] + bufs[16 + 11];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
156 out1[0x10 * 10] = bufs[11];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
157 out1[0x10 * 11] = bufs[16 + 11] + bufs[16 + 7];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
158 out1[0x10 * 12] = bufs[7];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
159 out1[0x10 * 13] = bufs[16 + 7] + bufs[16 + 15];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
160 out1[0x10 * 14] = bufs[15];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
161 out1[0x10 * 15] = bufs[16 + 15];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
162
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
163 }