annotate libaf/window.c @ 9021:070b91093606

* Remove unneeded includes & macros * Get layers by name rather that fixed ID. Only works for DirectFB >= 0.9.16 so fall back to ID based stuff for older releases. * New option "noinput" (useful in X) * Add some NULL pointer checks to uninit() * Improve error messages and use mp_msg() * Direct rendering fix (at least IPB was broken) * Use 0xff for alpha component in all colors * Blit from temp surface to screen was only done in draw_osd() which doesn't always get called. Do the blit in flip_page() in this case. * Add GUI support to control() * Change the driver name to include G450/G550 ;) patch by Ville Syrj¸«£l¸«£ <syrjala@sci.fi>
author arpi
date Sun, 19 Jan 2003 15:41:26 +0000
parents d08513b9fed6
children 14090f7300a8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7568
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
1 /*=============================================================================
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
2 //
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
3 // This software has been released under the terms of the GNU Public
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
4 // license. See http://www.gnu.org/copyleft/gpl.html for details.
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
5 //
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
6 // Copyright 2001 Anders Johansson ajh@atri.curtin.edu.au
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
7 //
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
8 //=============================================================================
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
9 */
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
10
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
11 /* Calculates a number of window functions. The following window
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
12 functions are currently implemented: Boxcar, Triang, Hanning,
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
13 Hamming, Blackman, Flattop and Kaiser. In the function call n is
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
14 the number of filter taps and w the buffer in which the filter
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
15 coefficients will be stored.
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
16 */
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
17
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
18 #include <math.h>
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
19 #include "dsp.h"
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
20
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
21 /*
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
22 // Boxcar
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
23 //
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
24 // n window length
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
25 // w buffer for the window parameters
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
26 */
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
27 void boxcar(int n, _ftype_t* w)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
28 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
29 int i;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
30 // Calculate window coefficients
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
31 for (i=0 ; i<n ; i++)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
32 w[i] = 1.0;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
33 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
34
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
35
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
36 /*
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
37 // Triang a.k.a Bartlett
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
38 //
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
39 // | (N-1)|
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
40 // 2 * |k - -----|
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
41 // | 2 |
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
42 // w = 1.0 - ---------------
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
43 // N+1
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
44 // n window length
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
45 // w buffer for the window parameters
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
46 */
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
47 void triang(int n, _ftype_t* w)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
48 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
49 _ftype_t k1 = (_ftype_t)(n & 1);
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
50 _ftype_t k2 = 1/((_ftype_t)n + k1);
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
51 int end = (n + 1) >> 1;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
52 int i;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
53
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
54 // Calculate window coefficients
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
55 for (i=0 ; i<end ; i++)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
56 w[i] = w[n-i-1] = (2.0*((_ftype_t)(i+1))-(1.0-k1))*k2;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
57 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
58
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
59
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
60 /*
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
61 // Hanning
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
62 // 2*pi*k
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
63 // w = 0.5 - 0.5*cos(------), where 0 < k <= N
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
64 // N+1
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
65 // n window length
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
66 // w buffer for the window parameters
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
67 */
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
68 void hanning(int n, _ftype_t* w)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
69 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
70 int i;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
71 _ftype_t k = 2*M_PI/((_ftype_t)(n+1)); // 2*pi/(N+1)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
72
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
73 // Calculate window coefficients
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
74 for (i=0; i<n; i++)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
75 *w++ = 0.5*(1.0 - cos(k*(_ftype_t)(i+1)));
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
76 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
77
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
78 /*
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
79 // Hamming
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
80 // 2*pi*k
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
81 // w(k) = 0.54 - 0.46*cos(------), where 0 <= k < N
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
82 // N-1
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
83 //
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
84 // n window length
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
85 // w buffer for the window parameters
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
86 */
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
87 void hamming(int n,_ftype_t* w)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
88 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
89 int i;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
90 _ftype_t k = 2*M_PI/((_ftype_t)(n-1)); // 2*pi/(N-1)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
91
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
92 // Calculate window coefficients
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
93 for (i=0; i<n; i++)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
94 *w++ = 0.54 - 0.46*cos(k*(_ftype_t)i);
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
95 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
96
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
97 /*
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
98 // Blackman
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
99 // 2*pi*k 4*pi*k
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
100 // w(k) = 0.42 - 0.5*cos(------) + 0.08*cos(------), where 0 <= k < N
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
101 // N-1 N-1
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
102 //
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
103 // n window length
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
104 // w buffer for the window parameters
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
105 */
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
106 void blackman(int n,_ftype_t* w)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
107 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
108 int i;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
109 _ftype_t k1 = 2*M_PI/((_ftype_t)(n-1)); // 2*pi/(N-1)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
110 _ftype_t k2 = 2*k1; // 4*pi/(N-1)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
111
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
112 // Calculate window coefficients
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
113 for (i=0; i<n; i++)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
114 *w++ = 0.42 - 0.50*cos(k1*(_ftype_t)i) + 0.08*cos(k2*(_ftype_t)i);
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
115 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
116
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
117 /*
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
118 // Flattop
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
119 // 2*pi*k 4*pi*k
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
120 // w(k) = 0.2810638602 - 0.5208971735*cos(------) + 0.1980389663*cos(------), where 0 <= k < N
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
121 // N-1 N-1
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
122 //
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
123 // n window length
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
124 // w buffer for the window parameters
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
125 */
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
126 void flattop(int n,_ftype_t* w)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
127 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
128 int i;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
129 _ftype_t k1 = 2*M_PI/((_ftype_t)(n-1)); // 2*pi/(N-1)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
130 _ftype_t k2 = 2*k1; // 4*pi/(N-1)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
131
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
132 // Calculate window coefficients
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
133 for (i=0; i<n; i++)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
134 *w++ = 0.2810638602 - 0.5208971735*cos(k1*(_ftype_t)i) + 0.1980389663*cos(k2*(_ftype_t)i);
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
135 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
136
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
137 /* Computes the 0th order modified Bessel function of the first kind.
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
138 // (Needed to compute Kaiser window)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
139 //
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
140 // y = sum( (x/(2*n))^2 )
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
141 // n
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
142 */
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
143 #define BIZ_EPSILON 1E-21 // Max error acceptable
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
144
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
145 _ftype_t besselizero(_ftype_t x)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
146 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
147 _ftype_t temp;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
148 _ftype_t sum = 1.0;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
149 _ftype_t u = 1.0;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
150 _ftype_t halfx = x/2.0;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
151 int n = 1;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
152
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
153 do {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
154 temp = halfx/(_ftype_t)n;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
155 u *=temp * temp;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
156 sum += u;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
157 n++;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
158 } while (u >= BIZ_EPSILON * sum);
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
159 return(sum);
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
160 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
161
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
162 /*
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
163 // Kaiser
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
164 //
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
165 // n window length
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
166 // w buffer for the window parameters
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
167 // b beta parameter of Kaiser window, Beta >= 1
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
168 //
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
169 // Beta trades the rejection of the low pass filter against the
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
170 // transition width from passband to stop band. Larger Beta means a
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
171 // slower transition and greater stop band rejection. See Rabiner and
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
172 // Gold (Theory and Application of DSP) under Kaiser windows for more
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
173 // about Beta. The following table from Rabiner and Gold gives some
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
174 // feel for the effect of Beta:
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
175 //
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
176 // All ripples in dB, width of transition band = D*N where N = window
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
177 // length
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
178 //
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
179 // BETA D PB RIP SB RIP
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
180 // 2.120 1.50 +-0.27 -30
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
181 // 3.384 2.23 0.0864 -40
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
182 // 4.538 2.93 0.0274 -50
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
183 // 5.658 3.62 0.00868 -60
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
184 // 6.764 4.32 0.00275 -70
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
185 // 7.865 5.0 0.000868 -80
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
186 // 8.960 5.7 0.000275 -90
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
187 // 10.056 6.4 0.000087 -100
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
188 */
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
189 void kaiser(int n, _ftype_t* w, _ftype_t b)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
190 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
191 _ftype_t tmp;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
192 _ftype_t k1 = 1.0/besselizero(b);
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
193 int k2 = 1 - (n & 1);
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
194 int end = (n + 1) >> 1;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
195 int i;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
196
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
197 // Calculate window coefficients
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
198 for (i=0 ; i<end ; i++){
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
199 tmp = (_ftype_t)(2*i + k2) / ((_ftype_t)n - 1.0);
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
200 w[end-(1&(!k2))+i] = w[end-1-i] = k1 * besselizero(b*sqrt(1.0 - tmp*tmp));
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
201 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
202 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
203