Revision 4eb7a735 libavcodec/mdct.c

View differences:

libavcodec/mdct.c
25 25
 * MDCT/IMDCT transforms.
26 26
 */
27 27

  
28
// Generate a Kaiser-Bessel Derived Window.
29
void ff_kbd_window_init(float *window)
30
{
31
   int i, j;
32
   double sum = 0.0, bessel, tmp;
33
   double local_window[256];
34
   double alpha2 = (5.0 * M_PI / 256.0) * (5.0 * M_PI / 256.0);
35

  
36
   for (i = 0; i < 256; i++) {
37
       tmp = i * (256 - i) * alpha2;
38
       bessel = 1.0;
39
       for (j = 100; j > 0; j--) /* default to 100 iterations */
40
           bessel = bessel * tmp / (j * j) + 1;
41
       sum += bessel;
42
       local_window[i] = sum;
43
   }
44

  
45
   sum++;
46
   for (i = 0; i < 256; i++)
47
       window[i] = sqrt(local_window[i] / sum);
48
}
49

  
28 50
/**
29 51
 * init MDCT or IMDCT computation.
30 52
 */

Also available in: Unified diff