60 #if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
63 int nbits, i,
n, num_transforms,
offset, step;
65 FFTSample tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8;
68 float *w_re_ptr, *w_im_ptr;
69 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;
75 num_transforms = (21845 >> (17 - s->
nbits)) | 1;
77 for (n=0; n<num_transforms; n++) {
81 tmp1 = tmpz[0].
re + tmpz[1].
re;
82 tmp5 = tmpz[2].
re + tmpz[3].
re;
83 tmp2 = tmpz[0].
im + tmpz[1].
im;
84 tmp6 = tmpz[2].
im + tmpz[3].
im;
85 tmp3 = tmpz[0].
re - tmpz[1].
re;
86 tmp8 = tmpz[2].
im - tmpz[3].
im;
87 tmp4 = tmpz[0].
im - tmpz[1].
im;
88 tmp7 = tmpz[2].
re - tmpz[3].
re;
90 tmpz[0].
re = tmp1 + tmp5;
91 tmpz[2].
re = tmp1 - tmp5;
92 tmpz[0].
im = tmp2 + tmp6;
93 tmpz[2].
im = tmp2 - tmp6;
94 tmpz[1].
re = tmp3 + tmp8;
95 tmpz[3].
re = tmp3 - tmp8;
96 tmpz[1].
im = tmp4 - tmp7;
97 tmpz[3].
im = tmp4 + tmp7;
104 num_transforms = (num_transforms >> 1) | 1;
106 for (n=0; n<num_transforms; n++) {
111 "lwc1 %[tmp1], 32(%[tmpz]) \n\t"
112 "lwc1 %[pom], 40(%[tmpz]) \n\t"
113 "lwc1 %[tmp3], 48(%[tmpz]) \n\t"
114 "lwc1 %[pom1], 56(%[tmpz]) \n\t"
115 "lwc1 %[tmp2], 36(%[tmpz]) \n\t"
116 "lwc1 %[pom2], 44(%[tmpz]) \n\t"
117 "lwc1 %[pom3], 60(%[tmpz]) \n\t"
118 "lwc1 %[tmp4], 52(%[tmpz]) \n\t"
119 "add.s %[tmp1], %[tmp1], %[pom] \n\t"
120 "add.s %[tmp3], %[tmp3], %[pom1] \n\t"
121 "add.s %[tmp2], %[tmp2], %[pom2] \n\t"
122 "lwc1 %[pom], 40(%[tmpz]) \n\t"
123 "add.s %[tmp4], %[tmp4], %[pom3] \n\t"
124 "add.s %[tmp5], %[tmp1], %[tmp3] \n\t"
125 "sub.s %[tmp7], %[tmp1], %[tmp3] \n\t"
126 "lwc1 %[tmp1], 32(%[tmpz]) \n\t"
127 "lwc1 %[pom1], 44(%[tmpz]) \n\t"
128 "add.s %[tmp6], %[tmp2], %[tmp4] \n\t"
129 "sub.s %[tmp8], %[tmp2], %[tmp4] \n\t"
130 "lwc1 %[tmp2], 36(%[tmpz]) \n\t"
131 "lwc1 %[pom2], 56(%[tmpz]) \n\t"
132 "lwc1 %[pom3], 60(%[tmpz]) \n\t"
133 "lwc1 %[tmp3], 48(%[tmpz]) \n\t"
134 "lwc1 %[tmp4], 52(%[tmpz]) \n\t"
135 "sub.s %[tmp1], %[tmp1], %[pom] \n\t"
136 "lwc1 %[pom], 0(%[tmpz]) \n\t"
137 "sub.s %[tmp2], %[tmp2], %[pom1] \n\t"
138 "sub.s %[tmp3], %[tmp3], %[pom2] \n\t"
139 "lwc1 %[pom2], 4(%[tmpz]) \n\t"
140 "sub.s %[pom1], %[pom], %[tmp5] \n\t"
141 "sub.s %[tmp4], %[tmp4], %[pom3] \n\t"
142 "add.s %[pom3], %[pom], %[tmp5] \n\t"
143 "sub.s %[pom], %[pom2], %[tmp6] \n\t"
144 "add.s %[pom2], %[pom2], %[tmp6] \n\t"
145 "swc1 %[pom1], 32(%[tmpz]) \n\t"
146 "swc1 %[pom3], 0(%[tmpz]) \n\t"
147 "swc1 %[pom], 36(%[tmpz]) \n\t"
148 "swc1 %[pom2], 4(%[tmpz]) \n\t"
149 "lwc1 %[pom1], 16(%[tmpz]) \n\t"
150 "lwc1 %[pom3], 20(%[tmpz]) \n\t"
151 "li.s %[pom], 0.7071067812 \n\t"
152 "add.s %[temp1],%[tmp1], %[tmp2] \n\t"
153 "sub.s %[temp], %[pom1], %[tmp8] \n\t"
154 "add.s %[pom2], %[pom3], %[tmp7] \n\t"
155 "sub.s %[temp3],%[tmp3], %[tmp4] \n\t"
156 "sub.s %[temp4],%[tmp2], %[tmp1] \n\t"
157 "swc1 %[temp], 48(%[tmpz]) \n\t"
158 "swc1 %[pom2], 52(%[tmpz]) \n\t"
159 "add.s %[pom1], %[pom1], %[tmp8] \n\t"
160 "sub.s %[pom3], %[pom3], %[tmp7] \n\t"
161 "add.s %[tmp3], %[tmp3], %[tmp4] \n\t"
162 "mul.s %[tmp5], %[pom], %[temp1] \n\t"
163 "mul.s %[tmp7], %[pom], %[temp3] \n\t"
164 "mul.s %[tmp6], %[pom], %[temp4] \n\t"
165 "mul.s %[tmp8], %[pom], %[tmp3] \n\t"
166 "swc1 %[pom1], 16(%[tmpz]) \n\t"
167 "swc1 %[pom3], 20(%[tmpz]) \n\t"
168 "add.s %[tmp1], %[tmp5], %[tmp7] \n\t"
169 "sub.s %[tmp3], %[tmp5], %[tmp7] \n\t"
170 "add.s %[tmp2], %[tmp6], %[tmp8] \n\t"
171 "sub.s %[tmp4], %[tmp6], %[tmp8] \n\t"
172 "lwc1 %[temp], 8(%[tmpz]) \n\t"
173 "lwc1 %[temp1],12(%[tmpz]) \n\t"
174 "lwc1 %[pom], 24(%[tmpz]) \n\t"
175 "lwc1 %[pom2], 28(%[tmpz]) \n\t"
176 "sub.s %[temp4],%[temp], %[tmp1] \n\t"
177 "sub.s %[temp3],%[temp1], %[tmp2] \n\t"
178 "add.s %[temp], %[temp], %[tmp1] \n\t"
179 "add.s %[temp1],%[temp1], %[tmp2] \n\t"
180 "sub.s %[pom1], %[pom], %[tmp4] \n\t"
181 "add.s %[pom3], %[pom2], %[tmp3] \n\t"
182 "add.s %[pom], %[pom], %[tmp4] \n\t"
183 "sub.s %[pom2], %[pom2], %[tmp3] \n\t"
184 "swc1 %[temp4],40(%[tmpz]) \n\t"
185 "swc1 %[temp3],44(%[tmpz]) \n\t"
186 "swc1 %[temp], 8(%[tmpz]) \n\t"
187 "swc1 %[temp1],12(%[tmpz]) \n\t"
188 "swc1 %[pom1], 56(%[tmpz]) \n\t"
189 "swc1 %[pom3], 60(%[tmpz]) \n\t"
190 "swc1 %[pom], 24(%[tmpz]) \n\t"
191 "swc1 %[pom2], 28(%[tmpz]) \n\t"
192 : [tmp1]
"=&f"(tmp1), [pom]
"=&f"(pom), [pom1]
"=&f"(pom1), [pom2]
"=&f"(pom2),
193 [tmp3]
"=&f"(tmp3), [tmp2]
"=&f"(tmp2), [tmp4]
"=&f"(tmp4), [tmp5]
"=&f"(tmp5), [tmp7]
"=&f"(tmp7),
194 [tmp6]
"=&f"(tmp6), [tmp8]
"=&f"(tmp8), [pom3]
"=&f"(pom3),[
temp]
"=&f"(
temp), [temp1]
"=&f"(temp1),
195 [temp3]
"=&f"(temp3), [temp4]
"=&f"(temp4)
204 for (nbits=4; nbits<=s->
nbits; nbits++) {
205 num_transforms = (num_transforms >> 1) | 1;
209 for (n=0; n<num_transforms; n++) {
215 tmpz_n34 = tmpz + n34;
218 "lwc1 %[pom1], 0(%[tmpz_n2]) \n\t"
219 "lwc1 %[pom], 0(%[tmpz_n34]) \n\t"
220 "lwc1 %[pom2], 4(%[tmpz_n2]) \n\t"
221 "lwc1 %[pom3], 4(%[tmpz_n34]) \n\t"
222 "lwc1 %[temp1],0(%[tmpz]) \n\t"
223 "lwc1 %[temp3],4(%[tmpz]) \n\t"
224 "add.s %[tmp5], %[pom1], %[pom] \n\t"
225 "sub.s %[tmp1], %[pom1], %[pom] \n\t"
226 "add.s %[tmp6], %[pom2], %[pom3] \n\t"
227 "sub.s %[tmp2], %[pom2], %[pom3] \n\t"
228 "sub.s %[temp], %[temp1], %[tmp5] \n\t"
229 "add.s %[temp1],%[temp1], %[tmp5] \n\t"
230 "sub.s %[temp4],%[temp3], %[tmp6] \n\t"
231 "add.s %[temp3],%[temp3], %[tmp6] \n\t"
232 "swc1 %[temp], 0(%[tmpz_n2]) \n\t"
233 "swc1 %[temp1],0(%[tmpz]) \n\t"
234 "lwc1 %[pom1], 0(%[tmpz_n4]) \n\t"
235 "swc1 %[temp4],4(%[tmpz_n2]) \n\t"
236 "lwc1 %[temp], 4(%[tmpz_n4]) \n\t"
237 "swc1 %[temp3],4(%[tmpz]) \n\t"
238 "sub.s %[pom], %[pom1], %[tmp2] \n\t"
239 "add.s %[pom1], %[pom1], %[tmp2] \n\t"
240 "add.s %[temp1],%[temp], %[tmp1] \n\t"
241 "sub.s %[temp], %[temp], %[tmp1] \n\t"
242 "swc1 %[pom], 0(%[tmpz_n34]) \n\t"
243 "swc1 %[pom1], 0(%[tmpz_n4]) \n\t"
244 "swc1 %[temp1],4(%[tmpz_n34]) \n\t"
245 "swc1 %[temp], 4(%[tmpz_n4]) \n\t"
247 [tmp1]
"=&f"(tmp1), [pom]
"=&f"(pom), [pom1]
"=&f"(pom1), [pom2]
"=&f"(pom2),
248 [tmp2]
"=&f"(tmp2), [tmp6]
"=&f"(tmp6), [pom3]
"=&f"(pom3),
249 [
temp]
"=&f"(
temp), [temp1]
"=&f"(temp1), [temp3]
"=&f"(temp3), [temp4]
"=&f"(temp4)
250 : [tmpz]
"r"(tmpz), [tmpz_n2]
"r"(tmpz_n2), [tmpz_n34]
"r"(tmpz_n34), [tmpz_n4]
"r"(tmpz_n4)
254 w_re_ptr = (
float*)(ff_cos_131072 + step);
255 w_im_ptr = (
float*)(ff_cos_131072 +
MAX_FFT_SIZE/4 - step);
257 for (i=1; i<n4; i++) {
260 tmpz_n2_i = tmpz_n2 + i;
261 tmpz_n4_i = tmpz_n4 + i;
262 tmpz_n34_i= tmpz_n34 + i;
266 "lwc1 %[temp], 0(%[tmpz_n2_i]) \n\t"
267 "lwc1 %[temp1], 4(%[tmpz_n2_i]) \n\t"
268 "lwc1 %[pom], 0(%[tmpz_n34_i]) \n\t"
269 "lwc1 %[pom1], 4(%[tmpz_n34_i]) \n\t"
270 "mul.s %[temp3], %[w_im], %[temp] \n\t"
271 "mul.s %[temp4], %[w_im], %[temp1] \n\t"
272 "mul.s %[pom2], %[w_im], %[pom1] \n\t"
273 "mul.s %[pom3], %[w_im], %[pom] \n\t"
274 "msub.s %[tmp2], %[temp3], %[w_re], %[temp1] \n\t"
275 "madd.s %[tmp1], %[temp4], %[w_re], %[temp] \n\t"
276 "msub.s %[tmp3], %[pom2], %[w_re], %[pom] \n\t"
277 "madd.s %[tmp4], %[pom3], %[w_re], %[pom1] \n\t"
278 "lwc1 %[temp], 0(%[tmpz_i]) \n\t"
279 "lwc1 %[pom], 4(%[tmpz_i]) \n\t"
280 "add.s %[tmp5], %[tmp1], %[tmp3] \n\t"
281 "sub.s %[tmp1], %[tmp1], %[tmp3] \n\t"
282 "add.s %[tmp6], %[tmp2], %[tmp4] \n\t"
283 "sub.s %[tmp2], %[tmp2], %[tmp4] \n\t"
284 "sub.s %[temp1], %[temp], %[tmp5] \n\t"
285 "add.s %[temp], %[temp], %[tmp5] \n\t"
286 "sub.s %[pom1], %[pom], %[tmp6] \n\t"
287 "add.s %[pom], %[pom], %[tmp6] \n\t"
288 "lwc1 %[temp3], 0(%[tmpz_n4_i]) \n\t"
289 "lwc1 %[pom2], 4(%[tmpz_n4_i]) \n\t"
290 "swc1 %[temp1], 0(%[tmpz_n2_i]) \n\t"
291 "swc1 %[temp], 0(%[tmpz_i]) \n\t"
292 "swc1 %[pom1], 4(%[tmpz_n2_i]) \n\t"
293 "swc1 %[pom] , 4(%[tmpz_i]) \n\t"
294 "sub.s %[temp4], %[temp3], %[tmp2] \n\t"
295 "add.s %[pom3], %[pom2], %[tmp1] \n\t"
296 "add.s %[temp3], %[temp3], %[tmp2] \n\t"
297 "sub.s %[pom2], %[pom2], %[tmp1] \n\t"
298 "swc1 %[temp4], 0(%[tmpz_n34_i]) \n\t"
299 "swc1 %[pom3], 4(%[tmpz_n34_i]) \n\t"
300 "swc1 %[temp3], 0(%[tmpz_n4_i]) \n\t"
301 "swc1 %[pom2], 4(%[tmpz_n4_i]) \n\t"
302 : [tmp1]
"=&f"(tmp1), [tmp2]
"=&f" (tmp2), [
temp]
"=&f"(
temp), [tmp3]
"=&f"(tmp3),
303 [tmp4]
"=&f"(tmp4), [tmp5]
"=&f"(tmp5), [tmp6]
"=&f"(tmp6),
304 [temp1]
"=&f"(temp1), [temp3]
"=&f"(temp3), [temp4]
"=&f"(temp4),
305 [pom]
"=&f"(pom), [pom1]
"=&f"(pom1), [pom2]
"=&f"(pom2), [pom3]
"=&f"(pom3)
306 : [w_re]
"f"(w_re), [w_im]
"f"(w_im),
307 [tmpz_i]
"r"(tmpz_i),[tmpz_n2_i]
"r"(tmpz_n2_i),
308 [tmpz_n34_i]
"r"(tmpz_n34_i), [tmpz_n4_i]
"r"(tmpz_n4_i)
326 int k, n8, n4, n2,
n, j;
327 const uint16_t *revtab = s->
revtab;
334 const float *tcos1, *tsin1, *tcos2, *tsin2;
335 float temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8,
336 temp9, temp10, temp11, temp12, temp13, temp14, temp15, temp16;
346 in2 = input + n2 - 1;
348 in4 = input + n2 - 3;
354 for(k = 0; k < n4; k += 2) {
359 "lwc1 %[temp1], 0(%[in2]) \t\n"
360 "lwc1 %[temp2], 0(%[tcos1]) \t\n"
361 "lwc1 %[temp3], 0(%[tsin1]) \t\n"
362 "lwc1 %[temp4], 0(%[in1]) \t\n"
363 "lwc1 %[temp5], 0(%[in4]) \t\n"
364 "mul.s %[temp9], %[temp1], %[temp2] \t\n"
365 "mul.s %[temp10], %[temp1], %[temp3] \t\n"
366 "lwc1 %[temp6], 4(%[tcos1]) \t\n"
367 "lwc1 %[temp7], 4(%[tsin1]) \t\n"
368 "nmsub.s %[temp9], %[temp9], %[temp4], %[temp3] \t\n"
369 "madd.s %[temp10], %[temp10], %[temp4], %[temp2] \t\n"
370 "mul.s %[temp11], %[temp5], %[temp6] \t\n"
371 "mul.s %[temp12], %[temp5], %[temp7] \t\n"
372 "lwc1 %[temp8], 0(%[in3]) \t\n"
376 "nmsub.s %[temp11], %[temp11], %[temp8], %[temp7] \t\n"
377 "madd.s %[temp12], %[temp12], %[temp8], %[temp6] \t\n"
382 : [temp1]
"=&f"(temp1), [temp2]
"=&f"(temp2),
383 [temp3]
"=&f"(temp3), [temp4]
"=&f"(temp4),
384 [temp5]
"=&f"(temp5), [temp6]
"=&f"(temp6),
385 [temp7]
"=&f"(temp7), [temp8]
"=&f"(temp8),
386 [temp9]
"=&f"(temp9), [temp10]
"=&f"(temp10),
387 [temp11]
"=&f"(temp11), [temp12]
"=&f"(temp12),
388 [tsin1]
"+r"(tsin1), [tcos1]
"+r"(tcos1),
389 [in1]
"+r"(in1), [in2]
"+r"(in2),
390 [in3]
"+r"(in3), [in4]
"+r"(in4)
405 for(k = 0; k < n8; k += 2) {
406 tcos1 = &tcos[n8 - k - 2];
407 tsin1 = &tsin[n8 - k - 2];
408 tcos2 = &tcos[n8 + k];
409 tsin2 = &tsin[n8 + k];
414 "lwc1 %[temp1], 12(%[z1]) \t\n"
415 "lwc1 %[temp2], 4(%[tsin1]) \t\n"
416 "lwc1 %[temp3], 4(%[tcos1]) \t\n"
417 "lwc1 %[temp4], 8(%[z1]) \t\n"
418 "lwc1 %[temp5], 4(%[z1]) \t\n"
419 "mul.s %[temp9], %[temp1], %[temp2] \t\n"
420 "mul.s %[temp10], %[temp1], %[temp3] \t\n"
421 "lwc1 %[temp6], 0(%[tsin1]) \t\n"
422 "lwc1 %[temp7], 0(%[tcos1]) \t\n"
423 "nmsub.s %[temp9], %[temp9], %[temp4], %[temp3] \t\n"
424 "madd.s %[temp10], %[temp10], %[temp4], %[temp2] \t\n"
425 "mul.s %[temp11], %[temp5], %[temp6] \t\n"
426 "mul.s %[temp12], %[temp5], %[temp7] \t\n"
427 "lwc1 %[temp8], 0(%[z1]) \t\n"
428 "lwc1 %[temp1], 4(%[z2]) \t\n"
429 "lwc1 %[temp2], 0(%[tsin2]) \t\n"
430 "lwc1 %[temp3], 0(%[tcos2]) \t\n"
431 "nmsub.s %[temp11], %[temp11], %[temp8], %[temp7] \t\n"
432 "madd.s %[temp12], %[temp12], %[temp8], %[temp6] \t\n"
433 "mul.s %[temp13], %[temp1], %[temp2] \t\n"
434 "mul.s %[temp14], %[temp1], %[temp3] \t\n"
435 "lwc1 %[temp4], 0(%[z2]) \t\n"
436 "lwc1 %[temp5], 12(%[z2]) \t\n"
437 "lwc1 %[temp6], 4(%[tsin2]) \t\n"
438 "lwc1 %[temp7], 4(%[tcos2]) \t\n"
439 "nmsub.s %[temp13], %[temp13], %[temp4], %[temp3] \t\n"
440 "madd.s %[temp14], %[temp14], %[temp4], %[temp2] \t\n"
441 "mul.s %[temp15], %[temp5], %[temp6] \t\n"
442 "mul.s %[temp16], %[temp5], %[temp7] \t\n"
443 "lwc1 %[temp8], 8(%[z2]) \t\n"
444 "nmsub.s %[temp15], %[temp15], %[temp8], %[temp7] \t\n"
445 "madd.s %[temp16], %[temp16], %[temp8], %[temp6] \t\n"
446 : [temp1]
"=&f"(temp1), [temp2]
"=&f"(temp2),
447 [temp3]
"=&f"(temp3), [temp4]
"=&f"(temp4),
448 [temp5]
"=&f"(temp5), [temp6]
"=&f"(temp6),
449 [temp7]
"=&f"(temp7), [temp8]
"=&f"(temp8),
450 [temp9]
"=&f"(temp9), [temp10]
"=&f"(temp10),
451 [temp11]
"=&f"(temp11), [temp12]
"=&f"(temp12),
452 [temp13]
"=&f"(temp13), [temp14]
"=&f"(temp14),
453 [temp15]
"=&f"(temp15), [temp16]
"=&f"(temp16)
454 : [z1]
"r"(z1), [z2]
"r"(z2),
455 [tsin1]
"r"(tsin1), [tcos1]
"r"(tcos1),
456 [tsin2]
"r"(tsin2), [tcos2]
"r"(tcos2)
484 ff_imdct_half_mips(s, output+n4, input);
486 for(k = 0; k < n4; k+=4) {
487 output[k] = -output[n2-k-1];
488 output[k+1] = -output[n2-k-2];
489 output[k+2] = -output[n2-k-3];
490 output[k+3] = -output[n2-k-4];
492 output[n-k-1] = output[n2+k];
493 output[n-k-2] = output[n2+k+1];
494 output[n-k-3] = output[n2+k+2];
495 output[n-k-4] = output[n2+k+3];
509 #if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
MIPS assembly defines from sys/asm.h but rewritten for use with C inline assembly (rather than from w...
#define MAX_LOG2_NFFT
Specifies maximum allowed fft size.
void ff_fft_lut_init(uint16_t *table, int off, int size, int *index)
av_cold void ff_fft_init_mips(FFTContext *s)
FFT transform.
static const uint8_t offset[127][2]
void(* imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input)
void(* imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input)
uint16_t ff_fft_offsets_lut[21845]
#define ff_init_ff_cos_tabs
void(* fft_calc)(struct FFTContext *s, FFTComplex *z)
Do a complex FFT with the parameters defined in ff_fft_init().
definitions and tables for FFT