Advertisement
Guest User

Untitled

a guest
Dec 18th, 2009
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 29.24 KB | None | 0 0
  1. nt codec_init(void);
  2. void codec_set_replaygain(struct mp3entry* id3);
  3. # 36 "/home/mike/rockbox/mdct/apps/codecs/lib/fft-ffmpeg.c" 2
  4. # 1 "/home/mike/rockbox/mdct/apps/codecs/lib/mdct_lookup.h" 1
  5. # 19 "/home/mike/rockbox/mdct/apps/codecs/lib/mdct_lookup.h"
  6. extern const int sincos_lookup0[1026];
  7. extern const int sincos_lookup1[1024];
  8. # 41 "/home/mike/rockbox/mdct/apps/codecs/lib/fft-ffmpeg.c" 2
  9. static void ff_fft_permute_c(FFTContext *s, FFTComplex *z);
  10. # 52 "/home/mike/rockbox/mdct/apps/codecs/lib/fft-ffmpeg.c"
  11. int muls, adds;
  12. # 79 "/home/mike/rockbox/mdct/apps/codecs/lib/fft-ffmpeg.c"
  13. unsigned short revtab[1<
  14. <
  15. 12];
  16. static _Bool revtab_initialised = 0;
  17. static int split_radix_permutation(int i, int n, int inverse)
  18. {
  19.     int m;
  20.     if(n <
  21.     = 2) return i&1;
  22.     m = n >
  23.     >
  24.     1;
  25.     if(!(i&m)) return split_radix_permutation(i, m, inverse)*2;
  26.     m >
  27.     >
  28.     = 1;
  29.     if(inverse == !(i&m)) return split_radix_permutation(i, m, inverse)*4 + 1;
  30.     else return split_radix_permutation(i, m, inverse)*4 - 1;
  31. }
  32. int ff_fft_init(void *arg_s, int nbits, int inverse)
  33. {
  34.     int i, n;
  35.     FFTContext *s = (FFTContext *)(arg_s);
  36.     if (nbits <
  37.     2 || nbits >
  38.     12)
  39.     return -1;
  40.     s->
  41.     nbits = nbits;
  42.     n = 1 <
  43.     <
  44.     nbits;
  45.     s->
  46.     revtab = revtab;
  47.     s->
  48.     inverse = inverse;
  49.     s->
  50.     fft_permute = ff_fft_permute_c;
  51.     s->
  52.     fft_calc = ff_fft_calc_c;
  53.     s->
  54.     split_radix = 1;
  55.     # 156 "/home/mike/rockbox/mdct/apps/codecs/lib/fft-ffmpeg.c"
  56.     if( !revtab_initialised )
  57.     {
  58.         const int MAX_REVTAB=1<
  59.         <
  60.         12;
  61.         for(i=0; i<MAX_REVTAB ; i++)
  62.         s->
  63.         revtab[-split_radix_permutation(i, MAX_REVTAB, s->
  64.         inverse) & (MAX_REVTAB-1)] = i;
  65.         revtab_initialised = 1;
  66.     }
  67.     return 0;
  68. }
  69. static void ff_fft_permute_c(FFTContext *s, FFTComplex *z)
  70. {
  71.     int j, k, np;
  72.     FFTComplex tmp;
  73.     const unsigned short *revtab = s->
  74.     revtab;
  75.     np = 1 <
  76.     <
  77.     s->
  78.     nbits;
  79.     const int revtab_shift = (12 - s->
  80.     nbits);
  81.     for(j=0;j<np;j++) {
  82.         k = revtab[j]>
  83.         >
  84.         revtab_shift;
  85.         if (k <
  86.         j) {
  87.             tmp = z[k];
  88.             z[k] = z[j];
  89.             z[j] = tmp;
  90.         }
  91.     }
  92. }
  93. # 316 "/home/mike/rockbox/mdct/apps/codecs/lib/fft-ffmpeg.c"
  94. static void pass(FFTComplex *z, unsigned int STEP, unsigned int n){
  95.     FFTSample t1, t2, t3, t4, t5, t6;
  96.     int o1 = 2*n;
  97.     int o2 = 4*n;
  98.     int o3 = 6*n;
  99.     muls += 3;
  100.     const FFTSample *wim = sincos_lookup0+STEP;
  101.     const FFTSample *w_end = sincos_lookup0+1024;
  102.     adds += 2;
  103.     {
  104.         t1 = z[o2].re;
  105.         t2 = z[o2].im;
  106.         t5 = z[o3].re;
  107.         t6 = z[o3].im;
  108.         {
  109.             {
  110.                 t3 = t5 - t1;
  111.                 t5 = t5 + t1;
  112.                 adds += 2;
  113.             }
  114.             ;
  115.             {
  116.                 z[o2].re = z[0].re - t5;
  117.                 z[0].re = z[0].re + t5;
  118.                 adds += 2;
  119.             }
  120.             ;
  121.             {
  122.                 z[o3].im = z[o1].im - t3;
  123.                 z[o1].im = z[o1].im + t3;
  124.                 adds += 2;
  125.             }
  126.             ;
  127.             {
  128.                 t4 = t2 - t6;
  129.                 t6 = t2 + t6;
  130.                 adds += 2;
  131.             }
  132.             ;
  133.             {
  134.                 z[o3].re = z[o1].re - t4;
  135.                 z[o1].re = z[o1].re + t4;
  136.                 adds += 2;
  137.             }
  138.             ;
  139.             {
  140.                 z[o2].im = z[0].im - t6;
  141.                 z[0].im = z[0].im + t6;
  142.                 adds += 2;
  143.             }
  144.             ;
  145.         }
  146.     }
  147.     ;
  148.     {
  149.         t1 = fixmul32b(z[o2+1].re, wim[1]) + fixmul32b(z[o2+1].im, wim[0]);
  150.         t2 = fixmul32b(z[o2+1].im, wim[1]) - fixmul32b(z[o2+1].re, wim[0]);
  151.         t5 = fixmul32b(z[o3+1].re, wim[1]) - fixmul32b(z[o3+1].im, wim[0]);
  152.         t6 = fixmul32b(z[o3+1].im, wim[1]) + fixmul32b(z[o3+1].re, wim[0]);
  153.         muls += 8;
  154.         {
  155.             {
  156.                 t3 = t5 - t1;
  157.                 t5 = t5 + t1;
  158.                 adds += 2;
  159.             }
  160.             ;
  161.             {
  162.                 z[o2+1].re = z[1].re - t5;
  163.                 z[1].re = z[1].re + t5;
  164.                 adds += 2;
  165.             }
  166.             ;
  167.             {
  168.                 z[o3+1].im = z[o1+1].im - t3;
  169.                 z[o1+1].im = z[o1+1].im + t3;
  170.                 adds += 2;
  171.             }
  172.             ;
  173.             {
  174.                 t4 = t2 - t6;
  175.                 t6 = t2 + t6;
  176.                 adds += 2;
  177.             }
  178.             ;
  179.             {
  180.                 z[o3+1].re = z[o1+1].re - t4;
  181.                 z[o1+1].re = z[o1+1].re + t4;
  182.                 adds += 2;
  183.             }
  184.             ;
  185.             {
  186.                 z[o2+1].im = z[1].im - t6;
  187.                 z[1].im = z[1].im + t6;
  188.                 adds += 2;
  189.             }
  190.             ;
  191.         }
  192.     }
  193.     ;
  194.     wim += STEP;
  195.     adds += 1;
  196.     do {
  197.         z += 2;
  198.         {
  199.             t1 = fixmul32b(z[o2].re, wim[1]) + fixmul32b(z[o2].im, wim[0]);
  200.             t2 = fixmul32b(z[o2].im, wim[1]) - fixmul32b(z[o2].re, wim[0]);
  201.             t5 = fixmul32b(z[o3].re, wim[1]) - fixmul32b(z[o3].im, wim[0]);
  202.             t6 = fixmul32b(z[o3].im, wim[1]) + fixmul32b(z[o3].re, wim[0]);
  203.             muls += 8;
  204.             {
  205.                 {
  206.                     t3 = t5 - t1;
  207.                     t5 = t5 + t1;
  208.                     adds += 2;
  209.                 }
  210.                 ;
  211.                 {
  212.                     z[o2].re = z[0].re - t5;
  213.                     z[0].re = z[0].re + t5;
  214.                     adds += 2;
  215.                 }
  216.                 ;
  217.                 {
  218.                     z[o3].im = z[o1].im - t3;
  219.                     z[o1].im = z[o1].im + t3;
  220.                     adds += 2;
  221.                 }
  222.                 ;
  223.                 {
  224.                     t4 = t2 - t6;
  225.                     t6 = t2 + t6;
  226.                     adds += 2;
  227.                 }
  228.                 ;
  229.                 {
  230.                     z[o3].re = z[o1].re - t4;
  231.                     z[o1].re = z[o1].re + t4;
  232.                     adds += 2;
  233.                 }
  234.                 ;
  235.                 {
  236.                     z[o2].im = z[0].im - t6;
  237.                     z[0].im = z[0].im + t6;
  238.                     adds += 2;
  239.                 }
  240.                 ;
  241.             }
  242.         }
  243.         ;
  244.         wim += STEP;
  245.         {
  246.             t1 = fixmul32b(z[o2+1].re, wim[1]) + fixmul32b(z[o2+1].im, wim[0]);
  247.             t2 = fixmul32b(z[o2+1].im, wim[1]) - fixmul32b(z[o2+1].re, wim[0]);
  248.             t5 = fixmul32b(z[o3+1].re, wim[1]) - fixmul32b(z[o3+1].im, wim[0]);
  249.             t6 = fixmul32b(z[o3+1].im, wim[1]) + fixmul32b(z[o3+1].re, wim[0]);
  250.             muls += 8;
  251.             {
  252.                 {
  253.                     t3 = t5 - t1;
  254.                     t5 = t5 + t1;
  255.                     adds += 2;
  256.                 }
  257.                 ;
  258.                 {
  259.                     z[o2+1].re = z[1].re - t5;
  260.                     z[1].re = z[1].re + t5;
  261.                     adds += 2;
  262.                 }
  263.                 ;
  264.                 {
  265.                     z[o3+1].im = z[o1+1].im - t3;
  266.                     z[o1+1].im = z[o1+1].im + t3;
  267.                     adds += 2;
  268.                 }
  269.                 ;
  270.                 {
  271.                     t4 = t2 - t6;
  272.                     t6 = t2 + t6;
  273.                     adds += 2;
  274.                 }
  275.                 ;
  276.                 {
  277.                     z[o3+1].re = z[o1+1].re - t4;
  278.                     z[o1+1].re = z[o1+1].re + t4;
  279.                     adds += 2;
  280.                 }
  281.                 ;
  282.                 {
  283.                     z[o2+1].im = z[1].im - t6;
  284.                     z[1].im = z[1].im + t6;
  285.                     adds += 2;
  286.                 }
  287.                 ;
  288.             }
  289.         }
  290.         ;
  291.         wim += STEP;
  292.         adds += 3;
  293.     }
  294.     while(wim <
  295.     w_end);
  296.     w_end=sincos_lookup0;
  297.     while(wim>
  298.     w_end) {
  299.         z += 2;
  300.         {
  301.             t1 = fixmul32b(z[o2].re, wim[0]) + fixmul32b(z[o2].im, wim[1]);
  302.             t2 = fixmul32b(z[o2].im, wim[0]) - fixmul32b(z[o2].re, wim[1]);
  303.             t5 = fixmul32b(z[o3].re, wim[0]) - fixmul32b(z[o3].im, wim[1]);
  304.             t6 = fixmul32b(z[o3].im, wim[0]) + fixmul32b(z[o3].re, wim[1]);
  305.             muls += 8;
  306.             {
  307.                 {
  308.                     t3 = t5 - t1;
  309.                     t5 = t5 + t1;
  310.                     adds += 2;
  311.                 }
  312.                 ;
  313.                 {
  314.                     z[o2].re = z[0].re - t5;
  315.                     z[0].re = z[0].re + t5;
  316.                     adds += 2;
  317.                 }
  318.                 ;
  319.                 {
  320.                     z[o3].im = z[o1].im - t3;
  321.                     z[o1].im = z[o1].im + t3;
  322.                     adds += 2;
  323.                 }
  324.                 ;
  325.                 {
  326.                     t4 = t2 - t6;
  327.                     t6 = t2 + t6;
  328.                     adds += 2;
  329.                 }
  330.                 ;
  331.                 {
  332.                     z[o3].re = z[o1].re - t4;
  333.                     z[o1].re = z[o1].re + t4;
  334.                     adds += 2;
  335.                 }
  336.                 ;
  337.                 {
  338.                     z[o2].im = z[0].im - t6;
  339.                     z[0].im = z[0].im + t6;
  340.                     adds += 2;
  341.                 }
  342.                 ;
  343.             }
  344.         }
  345.         ;
  346.         wim -= STEP;
  347.         {
  348.             t1 = fixmul32b(z[o2+1].re, wim[0]) + fixmul32b(z[o2+1].im, wim[1]);
  349.             t2 = fixmul32b(z[o2+1].im, wim[0]) - fixmul32b(z[o2+1].re, wim[1]);
  350.             t5 = fixmul32b(z[o3+1].re, wim[0]) - fixmul32b(z[o3+1].im, wim[1]);
  351.             t6 = fixmul32b(z[o3+1].im, wim[0]) + fixmul32b(z[o3+1].re, wim[1]);
  352.             muls += 8;
  353.             {
  354.                 {
  355.                     t3 = t5 - t1;
  356.                     t5 = t5 + t1;
  357.                     adds += 2;
  358.                 }
  359.                 ;
  360.                 {
  361.                     z[o2+1].re = z[1].re - t5;
  362.                     z[1].re = z[1].re + t5;
  363.                     adds += 2;
  364.                 }
  365.                 ;
  366.                 {
  367.                     z[o3+1].im = z[o1+1].im - t3;
  368.                     z[o1+1].im = z[o1+1].im + t3;
  369.                     adds += 2;
  370.                 }
  371.                 ;
  372.                 {
  373.                     t4 = t2 - t6;
  374.                     t6 = t2 + t6;
  375.                     adds += 2;
  376.                 }
  377.                 ;
  378.                 {
  379.                     z[o3+1].re = z[o1+1].re - t4;
  380.                     z[o1+1].re = z[o1+1].re + t4;
  381.                     adds += 2;
  382.                 }
  383.                 ;
  384.                 {
  385.                     z[o2+1].im = z[1].im - t6;
  386.                     z[1].im = z[1].im + t6;
  387.                     adds += 2;
  388.                 }
  389.                 ;
  390.             }
  391.         }
  392.         ;
  393.         wim -= STEP;
  394.         adds += 3;
  395.     }
  396. }
  397. static void pass_big(FFTComplex *z, unsigned int STEP, unsigned int n){
  398.     FFTSample t1, t2, t3, t4, t5, t6;
  399.     int o1 = 2*n;
  400.     int o2 = 4*n;
  401.     int o3 = 6*n;
  402.     muls += 3;
  403.     const FFTSample *wim = sincos_lookup0+STEP;
  404.     const FFTSample *w_end = sincos_lookup0+1024;
  405.     adds += 2;
  406.     {
  407.         t1 = z[o2].re;
  408.         t2 = z[o2].im;
  409.         t5 = z[o3].re;
  410.         t6 = z[o3].im;
  411.         {
  412.             FFTSample r0=z[0].re, i0=z[0].im, r1=z[o1].re, i1=z[o1].im;
  413.             {
  414.                 t3 = t5 - t1;
  415.                 t5 = t5 + t1;
  416.                 adds += 2;
  417.             }
  418.             ;
  419.             {
  420.                 z[o2].re = r0 - t5;
  421.                 z[0].re = r0 + t5;
  422.                 adds += 2;
  423.             }
  424.             ;
  425.             {
  426.                 z[o3].im = i1 - t3;
  427.                 z[o1].im = i1 + t3;
  428.                 adds += 2;
  429.             }
  430.             ;
  431.             {
  432.                 t4 = t2 - t6;
  433.                 t6 = t2 + t6;
  434.                 adds += 2;
  435.             }
  436.             ;
  437.             {
  438.                 z[o3].re = r1 - t4;
  439.                 z[o1].re = r1 + t4;
  440.                 adds += 2;
  441.             }
  442.             ;
  443.             {
  444.                 z[o2].im = i0 - t6;
  445.                 z[0].im = i0 + t6;
  446.                 adds += 2;
  447.             }
  448.             ;
  449.         }
  450.     }
  451.     ;
  452.     {
  453.         t1 = fixmul32b(z[o2+1].re, wim[1]) + fixmul32b(z[o2+1].im, wim[0]);
  454.         t2 = fixmul32b(z[o2+1].im, wim[1]) - fixmul32b(z[o2+1].re, wim[0]);
  455.         t5 = fixmul32b(z[o3+1].re, wim[1]) - fixmul32b(z[o3+1].im, wim[0]);
  456.         t6 = fixmul32b(z[o3+1].im, wim[1]) + fixmul32b(z[o3+1].re, wim[0]);
  457.         muls += 8;
  458.         {
  459.             FFTSample r0=z[1].re, i0=z[1].im, r1=z[o1+1].re, i1=z[o1+1].im;
  460.             {
  461.                 t3 = t5 - t1;
  462.                 t5 = t5 + t1;
  463.                 adds += 2;
  464.             }
  465.             ;
  466.             {
  467.                 z[o2+1].re = r0 - t5;
  468.                 z[1].re = r0 + t5;
  469.                 adds += 2;
  470.             }
  471.             ;
  472.             {
  473.                 z[o3+1].im = i1 - t3;
  474.                 z[o1+1].im = i1 + t3;
  475.                 adds += 2;
  476.             }
  477.             ;
  478.             {
  479.                 t4 = t2 - t6;
  480.                 t6 = t2 + t6;
  481.                 adds += 2;
  482.             }
  483.             ;
  484.             {
  485.                 z[o3+1].re = r1 - t4;
  486.                 z[o1+1].re = r1 + t4;
  487.                 adds += 2;
  488.             }
  489.             ;
  490.             {
  491.                 z[o2+1].im = i0 - t6;
  492.                 z[1].im = i0 + t6;
  493.                 adds += 2;
  494.             }
  495.             ;
  496.         }
  497.     }
  498.     ;
  499.     wim += STEP;
  500.     adds += 1;
  501.     do {
  502.         z += 2;
  503.         {
  504.             t1 = fixmul32b(z[o2].re, wim[1]) + fixmul32b(z[o2].im, wim[0]);
  505.             t2 = fixmul32b(z[o2].im, wim[1]) - fixmul32b(z[o2].re, wim[0]);
  506.             t5 = fixmul32b(z[o3].re, wim[1]) - fixmul32b(z[o3].im, wim[0]);
  507.             t6 = fixmul32b(z[o3].im, wim[1]) + fixmul32b(z[o3].re, wim[0]);
  508.             muls += 8;
  509.             {
  510.                 FFTSample r0=z[0].re, i0=z[0].im, r1=z[o1].re, i1=z[o1].im;
  511.                 {
  512.                     t3 = t5 - t1;
  513.                     t5 = t5 + t1;
  514.                     adds += 2;
  515.                 }
  516.                 ;
  517.                 {
  518.                     z[o2].re = r0 - t5;
  519.                     z[0].re = r0 + t5;
  520.                     adds += 2;
  521.                 }
  522.                 ;
  523.                 {
  524.                     z[o3].im = i1 - t3;
  525.                     z[o1].im = i1 + t3;
  526.                     adds += 2;
  527.                 }
  528.                 ;
  529.                 {
  530.                     t4 = t2 - t6;
  531.                     t6 = t2 + t6;
  532.                     adds += 2;
  533.                 }
  534.                 ;
  535.                 {
  536.                     z[o3].re = r1 - t4;
  537.                     z[o1].re = r1 + t4;
  538.                     adds += 2;
  539.                 }
  540.                 ;
  541.                 {
  542.                     z[o2].im = i0 - t6;
  543.                     z[0].im = i0 + t6;
  544.                     adds += 2;
  545.                 }
  546.                 ;
  547.             }
  548.         }
  549.         ;
  550.         wim += STEP;
  551.         {
  552.             t1 = fixmul32b(z[o2+1].re, wim[1]) + fixmul32b(z[o2+1].im, wim[0]);
  553.             t2 = fixmul32b(z[o2+1].im, wim[1]) - fixmul32b(z[o2+1].re, wim[0]);
  554.             t5 = fixmul32b(z[o3+1].re, wim[1]) - fixmul32b(z[o3+1].im, wim[0]);
  555.             t6 = fixmul32b(z[o3+1].im, wim[1]) + fixmul32b(z[o3+1].re, wim[0]);
  556.             muls += 8;
  557.             {
  558.                 FFTSample r0=z[1].re, i0=z[1].im, r1=z[o1+1].re, i1=z[o1+1].im;
  559.                 {
  560.                     t3 = t5 - t1;
  561.                     t5 = t5 + t1;
  562.                     adds += 2;
  563.                 }
  564.                 ;
  565.                 {
  566.                     z[o2+1].re = r0 - t5;
  567.                     z[1].re = r0 + t5;
  568.                     adds += 2;
  569.                 }
  570.                 ;
  571.                 {
  572.                     z[o3+1].im = i1 - t3;
  573.                     z[o1+1].im = i1 + t3;
  574.                     adds += 2;
  575.                 }
  576.                 ;
  577.                 {
  578.                     t4 = t2 - t6;
  579.                     t6 = t2 + t6;
  580.                     adds += 2;
  581.                 }
  582.                 ;
  583.                 {
  584.                     z[o3+1].re = r1 - t4;
  585.                     z[o1+1].re = r1 + t4;
  586.                     adds += 2;
  587.                 }
  588.                 ;
  589.                 {
  590.                     z[o2+1].im = i0 - t6;
  591.                     z[1].im = i0 + t6;
  592.                     adds += 2;
  593.                 }
  594.                 ;
  595.             }
  596.         }
  597.         ;
  598.         wim += STEP;
  599.         adds += 3;
  600.     }
  601.     while(wim <
  602.     w_end);
  603.     w_end=sincos_lookup0;
  604.     while(wim>
  605.     w_end) {
  606.         z += 2;
  607.         {
  608.             t1 = fixmul32b(z[o2].re, wim[0]) + fixmul32b(z[o2].im, wim[1]);
  609.             t2 = fixmul32b(z[o2].im, wim[0]) - fixmul32b(z[o2].re, wim[1]);
  610.             t5 = fixmul32b(z[o3].re, wim[0]) - fixmul32b(z[o3].im, wim[1]);
  611.             t6 = fixmul32b(z[o3].im, wim[0]) + fixmul32b(z[o3].re, wim[1]);
  612.             muls += 8;
  613.             {
  614.                 FFTSample r0=z[0].re, i0=z[0].im, r1=z[o1].re, i1=z[o1].im;
  615.                 {
  616.                     t3 = t5 - t1;
  617.                     t5 = t5 + t1;
  618.                     adds += 2;
  619.                 }
  620.                 ;
  621.                 {
  622.                     z[o2].re = r0 - t5;
  623.                     z[0].re = r0 + t5;
  624.                     adds += 2;
  625.                 }
  626.                 ;
  627.                 {
  628.                     z[o3].im = i1 - t3;
  629.                     z[o1].im = i1 + t3;
  630.                     adds += 2;
  631.                 }
  632.                 ;
  633.                 {
  634.                     t4 = t2 - t6;
  635.                     t6 = t2 + t6;
  636.                     adds += 2;
  637.                 }
  638.                 ;
  639.                 {
  640.                     z[o3].re = r1 - t4;
  641.                     z[o1].re = r1 + t4;
  642.                     adds += 2;
  643.                 }
  644.                 ;
  645.                 {
  646.                     z[o2].im = i0 - t6;
  647.                     z[0].im = i0 + t6;
  648.                     adds += 2;
  649.                 }
  650.                 ;
  651.             }
  652.         }
  653.         ;
  654.         wim -= STEP;
  655.         {
  656.             t1 = fixmul32b(z[o2+1].re, wim[0]) + fixmul32b(z[o2+1].im, wim[1]);
  657.             t2 = fixmul32b(z[o2+1].im, wim[0]) - fixmul32b(z[o2+1].re, wim[1]);
  658.             t5 = fixmul32b(z[o3+1].re, wim[0]) - fixmul32b(z[o3+1].im, wim[1]);
  659.             t6 = fixmul32b(z[o3+1].im, wim[0]) + fixmul32b(z[o3+1].re, wim[1]);
  660.             muls += 8;
  661.             {
  662.                 FFTSample r0=z[1].re, i0=z[1].im, r1=z[o1+1].re, i1=z[o1+1].im;
  663.                 {
  664.                     t3 = t5 - t1;
  665.                     t5 = t5 + t1;
  666.                     adds += 2;
  667.                 }
  668.                 ;
  669.                 {
  670.                     z[o2+1].re = r0 - t5;
  671.                     z[1].re = r0 + t5;
  672.                     adds += 2;
  673.                 }
  674.                 ;
  675.                 {
  676.                     z[o3+1].im = i1 - t3;
  677.                     z[o1+1].im = i1 + t3;
  678.                     adds += 2;
  679.                 }
  680.                 ;
  681.                 {
  682.                     t4 = t2 - t6;
  683.                     t6 = t2 + t6;
  684.                     adds += 2;
  685.                 }
  686.                 ;
  687.                 {
  688.                     z[o3+1].re = r1 - t4;
  689.                     z[o1+1].re = r1 + t4;
  690.                     adds += 2;
  691.                 }
  692.                 ;
  693.                 {
  694.                     z[o2+1].im = i0 - t6;
  695.                     z[1].im = i0 + t6;
  696.                     adds += 2;
  697.                 }
  698.                 ;
  699.             }
  700.         }
  701.         ;
  702.         wim -= STEP;
  703.         adds += 3;
  704.     }
  705. }
  706. # 348 "/home/mike/rockbox/mdct/apps/codecs/lib/fft-ffmpeg.c"
  707. static void fft4(FFTComplex *z)
  708. {
  709.     FFTSample t1, t2, t3, t4, t5, t6, t7, t8;
  710.     {
  711.         t3 = z[0].re - z[1].re;
  712.         t1 = z[0].re + z[1].re;
  713.         adds += 2;
  714.     }
  715.     ;
  716.     {
  717.         t8 = z[3].re - z[2].re;
  718.         t6 = z[3].re + z[2].re;
  719.         adds += 2;
  720.     }
  721.     ;
  722.     {
  723.         z[2].re = t1 - t6;
  724.         z[0].re = t1 + t6;
  725.         adds += 2;
  726.     }
  727.     ;
  728.     {
  729.         t4 = z[0].im - z[1].im;
  730.         t2 = z[0].im + z[1].im;
  731.         adds += 2;
  732.     }
  733.     ;
  734.     {
  735.         t7 = z[2].im - z[3].im;
  736.         t5 = z[2].im + z[3].im;
  737.         adds += 2;
  738.     }
  739.     ;
  740.     {
  741.         z[3].im = t4 - t8;
  742.         z[1].im = t4 + t8;
  743.         adds += 2;
  744.     }
  745.     ;
  746.     {
  747.         z[3].re = t3 - t7;
  748.         z[1].re = t3 + t7;
  749.         adds += 2;
  750.     }
  751.     ;
  752.     {
  753.         z[2].im = t2 - t5;
  754.         z[0].im = t2 + t5;
  755.         adds += 2;
  756.     }
  757.     ;
  758. }
  759. static void fft8(FFTComplex *z)
  760. {
  761.     FFTSample t1, t2, t3, t4, t5, t6, t7, t8;
  762.     fft4(z);
  763.     {
  764.         t1 = z[4].re - -z[5].re;
  765.         z[5].re = z[4].re + -z[5].re;
  766.         adds += 2;
  767.     }
  768.     ;
  769.     {
  770.         t2 = z[4].im - -z[5].im;
  771.         z[5].im = z[4].im + -z[5].im;
  772.         adds += 2;
  773.     }
  774.     ;
  775.     {
  776.         t3 = z[6].re - -z[7].re;
  777.         z[7].re = z[6].re + -z[7].re;
  778.         adds += 2;
  779.     }
  780.     ;
  781.     {
  782.         t4 = z[6].im - -z[7].im;
  783.         z[7].im = z[6].im + -z[7].im;
  784.         adds += 2;
  785.     }
  786.     ;
  787.     {
  788.         t8 = t3 - t1;
  789.         t1 = t3 + t1;
  790.         adds += 2;
  791.     }
  792.     ;
  793.     {
  794.         t7 = t2 - t4;
  795.         t2 = t2 + t4;
  796.         adds += 2;
  797.     }
  798.     ;
  799.     {
  800.         z[4].re = z[0].re - t1;
  801.         z[0].re = z[0].re + t1;
  802.         adds += 2;
  803.     }
  804.     ;
  805.     {
  806.         z[4].im = z[0].im - t2;
  807.         z[0].im = z[0].im + t2;
  808.         adds += 2;
  809.     }
  810.     ;
  811.     {
  812.         z[6].re = z[2].re - t7;
  813.         z[2].re = z[2].re + t7;
  814.         adds += 2;
  815.     }
  816.     ;
  817.     {
  818.         z[6].im = z[2].im - t8;
  819.         z[2].im = z[2].im + t8;
  820.         adds += 2;
  821.     }
  822.     ;
  823.     {
  824.         t3 = fixmul32b(z[5].re, (0x5a82799a));
  825.         t4 = fixmul32b(z[5].im, (0x5a82799a));
  826.         t7 = fixmul32b(z[7].re, (0x5a82799a));
  827.         t8 = fixmul32b(z[7].im, (0x5a82799a));
  828.         t1 = ( t3 + t4 );
  829.         t2 = ( t4 - t3 );
  830.         t5 = ( t7 - t8 );
  831.         t6 = ( t8 + t7 );
  832.         {
  833.             FFTSample r0=z[1].re, i0=z[1].im, r1=z[3].re, i1=z[3].im;
  834.             {
  835.                 t3 = t5 - t1;
  836.                 t5 = t5 + t1;
  837.                 adds += 2;
  838.             }
  839.             ;
  840.             {
  841.                 z[5].re = r0 - t5;
  842.                 z[1].re = r0 + t5;
  843.                 adds += 2;
  844.             }
  845.             ;
  846.             {
  847.                 z[7].im = i1 - t3;
  848.                 z[3].im = i1 + t3;
  849.                 adds += 2;
  850.             }
  851.             ;
  852.             {
  853.                 t4 = t2 - t6;
  854.                 t6 = t2 + t6;
  855.                 adds += 2;
  856.             }
  857.             ;
  858.             {
  859.                 z[7].re = r1 - t4;
  860.                 z[3].re = r1 + t4;
  861.                 adds += 2;
  862.             }
  863.             ;
  864.             {
  865.                 z[5].im = i0 - t6;
  866.                 z[1].im = i0 + t6;
  867.                 adds += 2;
  868.             }
  869.             ;
  870.         }
  871.     }
  872. }
  873. static void fft16(FFTComplex *z)
  874. {
  875.     FFTSample t1, t2, t3, t4, t5, t6, t7, t8;
  876.     fft8(z);
  877.     fft4(z+8);
  878.     fft4(z+12);
  879.     {
  880.         t1 = z[8].re;
  881.         t2 = z[8].im;
  882.         t5 = z[12].re;
  883.         t6 = z[12].im;
  884.         {
  885.             FFTSample r0=z[0].re, i0=z[0].im, r1=z[4].re, i1=z[4].im;
  886.             {
  887.                 t3 = t5 - t1;
  888.                 t5 = t5 + t1;
  889.                 adds += 2;
  890.             }
  891.             ;
  892.             {
  893.                 z[8].re = r0 - t5;
  894.                 z[0].re = r0 + t5;
  895.                 adds += 2;
  896.             }
  897.             ;
  898.             {
  899.                 z[12].im = i1 - t3;
  900.                 z[4].im = i1 + t3;
  901.                 adds += 2;
  902.             }
  903.             ;
  904.             {
  905.                 t4 = t2 - t6;
  906.                 t6 = t2 + t6;
  907.                 adds += 2;
  908.             }
  909.             ;
  910.             {
  911.                 z[12].re = r1 - t4;
  912.                 z[4].re = r1 + t4;
  913.                 adds += 2;
  914.             }
  915.             ;
  916.             {
  917.                 z[8].im = i0 - t6;
  918.                 z[0].im = i0 + t6;
  919.                 adds += 2;
  920.             }
  921.             ;
  922.         }
  923.     }
  924.     ;
  925.     {
  926.         t3 = fixmul32b(z[10].re, (0x5a82799a));
  927.         t4 = fixmul32b(z[10].im, (0x5a82799a));
  928.         t7 = fixmul32b(z[14].re, (0x5a82799a));
  929.         t8 = fixmul32b(z[14].im, (0x5a82799a));
  930.         t1 = ( t3 + t4 );
  931.         t2 = ( t4 - t3 );
  932.         t5 = ( t7 - t8 );
  933.         t6 = ( t8 + t7 );
  934.         {
  935.             FFTSample r0=z[2].re, i0=z[2].im, r1=z[6].re, i1=z[6].im;
  936.             {
  937.                 t3 = t5 - t1;
  938.                 t5 = t5 + t1;
  939.                 adds += 2;
  940.             }
  941.             ;
  942.             {
  943.                 z[10].re = r0 - t5;
  944.                 z[2].re = r0 + t5;
  945.                 adds += 2;
  946.             }
  947.             ;
  948.             {
  949.                 z[14].im = i1 - t3;
  950.                 z[6].im = i1 + t3;
  951.                 adds += 2;
  952.             }
  953.             ;
  954.             {
  955.                 t4 = t2 - t6;
  956.                 t6 = t2 + t6;
  957.                 adds += 2;
  958.             }
  959.             ;
  960.             {
  961.                 z[14].re = r1 - t4;
  962.                 z[6].re = r1 + t4;
  963.                 adds += 2;
  964.             }
  965.             ;
  966.             {
  967.                 z[10].im = i0 - t6;
  968.                 z[2].im = i0 + t6;
  969.                 adds += 2;
  970.             }
  971.             ;
  972.         }
  973.     }
  974.     ;
  975.     {
  976.         t1 = fixmul32b(z[9].re, (0x7641af3d)) + fixmul32b(z[9].im, (0x30fbc54d));
  977.         t2 = fixmul32b(z[9].im, (0x7641af3d)) - fixmul32b(z[9].re, (0x30fbc54d));
  978.         t5 = fixmul32b(z[13].re, (0x7641af3d)) - fixmul32b(z[13].im, (0x30fbc54d));
  979.         t6 = fixmul32b(z[13].im, (0x7641af3d)) + fixmul32b(z[13].re, (0x30fbc54d));
  980.         muls += 8;
  981.         {
  982.             FFTSample r0=z[1].re, i0=z[1].im, r1=z[5].re, i1=z[5].im;
  983.             {
  984.                 t3 = t5 - t1;
  985.                 t5 = t5 + t1;
  986.                 adds += 2;
  987.             }
  988.             ;
  989.             {
  990.                 z[9].re = r0 - t5;
  991.                 z[1].re = r0 + t5;
  992.                 adds += 2;
  993.             }
  994.             ;
  995.             {
  996.                 z[13].im = i1 - t3;
  997.                 z[5].im = i1 + t3;
  998.                 adds += 2;
  999.             }
  1000.             ;
  1001.             {
  1002.                 t4 = t2 - t6;
  1003.                 t6 = t2 + t6;
  1004.                 adds += 2;
  1005.             }
  1006.             ;
  1007.             {
  1008.                 z[13].re = r1 - t4;
  1009.                 z[5].re = r1 + t4;
  1010.                 adds += 2;
  1011.             }
  1012.             ;
  1013.             {
  1014.                 z[9].im = i0 - t6;
  1015.                 z[1].im = i0 + t6;
  1016.                 adds += 2;
  1017.             }
  1018.             ;
  1019.         }
  1020.     }
  1021.     ;
  1022.     {
  1023.         t1 = fixmul32b(z[11].re, (0x30fbc54d)) + fixmul32b(z[11].im, (0x7641af3d));
  1024.         t2 = fixmul32b(z[11].im, (0x30fbc54d)) - fixmul32b(z[11].re, (0x7641af3d));
  1025.         t5 = fixmul32b(z[15].re, (0x30fbc54d)) - fixmul32b(z[15].im, (0x7641af3d));
  1026.         t6 = fixmul32b(z[15].im, (0x30fbc54d)) + fixmul32b(z[15].re, (0x7641af3d));
  1027.         muls += 8;
  1028.         {
  1029.             FFTSample r0=z[3].re, i0=z[3].im, r1=z[7].re, i1=z[7].im;
  1030.             {
  1031.                 t3 = t5 - t1;
  1032.                 t5 = t5 + t1;
  1033.                 adds += 2;
  1034.             }
  1035.             ;
  1036.             {
  1037.                 z[11].re = r0 - t5;
  1038.                 z[3].re = r0 + t5;
  1039.                 adds += 2;
  1040.             }
  1041.             ;
  1042.             {
  1043.                 z[15].im = i1 - t3;
  1044.                 z[7].im = i1 + t3;
  1045.                 adds += 2;
  1046.             }
  1047.             ;
  1048.             {
  1049.                 t4 = t2 - t6;
  1050.                 t6 = t2 + t6;
  1051.                 adds += 2;
  1052.             }
  1053.             ;
  1054.             {
  1055.                 z[15].re = r1 - t4;
  1056.                 z[7].re = r1 + t4;
  1057.                 adds += 2;
  1058.             }
  1059.             ;
  1060.             {
  1061.                 z[11].im = i0 - t6;
  1062.                 z[3].im = i0 + t6;
  1063.                 adds += 2;
  1064.             }
  1065.             ;
  1066.         }
  1067.     }
  1068.     ;
  1069. }
  1070. static void fft32(FFTComplex *z){
  1071.     fft16(z);
  1072.     fft8(z+8*2);
  1073.     fft8(z+8*3);
  1074.     pass(z,8192/32,8/2);
  1075. }
  1076. static void fft64(FFTComplex *z){
  1077.     fft32(z);
  1078.     fft16(z+16*2);
  1079.     fft16(z+16*3);
  1080.     pass(z,8192/64,16/2);
  1081. }
  1082. static void fft128(FFTComplex *z){
  1083.     fft64(z);
  1084.     fft32(z+32*2);
  1085.     fft32(z+32*3);
  1086.     pass(z,8192/128,32/2);
  1087. }
  1088. static void fft256(FFTComplex *z){
  1089.     fft128(z);
  1090.     fft64(z+64*2);
  1091.     fft64(z+64*3);
  1092.     pass(z,8192/256,64/2);
  1093. }
  1094. static void fft512(FFTComplex *z){
  1095.     fft256(z);
  1096.     fft128(z+128*2);
  1097.     fft128(z+128*3);
  1098.     pass(z,8192/512,128/2);
  1099. }
  1100. static void fft1024(FFTComplex *z){
  1101.     fft512(z);
  1102.     fft256(z+256*2);
  1103.     fft256(z+256*3);
  1104.     pass_big(z,8192/1024,256/2);
  1105. }
  1106. static void fft2048(FFTComplex *z){
  1107.     fft1024(z);
  1108.     fft512(z+512*2);
  1109.     fft512(z+512*3);
  1110.     pass_big(z,8192/2048,512/2);
  1111. }
  1112. static void fft4096(FFTComplex *z){
  1113.     fft2048(z);
  1114.     fft1024(z+1024*2);
  1115.     fft1024(z+1024*3);
  1116.     pass_big(z,8192/4096,1024/2);
  1117. }
  1118. static void (*fft_dispatch[])(FFTComplex*) = {
  1119.     fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512, fft1024,
  1120.     fft2048, fft4096
  1121. }
  1122. ;
  1123. void ff_fft_calc_c(FFTContext *s, FFTComplex *z)
  1124. {
  1125.     fft_dispatch[s->
  1126.     nbits-2](z);
  1127. }
  1128.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement