summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libopus/silk/arm/macros_armv4.h
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2013-05-20 22:25:57 +0200
committerNils Wallménius <nils@rockbox.org>2013-08-31 08:30:51 +0200
commit580b307fd791c0997a8831bc800bba87797bfb7e (patch)
tree807846056f06fd944a750ce41217a877910ebd59 /lib/rbcodec/codecs/libopus/silk/arm/macros_armv4.h
parent74761b70acd96cecc0d35450dd56a98ad9ee7d3d (diff)
downloadrockbox-580b307fd791c0997a8831bc800bba87797bfb7e.tar.gz
rockbox-580b307fd791c0997a8831bc800bba87797bfb7e.zip
Sync opus codec to upstream git
Sync opus codec to upstream commit 02fed471a4568852d6618e041c4f2af0d7730ee2 (August 30 2013) This brings in a lot of optimizations but also makes the diff between our codec and the upstream much smaller as most of our optimizations have been upstreamed or supeceded. Speedups across the board for CELT mode files: 64kbps 128kbps H300 9.82MHz 15.48MHz c200 4.86MHz 9.63MHz fuze v1 10.32MHz 15.92MHz For the silk mode test file (16kbps) arm targets get a speedup of about 2MHz while the H300 is 7.8MHz slower, likely because it's now using the pseudostack more rather than the real stack which is in iram. Patches to get around that are upcomming. Change-Id: Ifecf963e461c51ac42e09dac1e91bc4bc3b12fa3
Diffstat (limited to 'lib/rbcodec/codecs/libopus/silk/arm/macros_armv4.h')
-rw-r--r--lib/rbcodec/codecs/libopus/silk/arm/macros_armv4.h103
1 files changed, 103 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libopus/silk/arm/macros_armv4.h b/lib/rbcodec/codecs/libopus/silk/arm/macros_armv4.h
new file mode 100644
index 0000000000..58df6c2e2b
--- /dev/null
+++ b/lib/rbcodec/codecs/libopus/silk/arm/macros_armv4.h
@@ -0,0 +1,103 @@
1/***********************************************************************
2Copyright (C) 2013 Xiph.Org Foundation and contributors.
3Redistribution and use in source and binary forms, with or without
4modification, are permitted provided that the following conditions
5are met:
6- Redistributions of source code must retain the above copyright notice,
7this list of conditions and the following disclaimer.
8- Redistributions in binary form must reproduce the above copyright
9notice, this list of conditions and the following disclaimer in the
10documentation and/or other materials provided with the distribution.
11- Neither the name of Internet Society, IETF or IETF Trust, nor the
12names of specific contributors, may be used to endorse or promote
13products derived from this software without specific prior written
14permission.
15THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25POSSIBILITY OF SUCH DAMAGE.
26***********************************************************************/
27
28#ifndef SILK_MACROS_ARMv4_H
29#define SILK_MACROS_ARMv4_H
30
31/* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */
32#undef silk_SMULWB
33static inline opus_int32 silk_SMULWB_armv4(opus_int32 a, opus_int16 b)
34{
35 unsigned rd_lo;
36 int rd_hi;
37 __asm__(
38 "#silk_SMULWB\n\t"
39 "smull %0, %1, %2, %3\n\t"
40 : "=&r"(rd_lo), "=&r"(rd_hi)
41 : "%r"(a), "r"(b<<16)
42 );
43 return rd_hi;
44}
45#define silk_SMULWB(a, b) (silk_SMULWB_armv4(a, b))
46
47/* a32 + (b32 * (opus_int32)((opus_int16)(c32))) >> 16 output have to be 32bit int */
48#undef silk_SMLAWB
49#define silk_SMLAWB(a, b, c) ((a) + silk_SMULWB(b, c))
50
51/* (a32 * (b32 >> 16)) >> 16 */
52#undef silk_SMULWT
53static inline opus_int32 silk_SMULWT_armv4(opus_int32 a, opus_int32 b)
54{
55 unsigned rd_lo;
56 int rd_hi;
57 __asm__(
58 "#silk_SMULWT\n\t"
59 "smull %0, %1, %2, %3\n\t"
60 : "=&r"(rd_lo), "=&r"(rd_hi)
61 : "%r"(a), "r"(b&~0xFFFF)
62 );
63 return rd_hi;
64}
65#define silk_SMULWT(a, b) (silk_SMULWT_armv4(a, b))
66
67/* a32 + (b32 * (c32 >> 16)) >> 16 */
68#undef silk_SMLAWT
69#define silk_SMLAWT(a, b, c) ((a) + silk_SMULWT(b, c))
70
71/* (a32 * b32) >> 16 */
72#undef silk_SMULWW
73static inline opus_int32 silk_SMULWW_armv4(opus_int32 a, opus_int32 b)
74{
75 unsigned rd_lo;
76 int rd_hi;
77 __asm__(
78 "#silk_SMULWW\n\t"
79 "smull %0, %1, %2, %3\n\t"
80 : "=&r"(rd_lo), "=&r"(rd_hi)
81 : "%r"(a), "r"(b)
82 );
83 return (rd_hi<<16)+(rd_lo>>16);
84}
85#define silk_SMULWW(a, b) (silk_SMULWW_armv4(a, b))
86
87#undef silk_SMLAWW
88static inline opus_int32 silk_SMLAWW_armv4(opus_int32 a, opus_int32 b,
89 opus_int32 c)
90{
91 unsigned rd_lo;
92 int rd_hi;
93 __asm__(
94 "#silk_SMLAWW\n\t"
95 "smull %0, %1, %2, %3\n\t"
96 : "=&r"(rd_lo), "=&r"(rd_hi)
97 : "%r"(b), "r"(c)
98 );
99 return a+(rd_hi<<16)+(rd_lo>>16);
100}
101#define silk_SMLAWW(a, b, c) (silk_SMLAWW_armv4(a, b, c))
102
103#endif /* SILK_MACROS_ARMv4_H */