Convert m_config.c to use talloc
[mplayer.git] / mp3lib / dct12.c
blob61f2b299002f7fd2a68cbacad2b4e79bb23c1401
1 /*
2 * new DCT12
3 */
4 static void dct12(real *in,real *rawout1,real *rawout2,register real *wi,register real *ts)
6 #define DCT12_PART1 \
7 in5 = in[5*3]; \
8 in5 += (in4 = in[4*3]); \
9 in4 += (in3 = in[3*3]); \
10 in3 += (in2 = in[2*3]); \
11 in2 += (in1 = in[1*3]); \
12 in1 += (in0 = in[0*3]); \
14 in5 += in3; in3 += in1; \
16 in2 *= COS6_1; \
17 in3 *= COS6_1; \
19 #define DCT12_PART2 \
20 in0 += in4 * COS6_2; \
22 in4 = in0 + in2; \
23 in0 -= in2; \
25 in1 += in5 * COS6_2; \
27 in5 = (in1 + in3) * tfcos12[0]; \
28 in1 = (in1 - in3) * tfcos12[2]; \
30 in3 = in4 + in5; \
31 in4 -= in5; \
33 in2 = in0 + in1; \
34 in0 -= in1;
38 real in0,in1,in2,in3,in4,in5;
39 register real *out1 = rawout1;
40 ts[SBLIMIT*0] = out1[0]; ts[SBLIMIT*1] = out1[1]; ts[SBLIMIT*2] = out1[2];
41 ts[SBLIMIT*3] = out1[3]; ts[SBLIMIT*4] = out1[4]; ts[SBLIMIT*5] = out1[5];
43 DCT12_PART1
46 real tmp0,tmp1 = (in0 - in4);
48 real tmp2 = (in1 - in5) * tfcos12[1];
49 tmp0 = tmp1 + tmp2;
50 tmp1 -= tmp2;
52 ts[(17-1)*SBLIMIT] = out1[17-1] + tmp0 * wi[11-1];
53 ts[(12+1)*SBLIMIT] = out1[12+1] + tmp0 * wi[6+1];
54 ts[(6 +1)*SBLIMIT] = out1[6 +1] + tmp1 * wi[1];
55 ts[(11-1)*SBLIMIT] = out1[11-1] + tmp1 * wi[5-1];
58 DCT12_PART2
60 ts[(17-0)*SBLIMIT] = out1[17-0] + in2 * wi[11-0];
61 ts[(12+0)*SBLIMIT] = out1[12+0] + in2 * wi[6+0];
62 ts[(12+2)*SBLIMIT] = out1[12+2] + in3 * wi[6+2];
63 ts[(17-2)*SBLIMIT] = out1[17-2] + in3 * wi[11-2];
65 ts[(6+0)*SBLIMIT] = out1[6+0] + in0 * wi[0];
66 ts[(11-0)*SBLIMIT] = out1[11-0] + in0 * wi[5-0];
67 ts[(6+2)*SBLIMIT] = out1[6+2] + in4 * wi[2];
68 ts[(11-2)*SBLIMIT] = out1[11-2] + in4 * wi[5-2];
71 in++;
74 real in0,in1,in2,in3,in4,in5;
75 register real *out2 = rawout2;
77 DCT12_PART1
80 real tmp0,tmp1 = (in0 - in4);
82 real tmp2 = (in1 - in5) * tfcos12[1];
83 tmp0 = tmp1 + tmp2;
84 tmp1 -= tmp2;
86 out2[5-1] = tmp0 * wi[11-1];
87 out2[0+1] = tmp0 * wi[6+1];
88 ts[(12+1)*SBLIMIT] += tmp1 * wi[1];
89 ts[(17-1)*SBLIMIT] += tmp1 * wi[5-1];
92 DCT12_PART2
94 out2[5-0] = in2 * wi[11-0];
95 out2[0+0] = in2 * wi[6+0];
96 out2[0+2] = in3 * wi[6+2];
97 out2[5-2] = in3 * wi[11-2];
99 ts[(12+0)*SBLIMIT] += in0 * wi[0];
100 ts[(17-0)*SBLIMIT] += in0 * wi[5-0];
101 ts[(12+2)*SBLIMIT] += in4 * wi[2];
102 ts[(17-2)*SBLIMIT] += in4 * wi[5-2];
105 in++;
108 real in0,in1,in2,in3,in4,in5;
109 register real *out2 = rawout2;
110 out2[12]=out2[13]=out2[14]=out2[15]=out2[16]=out2[17]=0.0;
112 DCT12_PART1
115 real tmp0,tmp1 = (in0 - in4);
117 real tmp2 = (in1 - in5) * tfcos12[1];
118 tmp0 = tmp1 + tmp2;
119 tmp1 -= tmp2;
121 out2[11-1] = tmp0 * wi[11-1];
122 out2[6 +1] = tmp0 * wi[6+1];
123 out2[0+1] += tmp1 * wi[1];
124 out2[5-1] += tmp1 * wi[5-1];
127 DCT12_PART2
129 out2[11-0] = in2 * wi[11-0];
130 out2[6 +0] = in2 * wi[6+0];
131 out2[6 +2] = in3 * wi[6+2];
132 out2[11-2] = in3 * wi[11-2];
134 out2[0+0] += in0 * wi[0];
135 out2[5-0] += in0 * wi[5-0];
136 out2[0+2] += in4 * wi[2];
137 out2[5-2] += in4 * wi[5-2];