diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-03-01 03:05:13 +0100 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-03-01 03:05:13 +0100 |
commit | 1d0b3b20c34517b9d1ddf3ea347776304b0c4b44 (patch) | |
tree | 89f4fc640c2becc6f00ae08996754952ecf149c1 /contrib/ffmpeg/libavcodec/mdct.c | |
parent | 09496ad3469a0ade8dbd9a351e639b78f20b7942 (diff) | |
download | xine-lib-1d0b3b20c34517b9d1ddf3ea347776304b0c4b44.tar.gz xine-lib-1d0b3b20c34517b9d1ddf3ea347776304b0c4b44.tar.bz2 |
Update internal FFmpeg copy.
Diffstat (limited to 'contrib/ffmpeg/libavcodec/mdct.c')
-rw-r--r-- | contrib/ffmpeg/libavcodec/mdct.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/ffmpeg/libavcodec/mdct.c b/contrib/ffmpeg/libavcodec/mdct.c index de3275289..e809fcdcb 100644 --- a/contrib/ffmpeg/libavcodec/mdct.c +++ b/contrib/ffmpeg/libavcodec/mdct.c @@ -25,6 +25,29 @@ * MDCT/IMDCT transforms. */ +// Generate a Kaiser-Bessel Derived Window. +#define BESSEL_I0_ITER 50 // default: 50 iterations of Bessel I0 approximation +void ff_kbd_window_init(float *window, float alpha, int n) +{ + int i, j; + double sum = 0.0, bessel, tmp; + double local_window[n]; + double alpha2 = (alpha * M_PI / n) * (alpha * M_PI / n); + + for (i = 0; i < n; i++) { + tmp = i * (n - i) * alpha2; + bessel = 1.0; + for (j = BESSEL_I0_ITER; j > 0; j--) + bessel = bessel * tmp / (j * j) + 1; + sum += bessel; + local_window[i] = sum; + } + + sum++; + for (i = 0; i < n; i++) + window[i] = sqrt(local_window[i] / sum); +} + /** * init MDCT or IMDCT computation. */ |