Revision 4eb7a735 libavcodec/ac3dec.c

View differences:

libavcodec/ac3dec.c
197 197
} AC3DecodeContext;
198 198

  
199 199
/**
200
 * Generate a Kaiser-Bessel Derived Window.
201
 */
202
static void ac3_window_init(float *window)
203
{
204
   int i, j;
205
   double sum = 0.0, bessel, tmp;
206
   double local_window[256];
207
   double alpha2 = (5.0 * M_PI / 256.0) * (5.0 * M_PI / 256.0);
208

  
209
   for (i = 0; i < 256; i++) {
210
       tmp = i * (256 - i) * alpha2;
211
       bessel = 1.0;
212
       for (j = 100; j > 0; j--) /* default to 100 iterations */
213
           bessel = bessel * tmp / (j * j) + 1;
214
       sum += bessel;
215
       local_window[i] = sum;
216
   }
217

  
218
   sum++;
219
   for (i = 0; i < 256; i++)
220
       window[i] = sqrt(local_window[i] / sum);
221
}
222

  
223
/**
224 200
 * Symmetrical Dequantization
225 201
 * reference: Section 7.3.3 Expansion of Mantissas for Symmetrical Quantization
226 202
 *            Tables 7.19 to 7.23
......
301 277
    ac3_tables_init();
302 278
    ff_mdct_init(&s->imdct_256, 8, 1);
303 279
    ff_mdct_init(&s->imdct_512, 9, 1);
304
    ac3_window_init(s->window);
280
    ff_kbd_window_init(s->window);
305 281
    dsputil_init(&s->dsp, avctx);
306 282
    av_init_random(0, &s->dith_state);
307 283

  

Also available in: Unified diff