diff options
Diffstat (limited to 'apps/codecs/liba52/imdct.c')
-rw-r--r-- | apps/codecs/liba52/imdct.c | 172 |
1 files changed, 86 insertions, 86 deletions
diff --git a/apps/codecs/liba52/imdct.c b/apps/codecs/liba52/imdct.c index 4483bd0667..9aaa9d85ad 100644 --- a/apps/codecs/liba52/imdct.c +++ b/apps/codecs/liba52/imdct.c | |||
@@ -114,73 +114,73 @@ static inline void ifft4 (complex_t * buf) | |||
114 | */ | 114 | */ |
115 | /* basic radix-2 ifft butterfly */ | 115 | /* basic radix-2 ifft butterfly */ |
116 | 116 | ||
117 | #define BUTTERFLY_0(t0,t1,W0,W1,d0,d1) do { \ | 117 | #define BUTTERFLY_0(t0,t1,W0,W1,d0,d1) do { \ |
118 | t0 = MUL (W1, d1) + MUL (W0, d0); \ | 118 | t0 = MUL (W1, d1) + MUL (W0, d0); \ |
119 | t1 = MUL (W0, d1) - MUL (W1, d0); \ | 119 | t1 = MUL (W0, d1) - MUL (W1, d0); \ |
120 | } while (0) | 120 | } while (0) |
121 | 121 | ||
122 | /* radix-2 ifft butterfly with bias */ | 122 | /* radix-2 ifft butterfly with bias */ |
123 | 123 | ||
124 | #define BUTTERFLY_B(t0,t1,W0,W1,d0,d1) do { \ | 124 | #define BUTTERFLY_B(t0,t1,W0,W1,d0,d1) do { \ |
125 | t0 = BIAS (MUL (d1, W1) + MUL (d0, W0)); \ | 125 | t0 = BIAS (MUL (d1, W1) + MUL (d0, W0)); \ |
126 | t1 = BIAS (MUL (d1, W0) - MUL (d0, W1)); \ | 126 | t1 = BIAS (MUL (d1, W0) - MUL (d0, W1)); \ |
127 | } while (0) | 127 | } while (0) |
128 | 128 | ||
129 | /* the basic split-radix ifft butterfly */ | 129 | /* the basic split-radix ifft butterfly */ |
130 | 130 | ||
131 | #define BUTTERFLY(a0,a1,a2,a3,wr,wi) do { \ | 131 | #define BUTTERFLY(a0,a1,a2,a3,wr,wi) do { \ |
132 | BUTTERFLY_0 (tmp5, tmp6, wr, wi, a2.real, a2.imag); \ | 132 | BUTTERFLY_0 (tmp5, tmp6, wr, wi, a2.real, a2.imag); \ |
133 | BUTTERFLY_0 (tmp8, tmp7, wr, wi, a3.imag, a3.real); \ | 133 | BUTTERFLY_0 (tmp8, tmp7, wr, wi, a3.imag, a3.real); \ |
134 | tmp1 = tmp5 + tmp7; \ | 134 | tmp1 = tmp5 + tmp7; \ |
135 | tmp2 = tmp6 + tmp8; \ | 135 | tmp2 = tmp6 + tmp8; \ |
136 | tmp3 = tmp6 - tmp8; \ | 136 | tmp3 = tmp6 - tmp8; \ |
137 | tmp4 = tmp7 - tmp5; \ | 137 | tmp4 = tmp7 - tmp5; \ |
138 | a2.real = a0.real - tmp1; \ | 138 | a2.real = a0.real - tmp1; \ |
139 | a2.imag = a0.imag - tmp2; \ | 139 | a2.imag = a0.imag - tmp2; \ |
140 | a3.real = a1.real - tmp3; \ | 140 | a3.real = a1.real - tmp3; \ |
141 | a3.imag = a1.imag - tmp4; \ | 141 | a3.imag = a1.imag - tmp4; \ |
142 | a0.real += tmp1; \ | 142 | a0.real += tmp1; \ |
143 | a0.imag += tmp2; \ | 143 | a0.imag += tmp2; \ |
144 | a1.real += tmp3; \ | 144 | a1.real += tmp3; \ |
145 | a1.imag += tmp4; \ | 145 | a1.imag += tmp4; \ |
146 | } while (0) | 146 | } while (0) |
147 | 147 | ||
148 | /* split-radix ifft butterfly, specialized for wr=1 wi=0 */ | 148 | /* split-radix ifft butterfly, specialized for wr=1 wi=0 */ |
149 | 149 | ||
150 | #define BUTTERFLY_ZERO(a0,a1,a2,a3) do { \ | 150 | #define BUTTERFLY_ZERO(a0,a1,a2,a3) do { \ |
151 | tmp1 = a2.real + a3.real; \ | 151 | tmp1 = a2.real + a3.real; \ |
152 | tmp2 = a2.imag + a3.imag; \ | 152 | tmp2 = a2.imag + a3.imag; \ |
153 | tmp3 = a2.imag - a3.imag; \ | 153 | tmp3 = a2.imag - a3.imag; \ |
154 | tmp4 = a3.real - a2.real; \ | 154 | tmp4 = a3.real - a2.real; \ |
155 | a2.real = a0.real - tmp1; \ | 155 | a2.real = a0.real - tmp1; \ |
156 | a2.imag = a0.imag - tmp2; \ | 156 | a2.imag = a0.imag - tmp2; \ |
157 | a3.real = a1.real - tmp3; \ | 157 | a3.real = a1.real - tmp3; \ |
158 | a3.imag = a1.imag - tmp4; \ | 158 | a3.imag = a1.imag - tmp4; \ |
159 | a0.real += tmp1; \ | 159 | a0.real += tmp1; \ |
160 | a0.imag += tmp2; \ | 160 | a0.imag += tmp2; \ |
161 | a1.real += tmp3; \ | 161 | a1.real += tmp3; \ |
162 | a1.imag += tmp4; \ | 162 | a1.imag += tmp4; \ |
163 | } while (0) | 163 | } while (0) |
164 | 164 | ||
165 | /* split-radix ifft butterfly, specialized for wr=wi */ | 165 | /* split-radix ifft butterfly, specialized for wr=wi */ |
166 | /* | 166 | /* |
167 | #define BUTTERFLY_HALF(a0,a1,a2,a3,w) do { \ | 167 | #define BUTTERFLY_HALF(a0,a1,a2,a3,w) do { \ |
168 | tmp5 = MUL (a2.real + a2.imag, w); \ | 168 | tmp5 = MUL (a2.real + a2.imag, w); \ |
169 | tmp6 = MUL (a2.imag - a2.real, w); \ | 169 | tmp6 = MUL (a2.imag - a2.real, w); \ |
170 | tmp7 = MUL (a3.real - a3.imag, w); \ | 170 | tmp7 = MUL (a3.real - a3.imag, w); \ |
171 | tmp8 = MUL (a3.imag + a3.real, w); \ | 171 | tmp8 = MUL (a3.imag + a3.real, w); \ |
172 | tmp1 = tmp5 + tmp7; \ | 172 | tmp1 = tmp5 + tmp7; \ |
173 | tmp2 = tmp6 + tmp8; \ | 173 | tmp2 = tmp6 + tmp8; \ |
174 | tmp3 = tmp6 - tmp8; \ | 174 | tmp3 = tmp6 - tmp8; \ |
175 | tmp4 = tmp7 - tmp5; \ | 175 | tmp4 = tmp7 - tmp5; \ |
176 | a2.real = a0.real - tmp1; \ | 176 | a2.real = a0.real - tmp1; \ |
177 | a2.imag = a0.imag - tmp2; \ | 177 | a2.imag = a0.imag - tmp2; \ |
178 | a3.real = a1.real - tmp3; \ | 178 | a3.real = a1.real - tmp3; \ |
179 | a3.imag = a1.imag - tmp4; \ | 179 | a3.imag = a1.imag - tmp4; \ |
180 | a0.real += tmp1; \ | 180 | a0.real += tmp1; \ |
181 | a0.imag += tmp2; \ | 181 | a0.imag += tmp2; \ |
182 | a1.real += tmp3; \ | 182 | a1.real += tmp3; \ |
183 | a1.imag += tmp4; \ | 183 | a1.imag += tmp4; \ |
184 | } while (0) | 184 | } while (0) |
185 | 185 | ||
186 | static inline void ifft8 (complex_t * buf) | 186 | static inline void ifft8 (complex_t * buf) |
@@ -212,13 +212,13 @@ static void ifft_pass (complex_t * buf, const sample_t * weight, int n) | |||
212 | i = n - 1; | 212 | i = n - 1; |
213 | 213 | ||
214 | do { | 214 | do { |
215 | BUTTERFLY (buf[0], buf1[0], buf2[0], buf3[0], | 215 | BUTTERFLY (buf[0], buf1[0], buf2[0], buf3[0], |
216 | weight[0], weight[2*i-n]); | 216 | weight[0], weight[2*i-n]); |
217 | buf++; | 217 | buf++; |
218 | buf1++; | 218 | buf1++; |
219 | buf2++; | 219 | buf2++; |
220 | buf3++; | 220 | buf3++; |
221 | weight++; | 221 | weight++; |
222 | } while (--i); | 222 | } while (--i); |
223 | } | 223 | } |
224 | 224 | ||
@@ -264,7 +264,7 @@ void a52_imdct_512 (sample_t * data, sample_t * delay) | |||
264 | sample_t t_r, t_i, a_r, a_i, b_r, b_i, w_1, w_2; | 264 | sample_t t_r, t_i, a_r, a_i, b_r, b_i, w_1, w_2; |
265 | const sample_t * window = a52_imdct_window; | 265 | const sample_t * window = a52_imdct_window; |
266 | FFTComplex buf[128]; | 266 | FFTComplex buf[128]; |
267 | 267 | ||
268 | for (i = 0; i < 128; i++) { | 268 | for (i = 0; i < 128; i++) { |
269 | k = fftorder[i]; | 269 | k = fftorder[i]; |
270 | t_r = pre1[i].real; | 270 | t_r = pre1[i].real; |
@@ -357,7 +357,7 @@ static double besselI0 (double x) | |||
357 | int i = 100; | 357 | int i = 100; |
358 | 358 | ||
359 | do | 359 | do |
360 | bessel = bessel * x / (i * i) + 1; | 360 | bessel = bessel * x / (i * i) + 1; |
361 | while (--i); | 361 | while (--i); |
362 | return bessel; | 362 | return bessel; |
363 | } | 363 | } |
@@ -376,13 +376,13 @@ void a52_imdct_init (uint32_t mm_accel) | |||
376 | /* compute imdct window - kaiser-bessel derived window, alpha = 5.0 */ | 376 | /* compute imdct window - kaiser-bessel derived window, alpha = 5.0 */ |
377 | /* sum = 0; | 377 | /* sum = 0; |
378 | for (i = 0; i < 256; i++) { | 378 | for (i = 0; i < 256; i++) { |
379 | sum += besselI0 (i * (256 - i) * (5 * M_PI / 256) * (5 * M_PI / 256)); | 379 | sum += besselI0 (i * (256 - i) * (5 * M_PI / 256) * (5 * M_PI / 256)); |
380 | local_imdct_window[i] = sum; | 380 | local_imdct_window[i] = sum; |
381 | } | 381 | } |
382 | sum++; | 382 | sum++; |
383 | */ | 383 | */ |
384 | /* for (i = 0; i < 256; i++) | 384 | /* for (i = 0; i < 256; i++) |
385 | a52_imdct_window[i] = SAMPLE (sqrt (local_imdct_window[i] / sum)); | 385 | a52_imdct_window[i] = SAMPLE (sqrt (local_imdct_window[i] / sum)); |
386 | 386 | ||
387 | printf("static sample_t a52_imdct_window[256]={"); | 387 | printf("static sample_t a52_imdct_window[256]={"); |
388 | for (i=0;i<256;i++) { | 388 | for (i=0;i<256;i++) { |
@@ -393,26 +393,26 @@ void a52_imdct_init (uint32_t mm_accel) | |||
393 | */ | 393 | */ |
394 | 394 | ||
395 | /* for (i = 0; i < 3; i++) | 395 | /* for (i = 0; i < 3; i++) |
396 | roots16[i] = SAMPLE (cos ((M_PI / 8) * (i + 1))); | 396 | roots16[i] = SAMPLE (cos ((M_PI / 8) * (i + 1))); |
397 | 397 | ||
398 | printf("static sample_t roots16[3]={%d,%d,%d};\n\n",roots16[0],roots16[1],roots16[2]); | 398 | printf("static sample_t roots16[3]={%d,%d,%d};\n\n",roots16[0],roots16[1],roots16[2]); |
399 | 399 | ||
400 | for (i = 0; i < 7; i++) | 400 | for (i = 0; i < 7; i++) |
401 | roots32[i] = SAMPLE (cos ((M_PI / 16) * (i + 1))); | 401 | roots32[i] = SAMPLE (cos ((M_PI / 16) * (i + 1))); |
402 | 402 | ||
403 | printf("static sample_t roots32[7]={"); | 403 | printf("static sample_t roots32[7]={"); |
404 | for (i=0;i<7;i++) { printf("%d%s",roots32[i],(i < 6 ? "," : "")); } | 404 | for (i=0;i<7;i++) { printf("%d%s",roots32[i],(i < 6 ? "," : "")); } |
405 | printf("};\n"); | 405 | printf("};\n"); |
406 | 406 | ||
407 | for (i = 0; i < 15; i++) | 407 | for (i = 0; i < 15; i++) |
408 | roots64[i] = SAMPLE (cos ((M_PI / 32) * (i + 1))); | 408 | roots64[i] = SAMPLE (cos ((M_PI / 32) * (i + 1))); |
409 | 409 | ||
410 | printf("static sample_t roots64[15]={"); | 410 | printf("static sample_t roots64[15]={"); |
411 | for (i=0;i<15;i++) { printf("%d%s",roots64[i],(i < 14 ? "," : "")); } | 411 | for (i=0;i<15;i++) { printf("%d%s",roots64[i],(i < 14 ? "," : "")); } |
412 | printf("};\n"); | 412 | printf("};\n"); |
413 | 413 | ||
414 | for (i = 0; i < 31; i++) | 414 | for (i = 0; i < 31; i++) |
415 | roots128[i] = SAMPLE (cos ((M_PI / 64) * (i + 1))); | 415 | roots128[i] = SAMPLE (cos ((M_PI / 64) * (i + 1))); |
416 | 416 | ||
417 | printf("static sample_t roots128[31]={"); | 417 | printf("static sample_t roots128[31]={"); |
418 | for (i=0;i<31;i++) { printf("%d%s",roots128[i],(i < 30 ? "," : "")); } | 418 | for (i=0;i<31;i++) { printf("%d%s",roots128[i],(i < 30 ? "," : "")); } |
@@ -420,15 +420,15 @@ void a52_imdct_init (uint32_t mm_accel) | |||
420 | */ | 420 | */ |
421 | /* | 421 | /* |
422 | for (i = 0; i < 64; i++) { | 422 | for (i = 0; i < 64; i++) { |
423 | k = fftorder[i] / 2 + 64; | 423 | k = fftorder[i] / 2 + 64; |
424 | pre1[i].real = SAMPLE (cos ((M_PI / 256) * (k - 0.25))); | 424 | pre1[i].real = SAMPLE (cos ((M_PI / 256) * (k - 0.25))); |
425 | pre1[i].imag = SAMPLE (sin ((M_PI / 256) * (k - 0.25))); | 425 | pre1[i].imag = SAMPLE (sin ((M_PI / 256) * (k - 0.25))); |
426 | } | 426 | } |
427 | 427 | ||
428 | for (i = 64; i < 128; i++) { | 428 | for (i = 64; i < 128; i++) { |
429 | k = fftorder[i] / 2 + 64; | 429 | k = fftorder[i] / 2 + 64; |
430 | pre1[i].real = SAMPLE (-cos ((M_PI / 256) * (k - 0.25))); | 430 | pre1[i].real = SAMPLE (-cos ((M_PI / 256) * (k - 0.25))); |
431 | pre1[i].imag = SAMPLE (-sin ((M_PI / 256) * (k - 0.25))); | 431 | pre1[i].imag = SAMPLE (-sin ((M_PI / 256) * (k - 0.25))); |
432 | } | 432 | } |
433 | 433 | ||
434 | printf("static complex_t pre1[128]={"); | 434 | printf("static complex_t pre1[128]={"); |
@@ -437,8 +437,8 @@ void a52_imdct_init (uint32_t mm_accel) | |||
437 | */ | 437 | */ |
438 | /* | 438 | /* |
439 | for (i = 0; i < 64; i++) { | 439 | for (i = 0; i < 64; i++) { |
440 | post1[i].real = SAMPLE (cos ((M_PI / 256) * (i + 0.5))); | 440 | post1[i].real = SAMPLE (cos ((M_PI / 256) * (i + 0.5))); |
441 | post1[i].imag = SAMPLE (sin ((M_PI / 256) * (i + 0.5))); | 441 | post1[i].imag = SAMPLE (sin ((M_PI / 256) * (i + 0.5))); |
442 | } | 442 | } |
443 | 443 | ||
444 | printf("static complex_t post1[64]={"); | 444 | printf("static complex_t post1[64]={"); |
@@ -448,9 +448,9 @@ void a52_imdct_init (uint32_t mm_accel) | |||
448 | 448 | ||
449 | /* | 449 | /* |
450 | for (i = 0; i < 64; i++) { | 450 | for (i = 0; i < 64; i++) { |
451 | k = fftorder[i] / 4; | 451 | k = fftorder[i] / 4; |
452 | pre2[i].real = SAMPLE (cos ((M_PI / 128) * (k - 0.25))); | 452 | pre2[i].real = SAMPLE (cos ((M_PI / 128) * (k - 0.25))); |
453 | pre2[i].imag = SAMPLE (sin ((M_PI / 128) * (k - 0.25))); | 453 | pre2[i].imag = SAMPLE (sin ((M_PI / 128) * (k - 0.25))); |
454 | } | 454 | } |
455 | 455 | ||
456 | printf("static complex_t pre2[64]={"); | 456 | printf("static complex_t pre2[64]={"); |
@@ -458,8 +458,8 @@ void a52_imdct_init (uint32_t mm_accel) | |||
458 | printf("};\n"); | 458 | printf("};\n"); |
459 | 459 | ||
460 | for (i = 0; i < 32; i++) { | 460 | for (i = 0; i < 32; i++) { |
461 | post2[i].real = SAMPLE (cos ((M_PI / 128) * (i + 0.5))); | 461 | post2[i].real = SAMPLE (cos ((M_PI / 128) * (i + 0.5))); |
462 | post2[i].imag = SAMPLE (sin ((M_PI / 128) * (i + 0.5))); | 462 | post2[i].imag = SAMPLE (sin ((M_PI / 128) * (i + 0.5))); |
463 | } | 463 | } |
464 | 464 | ||
465 | printf("static complex_t post2[32]={"); | 465 | printf("static complex_t post2[32]={"); |
@@ -470,17 +470,17 @@ void a52_imdct_init (uint32_t mm_accel) | |||
470 | #ifdef LIBA52_DJBFFT | 470 | #ifdef LIBA52_DJBFFT |
471 | if (mm_accel & MM_ACCEL_DJBFFT) { | 471 | if (mm_accel & MM_ACCEL_DJBFFT) { |
472 | #ifndef LIBA52_DOUBLE | 472 | #ifndef LIBA52_DOUBLE |
473 | ifft128 = (void (*) (complex_t *)) fftc4_un128; | 473 | ifft128 = (void (*) (complex_t *)) fftc4_un128; |
474 | ifft64 = (void (*) (complex_t *)) fftc4_un64; | 474 | ifft64 = (void (*) (complex_t *)) fftc4_un64; |
475 | #else | 475 | #else |
476 | ifft128 = (void (*) (complex_t *)) fftc8_un128; | 476 | ifft128 = (void (*) (complex_t *)) fftc8_un128; |
477 | ifft64 = (void (*) (complex_t *)) fftc8_un64; | 477 | ifft64 = (void (*) (complex_t *)) fftc8_un64; |
478 | #endif | 478 | #endif |
479 | } else | 479 | } else |
480 | #endif | 480 | #endif |
481 | { | 481 | { |
482 | ifft128 = ifft128_c; | 482 | ifft128 = ifft128_c; |
483 | ifft64 = ifft64_c; | 483 | ifft64 = ifft64_c; |
484 | } | 484 | } |
485 | */ | 485 | */ |
486 | } | 486 | } |