diff options
Diffstat (limited to 'apps/eq_cf.S')
-rw-r--r-- | apps/eq_cf.S | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/apps/eq_cf.S b/apps/eq_cf.S new file mode 100644 index 0000000000..3876ca72d6 --- /dev/null +++ b/apps/eq_cf.S | |||
@@ -0,0 +1,61 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 Thom Johansen | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | .text | ||
21 | .global eq_filter | ||
22 | eq_filter: | ||
23 | lea.l (-11*4, %sp), %sp | ||
24 | movem.l %d2-%d7/%a2-%a6, (%sp) | save clobbered regs | ||
25 | move.l (11*4+8, %sp), %a5 | fetch filter structure address | ||
26 | movem.l (11*4+16, %sp), %d6-%d7 | load num. channels and shift count | ||
27 | movem.l (%a5), %a0-%a4 | load coefs | ||
28 | lea.l (5*4, %a5), %a5 | point to filter history | ||
29 | moveq.l #2, %d6 | number of channels (hardcode to stereo) | ||
30 | |||
31 | .filterloop: | ||
32 | move.l (11*4+4, %sp), %a6 | load input channel pointer | ||
33 | move.l (%a6), %a6 | ||
34 | move.l (11*4+12, %sp), %d5 | number of samples | ||
35 | addq.l #4, (11*4+4, %sp) | point x to next channel | ||
36 | movem.l (%a5), %d0-%d3 | load filter history | ||
37 | .loop: | ||
38 | move.l (%a6), %d4 | ||
39 | mac.l %a0, %d4, %acc0 | acc = b0*x[i] | ||
40 | mac.l %a1, %d0, %acc0 | acc += b1*x[i - 1] | ||
41 | mac.l %a2, %d1, %acc0 | acc += b2*x[i - 2] | ||
42 | msac.l %a3, %d2, %acc0 | acc -= a1*y[i - 1] | ||
43 | msac.l %a4, %d3, %acc0 | acc -= a2*y[i - 2] | ||
44 | move.l %d0, %d1 | fix history | ||
45 | move.l %d4, %d0 | ||
46 | move.l %d2, %d3 | ||
47 | movclr.l %acc0, %d2 | fetch and write result | ||
48 | asl.l %d7, %d2 | restore fixed point format | ||
49 | move.l %d2, (%a6)+ | save result | ||
50 | subq.l #1, %d5 | are we done with this channel? | ||
51 | jne .loop | ||
52 | |||
53 | movem.l %d0-%d3, (%a5) | save history back to struct | ||
54 | lea.l (4*4, %a5), %a5 | point to next channel's history | ||
55 | subq.l #1, %d6 | have we processed both channels? | ||
56 | jne .filterloop | ||
57 | |||
58 | movem.l (%sp), %d2-%d7/%a2-%a6 | ||
59 | lea.l (11*4, %sp), %sp | ||
60 | rts | ||
61 | |||