summaryrefslogtreecommitdiff
path: root/apps/eq.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/eq.c')
-rw-r--r--apps/eq.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/apps/eq.c b/apps/eq.c
index 8ad886fc0c..3d2f8d133d 100644
--- a/apps/eq.c
+++ b/apps/eq.c
@@ -24,6 +24,8 @@
24 Slightly faster calculation can be done by deriving forms which use tan() 24 Slightly faster calculation can be done by deriving forms which use tan()
25 instead of cos() and sin(), but the latter are far easier to use when doing 25 instead of cos() and sin(), but the latter are far easier to use when doing
26 fixed point math, and performance is not a big point in the calculation part. 26 fixed point math, and performance is not a big point in the calculation part.
27 All the 'a' filter coefficients are negated so we can use only additions
28 in the filtering equation.
27 We realise the filters as a second order direct form 1 structure. Direct 29 We realise the filters as a second order direct form 1 structure. Direct
28 form 1 was chosen because of better numerical properties for fixed point 30 form 1 was chosen because of better numerical properties for fixed point
29 implementations. 31 implementations.
@@ -153,8 +155,8 @@ void eq_pk_coefs(unsigned long cutoff, unsigned long Q, long db, long *c)
153 c[0] = DIV64(b0, a0, 28); 155 c[0] = DIV64(b0, a0, 28);
154 c[1] = DIV64(b1, a0, 28); 156 c[1] = DIV64(b1, a0, 28);
155 c[2] = DIV64(b2, a0, 28); 157 c[2] = DIV64(b2, a0, 28);
156 c[3] = DIV64(a1, a0, 28); 158 c[3] = DIV64(-a1, a0, 28);
157 c[4] = DIV64(a2, a0, 28); 159 c[4] = DIV64(-a2, a0, 28);
158} 160}
159 161
160/* Calculate coefficients for lowshelf filter */ 162/* Calculate coefficients for lowshelf filter */
@@ -180,8 +182,8 @@ void eq_ls_coefs(unsigned long cutoff, unsigned long Q, long db, long *c)
180 c[0] = DIV64(b0, a0, 24); 182 c[0] = DIV64(b0, a0, 24);
181 c[1] = DIV64(b1, a0, 24); 183 c[1] = DIV64(b1, a0, 24);
182 c[2] = DIV64(b2, a0, 24); 184 c[2] = DIV64(b2, a0, 24);
183 c[3] = DIV64(a1, a0, 24); 185 c[3] = DIV64(-a1, a0, 24);
184 c[4] = DIV64(a2, a0, 24); 186 c[4] = DIV64(-a2, a0, 24);
185} 187}
186 188
187/* Calculate coefficients for highshelf filter */ 189/* Calculate coefficients for highshelf filter */
@@ -207,8 +209,8 @@ void eq_hs_coefs(unsigned long cutoff, unsigned long Q, long db, long *c)
207 c[0] = DIV64(b0, a0, 24); 209 c[0] = DIV64(b0, a0, 24);
208 c[1] = DIV64(b1, a0, 24); 210 c[1] = DIV64(b1, a0, 24);
209 c[2] = DIV64(b2, a0, 24); 211 c[2] = DIV64(b2, a0, 24);
210 c[3] = DIV64(a1, a0, 24); 212 c[3] = DIV64(-a1, a0, 24);
211 c[4] = DIV64(a2, a0, 24); 213 c[4] = DIV64(-a2, a0, 24);
212} 214}
213 215
214#if !defined(CPU_COLDFIRE) || defined(SIMULATOR) 216#if !defined(CPU_COLDFIRE) || defined(SIMULATOR)