From: Benjamin Larsson Date: Sat, 22 Apr 2006 21:21:16 +0000 (+0000) Subject: Patch to generate the ac3 window, based on code by Justin Ruggles. X-Git-Tag: v0.5~12825 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=176c142abcbfda1cc161ca8614ab07dffe505349;p=platform%2Fupstream%2Flibav.git Patch to generate the ac3 window, based on code by Justin Ruggles. Originally committed as revision 5310 to svn://svn.ffmpeg.org/ffmpeg/trunk --- diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 5ec8b4f5a..a587c647b 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -81,6 +81,51 @@ static inline int16_t fix15(float a) return v; } + +/** + * Generate a Kaiser Window. + */ +static void k_window_init(int alpha, double *window, int n, int iter) +{ + int j, k; + double a, x; + a = alpha * M_PI / n; + a = a*a; + for(k=0; k0; j--) { + window[k] = (window[k] * x / (j*j)) + 1.0; + } + } +} + +/** + * Generate a Kaiser-Bessel Derived Window. + * @param alpha determines window shape + * @param window array to fill with window values + * @param iter number of iterations to use in BesselI0 + */ + +static void kbd_window_init(int alpha, int16_t *out_window, int iter) +{ + int k, n2; + double kwindow[256]; + double window[256]; + + n2 = 256; + k_window_init(alpha, kwindow, n2, iter); + window[0] = kwindow[0]; + for(k=1; k