Revision 06d01188 libavcodec/mpegaudiodec.c

View differences:

libavcodec/mpegaudiodec.c
67 67
#include "mpegaudiodata.h"
68 68
#include "mpegaudiodectab.h"
69 69

  
70
#if CONFIG_FLOAT
71
#    include "fft.h"
72
#else
73
#    include "dct32.c"
74
#endif
75

  
70 76
static void compute_antialias_integer(MPADecodeContext *s, GranuleDef *g);
71 77
static void compute_antialias_float(MPADecodeContext *s, GranuleDef *g);
72 78
static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window,
......
349 355
                    scale_factor_mult[i][2]);
350 356
        }
351 357

  
358
#if CONFIG_FLOAT
359
        ff_dct_init(&s->dct, 5, DCT_II);
360
#endif
352 361
        RENAME(ff_mpa_synth_init)(RENAME(ff_mpa_synth_window));
353 362

  
354 363
        /* huffman decode tables */
......
512 521
    return 0;
513 522
}
514 523

  
515
/* tab[i][j] = 1.0 / (2.0 * cos(pi*(2*k+1) / 2^(6 - j))) */
516

  
517
/* cos(i*pi/64) */
518

  
519
#define COS0_0  FIXHR(0.50060299823519630134/2)
520
#define COS0_1  FIXHR(0.50547095989754365998/2)
521
#define COS0_2  FIXHR(0.51544730992262454697/2)
522
#define COS0_3  FIXHR(0.53104259108978417447/2)
523
#define COS0_4  FIXHR(0.55310389603444452782/2)
524
#define COS0_5  FIXHR(0.58293496820613387367/2)
525
#define COS0_6  FIXHR(0.62250412303566481615/2)
526
#define COS0_7  FIXHR(0.67480834145500574602/2)
527
#define COS0_8  FIXHR(0.74453627100229844977/2)
528
#define COS0_9  FIXHR(0.83934964541552703873/2)
529
#define COS0_10 FIXHR(0.97256823786196069369/2)
530
#define COS0_11 FIXHR(1.16943993343288495515/4)
531
#define COS0_12 FIXHR(1.48416461631416627724/4)
532
#define COS0_13 FIXHR(2.05778100995341155085/8)
533
#define COS0_14 FIXHR(3.40760841846871878570/8)
534
#define COS0_15 FIXHR(10.19000812354805681150/32)
535

  
536
#define COS1_0 FIXHR(0.50241928618815570551/2)
537
#define COS1_1 FIXHR(0.52249861493968888062/2)
538
#define COS1_2 FIXHR(0.56694403481635770368/2)
539
#define COS1_3 FIXHR(0.64682178335999012954/2)
540
#define COS1_4 FIXHR(0.78815462345125022473/2)
541
#define COS1_5 FIXHR(1.06067768599034747134/4)
542
#define COS1_6 FIXHR(1.72244709823833392782/4)
543
#define COS1_7 FIXHR(5.10114861868916385802/16)
544

  
545
#define COS2_0 FIXHR(0.50979557910415916894/2)
546
#define COS2_1 FIXHR(0.60134488693504528054/2)
547
#define COS2_2 FIXHR(0.89997622313641570463/2)
548
#define COS2_3 FIXHR(2.56291544774150617881/8)
549

  
550
#define COS3_0 FIXHR(0.54119610014619698439/2)
551
#define COS3_1 FIXHR(1.30656296487637652785/4)
552

  
553
#define COS4_0 FIXHR(0.70710678118654752439/2)
554

  
555
/* butterfly operator */
556
#define BF(a, b, c, s)\
557
{\
558
    tmp0 = val##a + val##b;\
559
    tmp1 = val##a - val##b;\
560
    val##a = tmp0;\
561
    val##b = MULH3(tmp1, c, 1<<(s));\
562
}
563

  
564
#define BF0(a, b, c, s)\
565
{\
566
    tmp0 = tab[a] + tab[b];\
567
    tmp1 = tab[a] - tab[b];\
568
    val##a = tmp0;\
569
    val##b = MULH3(tmp1, c, 1<<(s));\
570
}
571

  
572
#define BF1(a, b, c, d)\
573
{\
574
    BF(a, b, COS4_0, 1);\
575
    BF(c, d,-COS4_0, 1);\
576
    val##c += val##d;\
577
}
578

  
579
#define BF2(a, b, c, d)\
580
{\
581
    BF(a, b, COS4_0, 1);\
582
    BF(c, d,-COS4_0, 1);\
583
    val##c += val##d;\
584
    val##a += val##c;\
585
    val##c += val##b;\
586
    val##b += val##d;\
587
}
588

  
589
#define ADD(a, b) val##a += val##b
590

  
591
/* DCT32 without 1/sqrt(2) coef zero scaling. */
592
static void dct32(INTFLOAT *out, const INTFLOAT *tab)
593
{
594
    INTFLOAT tmp0, tmp1;
595

  
596
    INTFLOAT val0 , val1 , val2 , val3 , val4 , val5 , val6 , val7 ,
597
             val8 , val9 , val10, val11, val12, val13, val14, val15,
598
             val16, val17, val18, val19, val20, val21, val22, val23,
599
             val24, val25, val26, val27, val28, val29, val30, val31;
600

  
601
    /* pass 1 */
602
    BF0( 0, 31, COS0_0 , 1);
603
    BF0(15, 16, COS0_15, 5);
604
    /* pass 2 */
605
    BF( 0, 15, COS1_0 , 1);
606
    BF(16, 31,-COS1_0 , 1);
607
    /* pass 1 */
608
    BF0( 7, 24, COS0_7 , 1);
609
    BF0( 8, 23, COS0_8 , 1);
610
    /* pass 2 */
611
    BF( 7,  8, COS1_7 , 4);
612
    BF(23, 24,-COS1_7 , 4);
613
    /* pass 3 */
614
    BF( 0,  7, COS2_0 , 1);
615
    BF( 8, 15,-COS2_0 , 1);
616
    BF(16, 23, COS2_0 , 1);
617
    BF(24, 31,-COS2_0 , 1);
618
    /* pass 1 */
619
    BF0( 3, 28, COS0_3 , 1);
620
    BF0(12, 19, COS0_12, 2);
621
    /* pass 2 */
622
    BF( 3, 12, COS1_3 , 1);
623
    BF(19, 28,-COS1_3 , 1);
624
    /* pass 1 */
625
    BF0( 4, 27, COS0_4 , 1);
626
    BF0(11, 20, COS0_11, 2);
627
    /* pass 2 */
628
    BF( 4, 11, COS1_4 , 1);
629
    BF(20, 27,-COS1_4 , 1);
630
    /* pass 3 */
631
    BF( 3,  4, COS2_3 , 3);
632
    BF(11, 12,-COS2_3 , 3);
633
    BF(19, 20, COS2_3 , 3);
634
    BF(27, 28,-COS2_3 , 3);
635
    /* pass 4 */
636
    BF( 0,  3, COS3_0 , 1);
637
    BF( 4,  7,-COS3_0 , 1);
638
    BF( 8, 11, COS3_0 , 1);
639
    BF(12, 15,-COS3_0 , 1);
640
    BF(16, 19, COS3_0 , 1);
641
    BF(20, 23,-COS3_0 , 1);
642
    BF(24, 27, COS3_0 , 1);
643
    BF(28, 31,-COS3_0 , 1);
644

  
645

  
646

  
647
    /* pass 1 */
648
    BF0( 1, 30, COS0_1 , 1);
649
    BF0(14, 17, COS0_14, 3);
650
    /* pass 2 */
651
    BF( 1, 14, COS1_1 , 1);
652
    BF(17, 30,-COS1_1 , 1);
653
    /* pass 1 */
654
    BF0( 6, 25, COS0_6 , 1);
655
    BF0( 9, 22, COS0_9 , 1);
656
    /* pass 2 */
657
    BF( 6,  9, COS1_6 , 2);
658
    BF(22, 25,-COS1_6 , 2);
659
    /* pass 3 */
660
    BF( 1,  6, COS2_1 , 1);
661
    BF( 9, 14,-COS2_1 , 1);
662
    BF(17, 22, COS2_1 , 1);
663
    BF(25, 30,-COS2_1 , 1);
664

  
665
    /* pass 1 */
666
    BF0( 2, 29, COS0_2 , 1);
667
    BF0(13, 18, COS0_13, 3);
668
    /* pass 2 */
669
    BF( 2, 13, COS1_2 , 1);
670
    BF(18, 29,-COS1_2 , 1);
671
    /* pass 1 */
672
    BF0( 5, 26, COS0_5 , 1);
673
    BF0(10, 21, COS0_10, 1);
674
    /* pass 2 */
675
    BF( 5, 10, COS1_5 , 2);
676
    BF(21, 26,-COS1_5 , 2);
677
    /* pass 3 */
678
    BF( 2,  5, COS2_2 , 1);
679
    BF(10, 13,-COS2_2 , 1);
680
    BF(18, 21, COS2_2 , 1);
681
    BF(26, 29,-COS2_2 , 1);
682
    /* pass 4 */
683
    BF( 1,  2, COS3_1 , 2);
684
    BF( 5,  6,-COS3_1 , 2);
685
    BF( 9, 10, COS3_1 , 2);
686
    BF(13, 14,-COS3_1 , 2);
687
    BF(17, 18, COS3_1 , 2);
688
    BF(21, 22,-COS3_1 , 2);
689
    BF(25, 26, COS3_1 , 2);
690
    BF(29, 30,-COS3_1 , 2);
691

  
692
    /* pass 5 */
693
    BF1( 0,  1,  2,  3);
694
    BF2( 4,  5,  6,  7);
695
    BF1( 8,  9, 10, 11);
696
    BF2(12, 13, 14, 15);
697
    BF1(16, 17, 18, 19);
698
    BF2(20, 21, 22, 23);
699
    BF1(24, 25, 26, 27);
700
    BF2(28, 29, 30, 31);
701

  
702
    /* pass 6 */
703

  
704
    ADD( 8, 12);
705
    ADD(12, 10);
706
    ADD(10, 14);
707
    ADD(14,  9);
708
    ADD( 9, 13);
709
    ADD(13, 11);
710
    ADD(11, 15);
711

  
712
    out[ 0] = val0;
713
    out[16] = val1;
714
    out[ 8] = val2;
715
    out[24] = val3;
716
    out[ 4] = val4;
717
    out[20] = val5;
718
    out[12] = val6;
719
    out[28] = val7;
720
    out[ 2] = val8;
721
    out[18] = val9;
722
    out[10] = val10;
723
    out[26] = val11;
724
    out[ 6] = val12;
725
    out[22] = val13;
726
    out[14] = val14;
727
    out[30] = val15;
728

  
729
    ADD(24, 28);
730
    ADD(28, 26);
731
    ADD(26, 30);
732
    ADD(30, 25);
733
    ADD(25, 29);
734
    ADD(29, 27);
735
    ADD(27, 31);
736

  
737
    out[ 1] = val16 + val24;
738
    out[17] = val17 + val25;
739
    out[ 9] = val18 + val26;
740
    out[25] = val19 + val27;
741
    out[ 5] = val20 + val28;
742
    out[21] = val21 + val29;
743
    out[13] = val22 + val30;
744
    out[29] = val23 + val31;
745
    out[ 3] = val24 + val20;
746
    out[19] = val25 + val21;
747
    out[11] = val26 + val22;
748
    out[27] = val27 + val23;
749
    out[ 7] = val28 + val18;
750
    out[23] = val29 + val19;
751
    out[15] = val30 + val17;
752
    out[31] = val31;
753
}
754 524

  
755 525
#if CONFIG_FLOAT
756 526
static inline float round_sample(float *sum)

Also available in: Unified diff