summaryrefslogtreecommitdiff
path: root/apps/codecs/liba52/imdct.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/liba52/imdct.c')
-rw-r--r--apps/codecs/liba52/imdct.c73
1 files changed, 59 insertions, 14 deletions
diff --git a/apps/codecs/liba52/imdct.c b/apps/codecs/liba52/imdct.c
index 1cb3814907..4d5a6ca223 100644
--- a/apps/codecs/liba52/imdct.c
+++ b/apps/codecs/liba52/imdct.c
@@ -58,18 +58,19 @@ static uint8_t fftorder[] = {
58}; 58};
59 59
60/* Root values for IFFT */ 60/* Root values for IFFT */
61static sample_t roots16[3]; 61//static sample_t roots16[3];
62static sample_t roots32[7]; 62//static sample_t roots32[7];
63static sample_t roots64[15]; 63//static sample_t roots64[15];
64static sample_t roots128[31]; 64//static sample_t roots128[31];
65 65
66/* Twiddle factors for IMDCT */ 66/* Twiddle factors for IMDCT */
67static complex_t pre1[128]; 67//static complex_t pre1[128];
68static complex_t post1[64]; 68//static complex_t post1[64];
69static complex_t pre2[64]; 69//static complex_t pre2[64];
70static complex_t post2[32]; 70//static complex_t post2[32];
71 71
72static sample_t a52_imdct_window[256]; 72//static sample_t a52_imdct_window[256];
73#include "imdct_lookups.h"
73 74
74static void (* ifft128) (complex_t * buf); 75static void (* ifft128) (complex_t * buf);
75static void (* ifft64) (complex_t * buf); 76static void (* ifft64) (complex_t * buf);
@@ -358,31 +359,55 @@ static double besselI0 (double x)
358void a52_imdct_init (uint32_t mm_accel) 359void a52_imdct_init (uint32_t mm_accel)
359{ 360{
360 int i, k; 361 int i, k;
361 double sum; 362/* double sum;
362 double local_imdct_window[256]; 363 double local_imdct_window[256];*/
363 364
364 /* compute imdct window - kaiser-bessel derived window, alpha = 5.0 */ 365 /* compute imdct window - kaiser-bessel derived window, alpha = 5.0 */
365 sum = 0; 366 /* sum = 0;
366 for (i = 0; i < 256; i++) { 367 for (i = 0; i < 256; i++) {
367 sum += besselI0 (i * (256 - i) * (5 * M_PI / 256) * (5 * M_PI / 256)); 368 sum += besselI0 (i * (256 - i) * (5 * M_PI / 256) * (5 * M_PI / 256));
368 local_imdct_window[i] = sum; 369 local_imdct_window[i] = sum;
369 } 370 }
370 sum++; 371 sum++;
371 for (i = 0; i < 256; i++) 372 */
373 /* for (i = 0; i < 256; i++)
372 a52_imdct_window[i] = SAMPLE (sqrt (local_imdct_window[i] / sum)); 374 a52_imdct_window[i] = SAMPLE (sqrt (local_imdct_window[i] / sum));
373 375
374 for (i = 0; i < 3; i++) 376 printf("static sample_t a52_imdct_window[256]={");
377 for (i=0;i<256;i++) {
378 if ((i % 16)==0) { printf("\n"); }
379 printf("%d,",a52_imdct_window[i]);
380 }
381 printf("\n}\n");
382 */
383
384 /* for (i = 0; i < 3; i++)
375 roots16[i] = SAMPLE (cos ((M_PI / 8) * (i + 1))); 385 roots16[i] = SAMPLE (cos ((M_PI / 8) * (i + 1)));
376 386
387 printf("static sample_t roots16[3]={%d,%d,%d};\n\n",roots16[0],roots16[1],roots16[2]);
388
377 for (i = 0; i < 7; i++) 389 for (i = 0; i < 7; i++)
378 roots32[i] = SAMPLE (cos ((M_PI / 16) * (i + 1))); 390 roots32[i] = SAMPLE (cos ((M_PI / 16) * (i + 1)));
379 391
392 printf("static sample_t roots32[7]={");
393 for (i=0;i<7;i++) { printf("%d%s",roots32[i],(i < 6 ? "," : "")); }
394 printf("};\n");
395
380 for (i = 0; i < 15; i++) 396 for (i = 0; i < 15; i++)
381 roots64[i] = SAMPLE (cos ((M_PI / 32) * (i + 1))); 397 roots64[i] = SAMPLE (cos ((M_PI / 32) * (i + 1)));
382 398
399 printf("static sample_t roots64[15]={");
400 for (i=0;i<15;i++) { printf("%d%s",roots64[i],(i < 14 ? "," : "")); }
401 printf("};\n");
402
383 for (i = 0; i < 31; i++) 403 for (i = 0; i < 31; i++)
384 roots128[i] = SAMPLE (cos ((M_PI / 64) * (i + 1))); 404 roots128[i] = SAMPLE (cos ((M_PI / 64) * (i + 1)));
385 405
406 printf("static sample_t roots128[31]={");
407 for (i=0;i<31;i++) { printf("%d%s",roots128[i],(i < 30 ? "," : "")); }
408 printf("};\n");
409 */
410 /*
386 for (i = 0; i < 64; i++) { 411 for (i = 0; i < 64; i++) {
387 k = fftorder[i] / 2 + 64; 412 k = fftorder[i] / 2 + 64;
388 pre1[i].real = SAMPLE (cos ((M_PI / 256) * (k - 0.25))); 413 pre1[i].real = SAMPLE (cos ((M_PI / 256) * (k - 0.25)));
@@ -395,22 +420,42 @@ void a52_imdct_init (uint32_t mm_accel)
395 pre1[i].imag = SAMPLE (-sin ((M_PI / 256) * (k - 0.25))); 420 pre1[i].imag = SAMPLE (-sin ((M_PI / 256) * (k - 0.25)));
396 } 421 }
397 422
423 printf("static complex_t pre1[128]={");
424 for (i=0;i<128;i++) { printf("{%d,%d}%s",pre1[i].real,pre1[i].imag,(i < 127 ? "," : "")); }
425 printf("};\n");
426 */
427 /*
398 for (i = 0; i < 64; i++) { 428 for (i = 0; i < 64; i++) {
399 post1[i].real = SAMPLE (cos ((M_PI / 256) * (i + 0.5))); 429 post1[i].real = SAMPLE (cos ((M_PI / 256) * (i + 0.5)));
400 post1[i].imag = SAMPLE (sin ((M_PI / 256) * (i + 0.5))); 430 post1[i].imag = SAMPLE (sin ((M_PI / 256) * (i + 0.5)));
401 } 431 }
402 432
433 printf("static complex_t post1[64]={");
434 for (i=0;i<64;i++) { printf("{%d,%d}%s",post1[i].real,post1[i].imag,(i < 63 ? "," : "")); }
435 printf("};\n");
436 */
437
438 /*
403 for (i = 0; i < 64; i++) { 439 for (i = 0; i < 64; i++) {
404 k = fftorder[i] / 4; 440 k = fftorder[i] / 4;
405 pre2[i].real = SAMPLE (cos ((M_PI / 128) * (k - 0.25))); 441 pre2[i].real = SAMPLE (cos ((M_PI / 128) * (k - 0.25)));
406 pre2[i].imag = SAMPLE (sin ((M_PI / 128) * (k - 0.25))); 442 pre2[i].imag = SAMPLE (sin ((M_PI / 128) * (k - 0.25)));
407 } 443 }
408 444
445 printf("static complex_t pre2[64]={");
446 for (i=0;i<64;i++) { printf("{%d,%d}%s",pre2[i].real,pre2[i].imag,(i < 63 ? "," : "")); }
447 printf("};\n");
448
409 for (i = 0; i < 32; i++) { 449 for (i = 0; i < 32; i++) {
410 post2[i].real = SAMPLE (cos ((M_PI / 128) * (i + 0.5))); 450 post2[i].real = SAMPLE (cos ((M_PI / 128) * (i + 0.5)));
411 post2[i].imag = SAMPLE (sin ((M_PI / 128) * (i + 0.5))); 451 post2[i].imag = SAMPLE (sin ((M_PI / 128) * (i + 0.5)));
412 } 452 }
413 453
454 printf("static complex_t post2[32]={");
455 for (i=0;i<32;i++) { printf("{%d,%d}%s",post2[i].real,post2[i].imag,(i < 31 ? "," : "")); }
456 printf("};\n");
457 */
458
414#ifdef LIBA52_DJBFFT 459#ifdef LIBA52_DJBFFT
415 if (mm_accel & MM_ACCEL_DJBFFT) { 460 if (mm_accel & MM_ACCEL_DJBFFT) {
416#ifndef LIBA52_DOUBLE 461#ifndef LIBA52_DOUBLE