diff options
author | Sean Bartell <wingedtachikoma@gmail.com> | 2011-06-25 21:32:25 -0400 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2012-04-25 22:13:20 +0200 |
commit | f40bfc9267b13b54e6379dfe7539447662879d24 (patch) | |
tree | 9b20069d5e62809ff434061ad730096836f916f2 /lib/rbcodec/codecs/libspeex/ltp_cf.S | |
parent | a0009907de7a0107d49040d8a180f140e2eff299 (diff) | |
download | rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.tar.gz rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.zip |
Add codecs to librbcodec.
Change-Id: Id7f4717d51ed02d67cb9f9cb3c0ada4a81843f97
Reviewed-on: http://gerrit.rockbox.org/137
Reviewed-by: Nils Wallménius <nils@rockbox.org>
Tested-by: Nils Wallménius <nils@rockbox.org>
Diffstat (limited to 'lib/rbcodec/codecs/libspeex/ltp_cf.S')
-rw-r--r-- | lib/rbcodec/codecs/libspeex/ltp_cf.S | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libspeex/ltp_cf.S b/lib/rbcodec/codecs/libspeex/ltp_cf.S new file mode 100644 index 0000000000..a1baed6d41 --- /dev/null +++ b/lib/rbcodec/codecs/libspeex/ltp_cf.S | |||
@@ -0,0 +1,85 @@ | |||
1 | /* Copyright (C) 2007 Thom Johansen */ | ||
2 | /** | ||
3 | @file ltp_cf.S | ||
4 | @brief Long-Term Prediction functions (Coldfire version) | ||
5 | */ | ||
6 | /* | ||
7 | Redistribution and use in source and binary forms, with or without | ||
8 | modification, are permitted provided that the following conditions | ||
9 | are met: | ||
10 | |||
11 | - Redistributions of source code must retain the above copyright | ||
12 | notice, this list of conditions and the following disclaimer. | ||
13 | |||
14 | - Redistributions in binary form must reproduce the above copyright | ||
15 | notice, this list of conditions and the following disclaimer in the | ||
16 | documentation and/or other materials provided with the distribution. | ||
17 | |||
18 | - Neither the name of the Xiph.org Foundation nor the names of its | ||
19 | contributors may be used to endorse or promote products derived from | ||
20 | this software without specific prior written permission. | ||
21 | |||
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR | ||
26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | */ | ||
34 | |||
35 | .text | ||
36 | /* spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len) */ | ||
37 | .global inner_prod | ||
38 | inner_prod: | ||
39 | lea.l (-28, %sp), %sp | ||
40 | movem.l %d2-%d7/%a2, (%sp) | ||
41 | movem.l (28+4, %sp), %a0-%a1 | a0 = x, a1 = y | ||
42 | move.l (28+12, %sp), %d0 | d0 = len | ||
43 | |||
44 | | We assume we're never called with a 'len' of zero | ||
45 | btst #2, %d0 | Check if we need to do one round of four | ||
46 | jeq 0f | samples before we do runs of eight | ||
47 | movem.l (%a0), %d1-%d2 | Fetch four samples from x | ||
48 | movem.l (%a1), %d3-%d4 | Fetch four samples from y | ||
49 | mac.w %d1u, %d3u, %acc0 | ||
50 | mac.w %d1l, %d3l, %acc0 | ||
51 | mac.w %d2u, %d4u, %acc0 | ||
52 | mac.w %d2l, %d4l, %acc0 | ||
53 | addq.l #8, %a0 | ||
54 | addq.l #8, %a1 | ||
55 | subq.l #4, %d0 | ||
56 | jeq .save | ||
57 | |||
58 | 0: | ||
59 | movem.l (%a0), %d1-%d4 | Fetch eight samples from x | ||
60 | movem.l (%a1), %d5-%d7/%a2 | Fetch eight samples from y | ||
61 | mac.w %d1u, %d5u, %acc0 | ||
62 | mac.w %d1l, %d5l, %acc0 | ||
63 | mac.w %d2u, %d6u, %acc0 | ||
64 | mac.w %d2l, %d6l, %acc0 | ||
65 | mac.w %d3u, %d7u, %acc0 | ||
66 | mac.w %d3l, %d7l, %acc0 | ||
67 | mac.w %d4u, %a2u, %acc0 | ||
68 | mac.w %d4l, %a2l, %acc0 | ||
69 | lea.l (16, %a0), %a0 | ||
70 | lea.l (16, %a1), %a1 | ||
71 | subq.l #8, %d0 | ||
72 | jne 0b | ||
73 | |||
74 | .save: | ||
75 | move.l %accext01, %d1 | Fetch top 8 bits of answer | ||
76 | movclr.l %acc0, %d0 | Fetch lower 32 bits | ||
77 | lsr.l #6, %d0 | ||
78 | moveq.l #26, %d2 | ||
79 | asl.l %d2, %d1 | ||
80 | or.l %d1, %d0 | Combine (top << 26) | (lower >> 6) | ||
81 | |||
82 | movem.l (%sp), %d2-%d7/%a2 | ||
83 | lea.l (28, %sp), %sp | ||
84 | rts | ||
85 | |||