61 int nbits, i,
n, num_transforms,
offset, step;
63 FFTSample tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8;
66 float *w_re_ptr, *w_im_ptr;
67 const int fft_size = (1 << s->
nbits);
70 float pom, pom1, pom2, pom3;
71 float temp, temp1, temp3, temp4;
73 FFTComplex * tmpz_n2_i, * tmpz_n34_i, * tmpz_n4_i, * tmpz_i;
80 "sub %[s_n], %[tem1], %[s_n] \n\t"
81 "li %[tem2], 10923 \n\t"
82 "srav %[tem2], %[tem2], %[s_n] \n\t"
83 "ori %[num_t],%[tem2], 1 \n\t"
84 : [num_t]
"=r"(num_transforms), [s_n]
"+r"(s_n),
85 [tem1]
"=&r"(tem1), [tem2]
"=&r"(tem2)
89 for (n=0; n<num_transforms; n++) {
93 tmp1 = tmpz[0].
re + tmpz[1].
re;
94 tmp5 = tmpz[2].
re + tmpz[3].
re;
95 tmp2 = tmpz[0].
im + tmpz[1].
im;
96 tmp6 = tmpz[2].
im + tmpz[3].
im;
97 tmp3 = tmpz[0].
re - tmpz[1].
re;
98 tmp8 = tmpz[2].
im - tmpz[3].
im;
99 tmp4 = tmpz[0].
im - tmpz[1].
im;
100 tmp7 = tmpz[2].
re - tmpz[3].
re;
102 tmpz[0].
re = tmp1 + tmp5;
103 tmpz[2].
re = tmp1 - tmp5;
104 tmpz[0].
im = tmp2 + tmp6;
105 tmpz[2].
im = tmp2 - tmp6;
106 tmpz[1].
re = tmp3 + tmp8;
107 tmpz[3].
re = tmp3 - tmp8;
108 tmpz[1].
im = tmp4 - tmp7;
109 tmpz[3].
im = tmp4 + tmp7;
116 num_transforms = (num_transforms >> 1) | 1;
118 for (n=0; n<num_transforms; n++) {
123 "lwc1 %[tmp1], 32(%[tmpz]) \n\t"
124 "lwc1 %[pom], 40(%[tmpz]) \n\t"
125 "lwc1 %[tmp3], 48(%[tmpz]) \n\t"
126 "lwc1 %[pom1], 56(%[tmpz]) \n\t"
127 "lwc1 %[tmp2], 36(%[tmpz]) \n\t"
128 "lwc1 %[pom2], 44(%[tmpz]) \n\t"
129 "lwc1 %[pom3], 60(%[tmpz]) \n\t"
130 "lwc1 %[tmp4], 52(%[tmpz]) \n\t"
131 "add.s %[tmp1], %[tmp1], %[pom] \n\t"
132 "add.s %[tmp3], %[tmp3], %[pom1] \n\t"
133 "add.s %[tmp2], %[tmp2], %[pom2] \n\t"
134 "lwc1 %[pom], 40(%[tmpz]) \n\t"
135 "add.s %[tmp4], %[tmp4], %[pom3] \n\t"
136 "add.s %[tmp5], %[tmp1], %[tmp3] \n\t"
137 "sub.s %[tmp7], %[tmp1], %[tmp3] \n\t"
138 "lwc1 %[tmp1], 32(%[tmpz]) \n\t"
139 "lwc1 %[pom1], 44(%[tmpz]) \n\t"
140 "add.s %[tmp6], %[tmp2], %[tmp4] \n\t"
141 "sub.s %[tmp8], %[tmp2], %[tmp4] \n\t"
142 "lwc1 %[tmp2], 36(%[tmpz]) \n\t"
143 "lwc1 %[pom2], 56(%[tmpz]) \n\t"
144 "lwc1 %[pom3], 60(%[tmpz]) \n\t"
145 "lwc1 %[tmp3], 48(%[tmpz]) \n\t"
146 "lwc1 %[tmp4], 52(%[tmpz]) \n\t"
147 "sub.s %[tmp1], %[tmp1], %[pom] \n\t"
148 "lwc1 %[pom], 0(%[tmpz]) \n\t"
149 "sub.s %[tmp2], %[tmp2], %[pom1] \n\t"
150 "sub.s %[tmp3], %[tmp3], %[pom2] \n\t"
151 "lwc1 %[pom2], 4(%[tmpz]) \n\t"
152 "sub.s %[pom1], %[pom], %[tmp5] \n\t"
153 "sub.s %[tmp4], %[tmp4], %[pom3] \n\t"
154 "add.s %[pom3], %[pom], %[tmp5] \n\t"
155 "sub.s %[pom], %[pom2], %[tmp6] \n\t"
156 "add.s %[pom2], %[pom2], %[tmp6] \n\t"
157 "swc1 %[pom1], 32(%[tmpz]) \n\t"
158 "swc1 %[pom3], 0(%[tmpz]) \n\t"
159 "swc1 %[pom], 36(%[tmpz]) \n\t"
160 "swc1 %[pom2], 4(%[tmpz]) \n\t"
161 "lwc1 %[pom1], 16(%[tmpz]) \n\t"
162 "lwc1 %[pom3], 20(%[tmpz]) \n\t"
163 "li.s %[pom], 0.7071067812 \n\t"
164 "add.s %[temp1],%[tmp1], %[tmp2] \n\t"
165 "sub.s %[temp], %[pom1], %[tmp8] \n\t"
166 "add.s %[pom2], %[pom3], %[tmp7] \n\t"
167 "sub.s %[temp3],%[tmp3], %[tmp4] \n\t"
168 "sub.s %[temp4],%[tmp2], %[tmp1] \n\t"
169 "swc1 %[temp], 48(%[tmpz]) \n\t"
170 "swc1 %[pom2], 52(%[tmpz]) \n\t"
171 "add.s %[pom1], %[pom1], %[tmp8] \n\t"
172 "sub.s %[pom3], %[pom3], %[tmp7] \n\t"
173 "add.s %[tmp3], %[tmp3], %[tmp4] \n\t"
174 "mul.s %[tmp5], %[pom], %[temp1] \n\t"
175 "mul.s %[tmp7], %[pom], %[temp3] \n\t"
176 "mul.s %[tmp6], %[pom], %[temp4] \n\t"
177 "mul.s %[tmp8], %[pom], %[tmp3] \n\t"
178 "swc1 %[pom1], 16(%[tmpz]) \n\t"
179 "swc1 %[pom3], 20(%[tmpz]) \n\t"
180 "add.s %[tmp1], %[tmp5], %[tmp7] \n\t"
181 "sub.s %[tmp3], %[tmp5], %[tmp7] \n\t"
182 "add.s %[tmp2], %[tmp6], %[tmp8] \n\t"
183 "sub.s %[tmp4], %[tmp6], %[tmp8] \n\t"
184 "lwc1 %[temp], 8(%[tmpz]) \n\t"
185 "lwc1 %[temp1],12(%[tmpz]) \n\t"
186 "lwc1 %[pom], 24(%[tmpz]) \n\t"
187 "lwc1 %[pom2], 28(%[tmpz]) \n\t"
188 "sub.s %[temp4],%[temp], %[tmp1] \n\t"
189 "sub.s %[temp3],%[temp1], %[tmp2] \n\t"
190 "add.s %[temp], %[temp], %[tmp1] \n\t"
191 "add.s %[temp1],%[temp1], %[tmp2] \n\t"
192 "sub.s %[pom1], %[pom], %[tmp4] \n\t"
193 "add.s %[pom3], %[pom2], %[tmp3] \n\t"
194 "add.s %[pom], %[pom], %[tmp4] \n\t"
195 "sub.s %[pom2], %[pom2], %[tmp3] \n\t"
196 "swc1 %[temp4],40(%[tmpz]) \n\t"
197 "swc1 %[temp3],44(%[tmpz]) \n\t"
198 "swc1 %[temp], 8(%[tmpz]) \n\t"
199 "swc1 %[temp1],12(%[tmpz]) \n\t"
200 "swc1 %[pom1], 56(%[tmpz]) \n\t"
201 "swc1 %[pom3], 60(%[tmpz]) \n\t"
202 "swc1 %[pom], 24(%[tmpz]) \n\t"
203 "swc1 %[pom2], 28(%[tmpz]) \n\t"
204 : [tmp1]
"=&f"(tmp1), [pom]
"=&f"(pom), [pom1]
"=&f"(pom1), [pom2]
"=&f"(pom2),
205 [tmp3]
"=&f"(tmp3), [tmp2]
"=&f"(tmp2), [tmp4]
"=&f"(tmp4), [tmp5]
"=&f"(tmp5), [tmp7]
"=&f"(tmp7),
206 [tmp6]
"=&f"(tmp6), [tmp8]
"=&f"(tmp8), [pom3]
"=&f"(pom3),[
temp]
"=&f"(
temp), [temp1]
"=&f"(temp1),
207 [temp3]
"=&f"(temp3), [temp4]
"=&f"(temp4)
216 for (nbits=4; nbits<=s->
nbits; nbits++) {
221 "sra %[num_t], %[num_t], 1 \n\t"
222 "ori %[num_t], %[num_t], 1 \n\t"
224 : [num_t]
"+r" (num_transforms)
229 for (n=0; n<num_transforms; n++) {
235 tmpz_n34 = tmpz + n34;
238 "lwc1 %[pom1], 0(%[tmpz_n2]) \n\t"
239 "lwc1 %[pom], 0(%[tmpz_n34]) \n\t"
240 "lwc1 %[pom2], 4(%[tmpz_n2]) \n\t"
241 "lwc1 %[pom3], 4(%[tmpz_n34]) \n\t"
242 "lwc1 %[temp1],0(%[tmpz]) \n\t"
243 "lwc1 %[temp3],4(%[tmpz]) \n\t"
244 "add.s %[tmp5], %[pom1], %[pom] \n\t"
245 "sub.s %[tmp1], %[pom1], %[pom] \n\t"
246 "add.s %[tmp6], %[pom2], %[pom3] \n\t"
247 "sub.s %[tmp2], %[pom2], %[pom3] \n\t"
248 "sub.s %[temp], %[temp1], %[tmp5] \n\t"
249 "add.s %[temp1],%[temp1], %[tmp5] \n\t"
250 "sub.s %[temp4],%[temp3], %[tmp6] \n\t"
251 "add.s %[temp3],%[temp3], %[tmp6] \n\t"
252 "swc1 %[temp], 0(%[tmpz_n2]) \n\t"
253 "swc1 %[temp1],0(%[tmpz]) \n\t"
254 "lwc1 %[pom1], 0(%[tmpz_n4]) \n\t"
255 "swc1 %[temp4],4(%[tmpz_n2]) \n\t"
256 "lwc1 %[temp], 4(%[tmpz_n4]) \n\t"
257 "swc1 %[temp3],4(%[tmpz]) \n\t"
258 "sub.s %[pom], %[pom1], %[tmp2] \n\t"
259 "add.s %[pom1], %[pom1], %[tmp2] \n\t"
260 "add.s %[temp1],%[temp], %[tmp1] \n\t"
261 "sub.s %[temp], %[temp], %[tmp1] \n\t"
262 "swc1 %[pom], 0(%[tmpz_n34]) \n\t"
263 "swc1 %[pom1], 0(%[tmpz_n4]) \n\t"
264 "swc1 %[temp1],4(%[tmpz_n34]) \n\t"
265 "swc1 %[temp], 4(%[tmpz_n4]) \n\t"
267 [tmp1]
"=&f"(tmp1), [pom]
"=&f"(pom), [pom1]
"=&f"(pom1), [pom2]
"=&f"(pom2),
268 [tmp2]
"=&f"(tmp2), [tmp6]
"=&f"(tmp6), [pom3]
"=&f"(pom3),
269 [
temp]
"=&f"(
temp), [temp1]
"=&f"(temp1), [temp3]
"=&f"(temp3), [temp4]
"=&f"(temp4)
270 : [tmpz]
"r"(tmpz), [tmpz_n2]
"r"(tmpz_n2), [tmpz_n34]
"r"(tmpz_n34), [tmpz_n4]
"r"(tmpz_n4)
274 w_re_ptr = (
float*)(ff_cos_65536 + step);
275 w_im_ptr = (
float*)(ff_cos_65536 +
MAX_FFT_SIZE/4 - step);
277 for (i=1; i<n4; i++) {
280 tmpz_n2_i = tmpz_n2 + i;
281 tmpz_n4_i = tmpz_n4 + i;
282 tmpz_n34_i= tmpz_n34 + i;
286 "lwc1 %[temp], 0(%[tmpz_n2_i]) \n\t"
287 "lwc1 %[temp1], 4(%[tmpz_n2_i]) \n\t"
288 "lwc1 %[pom], 0(%[tmpz_n34_i]) \n\t"
289 "lwc1 %[pom1], 4(%[tmpz_n34_i]) \n\t"
290 "mul.s %[temp3], %[w_im], %[temp] \n\t"
291 "mul.s %[temp4], %[w_im], %[temp1] \n\t"
292 "mul.s %[pom2], %[w_im], %[pom1] \n\t"
293 "mul.s %[pom3], %[w_im], %[pom] \n\t"
294 "msub.s %[tmp2], %[temp3], %[w_re], %[temp1] \n\t"
295 "madd.s %[tmp1], %[temp4], %[w_re], %[temp] \n\t"
296 "msub.s %[tmp3], %[pom2], %[w_re], %[pom] \n\t"
297 "madd.s %[tmp4], %[pom3], %[w_re], %[pom1] \n\t"
298 "lwc1 %[temp], 0(%[tmpz_i]) \n\t"
299 "lwc1 %[pom], 4(%[tmpz_i]) \n\t"
300 "add.s %[tmp5], %[tmp1], %[tmp3] \n\t"
301 "sub.s %[tmp1], %[tmp1], %[tmp3] \n\t"
302 "add.s %[tmp6], %[tmp2], %[tmp4] \n\t"
303 "sub.s %[tmp2], %[tmp2], %[tmp4] \n\t"
304 "sub.s %[temp1], %[temp], %[tmp5] \n\t"
305 "add.s %[temp], %[temp], %[tmp5] \n\t"
306 "sub.s %[pom1], %[pom], %[tmp6] \n\t"
307 "add.s %[pom], %[pom], %[tmp6] \n\t"
308 "lwc1 %[temp3], 0(%[tmpz_n4_i]) \n\t"
309 "lwc1 %[pom2], 4(%[tmpz_n4_i]) \n\t"
310 "swc1 %[temp1], 0(%[tmpz_n2_i]) \n\t"
311 "swc1 %[temp], 0(%[tmpz_i]) \n\t"
312 "swc1 %[pom1], 4(%[tmpz_n2_i]) \n\t"
313 "swc1 %[pom] , 4(%[tmpz_i]) \n\t"
314 "sub.s %[temp4], %[temp3], %[tmp2] \n\t"
315 "add.s %[pom3], %[pom2], %[tmp1] \n\t"
316 "add.s %[temp3], %[temp3], %[tmp2] \n\t"
317 "sub.s %[pom2], %[pom2], %[tmp1] \n\t"
318 "swc1 %[temp4], 0(%[tmpz_n34_i]) \n\t"
319 "swc1 %[pom3], 4(%[tmpz_n34_i]) \n\t"
320 "swc1 %[temp3], 0(%[tmpz_n4_i]) \n\t"
321 "swc1 %[pom2], 4(%[tmpz_n4_i]) \n\t"
322 : [tmp1]
"=&f"(tmp1), [tmp2]
"=&f" (tmp2), [
temp]
"=&f"(
temp), [tmp3]
"=&f"(tmp3),
323 [tmp4]
"=&f"(tmp4), [tmp5]
"=&f"(tmp5), [tmp6]
"=&f"(tmp6),
324 [temp1]
"=&f"(temp1), [temp3]
"=&f"(temp3), [temp4]
"=&f"(temp4),
325 [pom]
"=&f"(pom), [pom1]
"=&f"(pom1), [pom2]
"=&f"(pom2), [pom3]
"=&f"(pom3)
326 : [w_re]
"f"(w_re), [w_im]
"f"(w_im),
327 [tmpz_i]
"r"(tmpz_i),[tmpz_n2_i]
"r"(tmpz_n2_i),
328 [tmpz_n34_i]
"r"(tmpz_n34_i), [tmpz_n4_i]
"r"(tmpz_n4_i)
346 int k, n8, n4, n2,
n, j;
347 const uint16_t *revtab = s->
revtab;
354 const float *tcos1, *tsin1, *tcos2, *tsin2;
355 float temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8,
356 temp9, temp10, temp11, temp12, temp13, temp14, temp15, temp16;
366 in2 = input + n2 - 1;
368 in4 = input + n2 - 3;
374 for(k = 0; k < n4; k += 2) {
379 "lwc1 %[temp1], 0(%[in2]) \t\n"
380 "lwc1 %[temp2], 0(%[tcos1]) \t\n"
381 "lwc1 %[temp3], 0(%[tsin1]) \t\n"
382 "lwc1 %[temp4], 0(%[in1]) \t\n"
383 "lwc1 %[temp5], 0(%[in4]) \t\n"
384 "mul.s %[temp9], %[temp1], %[temp2] \t\n"
385 "mul.s %[temp10], %[temp1], %[temp3] \t\n"
386 "lwc1 %[temp6], 4(%[tcos1]) \t\n"
387 "lwc1 %[temp7], 4(%[tsin1]) \t\n"
388 "nmsub.s %[temp9], %[temp9], %[temp4], %[temp3] \t\n"
389 "madd.s %[temp10], %[temp10], %[temp4], %[temp2] \t\n"
390 "mul.s %[temp11], %[temp5], %[temp6] \t\n"
391 "mul.s %[temp12], %[temp5], %[temp7] \t\n"
392 "lwc1 %[temp8], 0(%[in3]) \t\n"
393 "addiu %[tcos1], %[tcos1], 8 \t\n"
394 "addiu %[tsin1], %[tsin1], 8 \t\n"
395 "addiu %[in1], %[in1], 16 \t\n"
396 "nmsub.s %[temp11], %[temp11], %[temp8], %[temp7] \t\n"
397 "madd.s %[temp12], %[temp12], %[temp8], %[temp6] \t\n"
398 "addiu %[in2], %[in2], -16 \t\n"
399 "addiu %[in3], %[in3], 16 \t\n"
400 "addiu %[in4], %[in4], -16 \t\n"
402 : [temp1]
"=&f"(temp1), [temp2]
"=&f"(temp2),
403 [temp3]
"=&f"(temp3), [temp4]
"=&f"(temp4),
404 [temp5]
"=&f"(temp5), [temp6]
"=&f"(temp6),
405 [temp7]
"=&f"(temp7), [temp8]
"=&f"(temp8),
406 [temp9]
"=&f"(temp9), [temp10]
"=&f"(temp10),
407 [temp11]
"=&f"(temp11), [temp12]
"=&f"(temp12),
408 [tsin1]
"+r"(tsin1), [tcos1]
"+r"(tcos1),
409 [in1]
"+r"(in1), [in2]
"+r"(in2),
410 [in3]
"+r"(in3), [in4]
"+r"(in4)
425 for(k = 0; k < n8; k += 2) {
426 tcos1 = &tcos[n8 - k - 2];
427 tsin1 = &tsin[n8 - k - 2];
428 tcos2 = &tcos[n8 + k];
429 tsin2 = &tsin[n8 + k];
434 "lwc1 %[temp1], 12(%[z1]) \t\n"
435 "lwc1 %[temp2], 4(%[tsin1]) \t\n"
436 "lwc1 %[temp3], 4(%[tcos1]) \t\n"
437 "lwc1 %[temp4], 8(%[z1]) \t\n"
438 "lwc1 %[temp5], 4(%[z1]) \t\n"
439 "mul.s %[temp9], %[temp1], %[temp2] \t\n"
440 "mul.s %[temp10], %[temp1], %[temp3] \t\n"
441 "lwc1 %[temp6], 0(%[tsin1]) \t\n"
442 "lwc1 %[temp7], 0(%[tcos1]) \t\n"
443 "nmsub.s %[temp9], %[temp9], %[temp4], %[temp3] \t\n"
444 "madd.s %[temp10], %[temp10], %[temp4], %[temp2] \t\n"
445 "mul.s %[temp11], %[temp5], %[temp6] \t\n"
446 "mul.s %[temp12], %[temp5], %[temp7] \t\n"
447 "lwc1 %[temp8], 0(%[z1]) \t\n"
448 "lwc1 %[temp1], 4(%[z2]) \t\n"
449 "lwc1 %[temp2], 0(%[tsin2]) \t\n"
450 "lwc1 %[temp3], 0(%[tcos2]) \t\n"
451 "nmsub.s %[temp11], %[temp11], %[temp8], %[temp7] \t\n"
452 "madd.s %[temp12], %[temp12], %[temp8], %[temp6] \t\n"
453 "mul.s %[temp13], %[temp1], %[temp2] \t\n"
454 "mul.s %[temp14], %[temp1], %[temp3] \t\n"
455 "lwc1 %[temp4], 0(%[z2]) \t\n"
456 "lwc1 %[temp5], 12(%[z2]) \t\n"
457 "lwc1 %[temp6], 4(%[tsin2]) \t\n"
458 "lwc1 %[temp7], 4(%[tcos2]) \t\n"
459 "nmsub.s %[temp13], %[temp13], %[temp4], %[temp3] \t\n"
460 "madd.s %[temp14], %[temp14], %[temp4], %[temp2] \t\n"
461 "mul.s %[temp15], %[temp5], %[temp6] \t\n"
462 "mul.s %[temp16], %[temp5], %[temp7] \t\n"
463 "lwc1 %[temp8], 8(%[z2]) \t\n"
464 "nmsub.s %[temp15], %[temp15], %[temp8], %[temp7] \t\n"
465 "madd.s %[temp16], %[temp16], %[temp8], %[temp6] \t\n"
466 : [temp1]
"=&f"(temp1), [temp2]
"=&f"(temp2),
467 [temp3]
"=&f"(temp3), [temp4]
"=&f"(temp4),
468 [temp5]
"=&f"(temp5), [temp6]
"=&f"(temp6),
469 [temp7]
"=&f"(temp7), [temp8]
"=&f"(temp8),
470 [temp9]
"=&f"(temp9), [temp10]
"=&f"(temp10),
471 [temp11]
"=&f"(temp11), [temp12]
"=&f"(temp12),
472 [temp13]
"=&f"(temp13), [temp14]
"=&f"(temp14),
473 [temp15]
"=&f"(temp15), [temp16]
"=&f"(temp16)
474 : [z1]
"r"(z1), [z2]
"r"(z2),
475 [tsin1]
"r"(tsin1), [tcos1]
"r"(tcos1),
476 [tsin2]
"r"(tsin2), [tcos2]
"r"(tcos2)
504 ff_imdct_half_mips(s, output+n4, input);
506 for(k = 0; k < n4; k+=4) {
507 output[k] = -output[n2-k-1];
508 output[k+1] = -output[n2-k-2];
509 output[k+2] = -output[n2-k-3];
510 output[k+3] = -output[n2-k-4];
512 output[n-k-1] = output[n2+k];
513 output[n-k-2] = output[n2+k+1];
514 output[n-k-3] = output[n2+k+2];
515 output[n-k-4] = output[n2+k+3];