annotate mp3lib/dct12.c @ 12806:2a02e3dc8ba3

fix 10l fixed_quant bug reported by Michael
author iive
date Tue, 13 Jul 2004 18:09:58 +0000
parents 3b5f5d1c5041
children 0f1b5b68af32
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 * new DCT12
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 static void dct12(real *in,real *rawout1,real *rawout2,register real *wi,register real *ts)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 #define DCT12_PART1 \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 in5 = in[5*3]; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 in5 += (in4 = in[4*3]); \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 in4 += (in3 = in[3*3]); \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 in3 += (in2 = in[2*3]); \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 in2 += (in1 = in[1*3]); \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 in1 += (in0 = in[0*3]); \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 in5 += in3; in3 += in1; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 in2 *= COS6_1; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 in3 *= COS6_1; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 #define DCT12_PART2 \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 in0 += in4 * COS6_2; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 in4 = in0 + in2; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 in0 -= in2; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 in1 += in5 * COS6_2; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 in5 = (in1 + in3) * tfcos12[0]; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 in1 = (in1 - in3) * tfcos12[2]; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 in3 = in4 + in5; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 in4 -= in5; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 in2 = in0 + in1; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 in0 -= in1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 real in0,in1,in2,in3,in4,in5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 register real *out1 = rawout1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 ts[SBLIMIT*0] = out1[0]; ts[SBLIMIT*1] = out1[1]; ts[SBLIMIT*2] = out1[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 ts[SBLIMIT*3] = out1[3]; ts[SBLIMIT*4] = out1[4]; ts[SBLIMIT*5] = out1[5];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 DCT12_PART1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46 real tmp0,tmp1 = (in0 - in4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 real tmp2 = (in1 - in5) * tfcos12[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49 tmp0 = tmp1 + tmp2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 tmp1 -= tmp2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 ts[(17-1)*SBLIMIT] = out1[17-1] + tmp0 * wi[11-1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 ts[(12+1)*SBLIMIT] = out1[12+1] + tmp0 * wi[6+1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 ts[(6 +1)*SBLIMIT] = out1[6 +1] + tmp1 * wi[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 ts[(11-1)*SBLIMIT] = out1[11-1] + tmp1 * wi[5-1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 DCT12_PART2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 ts[(17-0)*SBLIMIT] = out1[17-0] + in2 * wi[11-0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 ts[(12+0)*SBLIMIT] = out1[12+0] + in2 * wi[6+0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 ts[(12+2)*SBLIMIT] = out1[12+2] + in3 * wi[6+2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 ts[(17-2)*SBLIMIT] = out1[17-2] + in3 * wi[11-2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 ts[(6+0)*SBLIMIT] = out1[6+0] + in0 * wi[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 ts[(11-0)*SBLIMIT] = out1[11-0] + in0 * wi[5-0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 ts[(6+2)*SBLIMIT] = out1[6+2] + in4 * wi[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 ts[(11-2)*SBLIMIT] = out1[11-2] + in4 * wi[5-2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 in++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 real in0,in1,in2,in3,in4,in5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 register real *out2 = rawout2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 DCT12_PART1
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 real tmp0,tmp1 = (in0 - in4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 real tmp2 = (in1 - in5) * tfcos12[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 tmp0 = tmp1 + tmp2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 tmp1 -= tmp2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 out2[5-1] = tmp0 * wi[11-1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 out2[0+1] = tmp0 * wi[6+1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 ts[(12+1)*SBLIMIT] += tmp1 * wi[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 ts[(17-1)*SBLIMIT] += tmp1 * wi[5-1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 DCT12_PART2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 out2[5-0] = in2 * wi[11-0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 out2[0+0] = in2 * wi[6+0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 out2[0+2] = in3 * wi[6+2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 out2[5-2] = in3 * wi[11-2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 ts[(12+0)*SBLIMIT] += in0 * wi[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 ts[(17-0)*SBLIMIT] += in0 * wi[5-0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101 ts[(12+2)*SBLIMIT] += in4 * wi[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 ts[(17-2)*SBLIMIT] += in4 * wi[5-2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 in++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 real in0,in1,in2,in3,in4,in5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 register real *out2 = rawout2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 out2[12]=out2[13]=out2[14]=out2[15]=out2[16]=out2[17]=0.0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 DCT12_PART1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115 real tmp0,tmp1 = (in0 - in4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 real tmp2 = (in1 - in5) * tfcos12[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 tmp0 = tmp1 + tmp2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 tmp1 -= tmp2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121 out2[11-1] = tmp0 * wi[11-1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 out2[6 +1] = tmp0 * wi[6+1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 out2[0+1] += tmp1 * wi[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
124 out2[5-1] += tmp1 * wi[5-1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 DCT12_PART2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129 out2[11-0] = in2 * wi[11-0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
130 out2[6 +0] = in2 * wi[6+0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 out2[6 +2] = in3 * wi[6+2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 out2[11-2] = in3 * wi[11-2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
133
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
134 out2[0+0] += in0 * wi[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
135 out2[5-0] += in0 * wi[5-0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136 out2[0+2] += in4 * wi[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 out2[5-2] += in4 * wi[5-2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139 }