summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libopus/celt/arm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libopus/celt/arm')
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/fixed_armv4.h76
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/fixed_armv5e.h116
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/kiss_fft_armv4.h121
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/kiss_fft_armv5e.h118
4 files changed, 431 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libopus/celt/arm/fixed_armv4.h b/lib/rbcodec/codecs/libopus/celt/arm/fixed_armv4.h
new file mode 100644
index 0000000000..bcacc343e8
--- /dev/null
+++ b/lib/rbcodec/codecs/libopus/celt/arm/fixed_armv4.h
@@ -0,0 +1,76 @@
1/* Copyright (C) 2013 Xiph.Org Foundation and contributors */
2/*
3 Redistribution and use in source and binary forms, with or without
4 modification, are permitted provided that the following conditions
5 are met:
6
7 - Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9
10 - Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
18 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
22 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*/
26
27#ifndef FIXED_ARMv4_H
28#define FIXED_ARMv4_H
29
30/** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 bits */
31#undef MULT16_32_Q16
32static inline opus_val32 MULT16_32_Q16_armv4(opus_val16 a, opus_val32 b)
33{
34 unsigned rd_lo;
35 int rd_hi;
36 __asm__(
37 "#MULT16_32_Q16\n\t"
38 "smull %0, %1, %2, %3\n\t"
39 : "=&r"(rd_lo), "=&r"(rd_hi)
40 : "%r"(b),"r"(a<<16)
41 );
42 return rd_hi;
43}
44#define MULT16_32_Q16(a, b) (MULT16_32_Q16_armv4(a, b))
45
46
47/** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 bits */
48#undef MULT16_32_Q15
49static inline opus_val32 MULT16_32_Q15_armv4(opus_val16 a, opus_val32 b)
50{
51 unsigned rd_lo;
52 int rd_hi;
53 __asm__(
54 "#MULT16_32_Q15\n\t"
55 "smull %0, %1, %2, %3\n\t"
56 : "=&r"(rd_lo), "=&r"(rd_hi)
57 : "%r"(b), "r"(a<<16)
58 );
59 /*We intentionally don't OR in the high bit of rd_lo for speed.*/
60 return rd_hi<<1;
61}
62#define MULT16_32_Q15(a, b) (MULT16_32_Q15_armv4(a, b))
63
64
65/** 16x32 multiply, followed by a 15-bit shift right and 32-bit add.
66 b must fit in 31 bits.
67 Result fits in 32 bits. */
68#undef MAC16_32_Q15
69#define MAC16_32_Q15(c, a, b) ADD32(c, MULT16_32_Q15(a, b))
70
71
72/** 32x32 multiplication, followed by a 31-bit shift right. Results fits in 32 bits */
73#undef MULT32_32_Q31
74#define MULT32_32_Q31(a,b) (opus_val32)((((opus_int64)(a)) * ((opus_int64)(b)))>>31)
75
76#endif
diff --git a/lib/rbcodec/codecs/libopus/celt/arm/fixed_armv5e.h b/lib/rbcodec/codecs/libopus/celt/arm/fixed_armv5e.h
new file mode 100644
index 0000000000..80632c4a94
--- /dev/null
+++ b/lib/rbcodec/codecs/libopus/celt/arm/fixed_armv5e.h
@@ -0,0 +1,116 @@
1/* Copyright (C) 2007-2009 Xiph.Org Foundation
2 Copyright (C) 2003-2008 Jean-Marc Valin
3 Copyright (C) 2007-2008 CSIRO
4 Copyright (C) 2013 Parrot */
5/*
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions
8 are met:
9
10 - Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12
13 - Redistributions in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in the
15 documentation and/or other materials provided with the distribution.
16
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30#ifndef FIXED_ARMv5E_H
31#define FIXED_ARMv5E_H
32
33#include "fixed_armv4.h"
34
35/** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 bits */
36#undef MULT16_32_Q16
37static inline opus_val32 MULT16_32_Q16_armv5e(opus_val16 a, opus_val32 b)
38{
39 int res;
40 __asm__(
41 "#MULT16_32_Q16\n\t"
42 "smulwb %0, %1, %2\n\t"
43 : "=r"(res)
44 : "r"(b),"r"(a)
45 );
46 return res;
47}
48#define MULT16_32_Q16(a, b) (MULT16_32_Q16_armv5e(a, b))
49
50
51/** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 bits */
52#undef MULT16_32_Q15
53static inline opus_val32 MULT16_32_Q15_armv5e(opus_val16 a, opus_val32 b)
54{
55 int res;
56 __asm__(
57 "#MULT16_32_Q15\n\t"
58 "smulwb %0, %1, %2\n\t"
59 : "=r"(res)
60 : "r"(b), "r"(a)
61 );
62 return res<<1;
63}
64#define MULT16_32_Q15(a, b) (MULT16_32_Q15_armv5e(a, b))
65
66
67/** 16x32 multiply, followed by a 15-bit shift right and 32-bit add.
68 b must fit in 31 bits.
69 Result fits in 32 bits. */
70#undef MAC16_32_Q15
71static inline opus_val32 MAC16_32_Q15_armv5e(opus_val32 c, opus_val16 a,
72 opus_val32 b)
73{
74 int res;
75 __asm__(
76 "#MAC16_32_Q15\n\t"
77 "smlawb %0, %1, %2, %3;\n"
78 : "=r"(res)
79 : "r"(b<<1), "r"(a), "r"(c)
80 );
81 return res;
82}
83#define MAC16_32_Q15(c, a, b) (MAC16_32_Q15_armv5e(c, a, b))
84
85/** 16x16 multiply-add where the result fits in 32 bits */
86#undef MAC16_16
87static inline opus_val32 MAC16_16_armv5e(opus_val32 c, opus_val16 a,
88 opus_val16 b)
89{
90 int res;
91 __asm__(
92 "#MAC16_16\n\t"
93 "smlabb %0, %1, %2, %3;\n"
94 : "=r"(res)
95 : "r"(a), "r"(b), "r"(c)
96 );
97 return res;
98}
99#define MAC16_16(c, a, b) (MAC16_16_armv5e(c, a, b))
100
101/** 16x16 multiplication where the result fits in 32 bits */
102#undef MULT16_16
103static inline opus_val32 MULT16_16_armv5e(opus_val16 a, opus_val16 b)
104{
105 int res;
106 __asm__(
107 "#MULT16_16\n\t"
108 "smulbb %0, %1, %2;\n"
109 : "=r"(res)
110 : "r"(a), "r"(b)
111 );
112 return res;
113}
114#define MULT16_16(a, b) (MULT16_16_armv5e(a, b))
115
116#endif
diff --git a/lib/rbcodec/codecs/libopus/celt/arm/kiss_fft_armv4.h b/lib/rbcodec/codecs/libopus/celt/arm/kiss_fft_armv4.h
new file mode 100644
index 0000000000..e4faad6f2b
--- /dev/null
+++ b/lib/rbcodec/codecs/libopus/celt/arm/kiss_fft_armv4.h
@@ -0,0 +1,121 @@
1/*Copyright (c) 2013, Xiph.Org Foundation and contributors.
2
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7
8 * Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
18 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 POSSIBILITY OF SUCH DAMAGE.*/
25
26#ifndef KISS_FFT_ARMv4_H
27#define KISS_FFT_ARMv4_H
28
29#if !defined(KISS_FFT_GUTS_H)
30#error "This file should only be included from _kiss_fft_guts.h"
31#endif
32
33#ifdef FIXED_POINT
34
35#undef C_MUL
36#define C_MUL(m,a,b) \
37 do{ \
38 int br__; \
39 int bi__; \
40 int tt__; \
41 __asm__ __volatile__( \
42 "#C_MUL\n\t" \
43 "ldrsh %[br], [%[bp], #0]\n\t" \
44 "ldm %[ap], {r0,r1}\n\t" \
45 "ldrsh %[bi], [%[bp], #2]\n\t" \
46 "smull %[tt], %[mi], r1, %[br]\n\t" \
47 "smlal %[tt], %[mi], r0, %[bi]\n\t" \
48 "rsb %[bi], %[bi], #0\n\t" \
49 "smull %[br], %[mr], r0, %[br]\n\t" \
50 "mov %[tt], %[tt], lsr #15\n\t" \
51 "smlal %[br], %[mr], r1, %[bi]\n\t" \
52 "orr %[mi], %[tt], %[mi], lsl #17\n\t" \
53 "mov %[br], %[br], lsr #15\n\t" \
54 "orr %[mr], %[br], %[mr], lsl #17\n\t" \
55 : [mr]"=r"((m).r), [mi]"=r"((m).i), \
56 [br]"=&r"(br__), [bi]"=r"(bi__), [tt]"=r"(tt__) \
57 : [ap]"r"(&(a)), [bp]"r"(&(b)) \
58 : "r0", "r1" \
59 ); \
60 } \
61 while(0)
62
63#undef C_MUL4
64#define C_MUL4(m,a,b) \
65 do{ \
66 int br__; \
67 int bi__; \
68 int tt__; \
69 __asm__ __volatile__( \
70 "#C_MUL4\n\t" \
71 "ldrsh %[br], [%[bp], #0]\n\t" \
72 "ldm %[ap], {r0,r1}\n\t" \
73 "ldrsh %[bi], [%[bp], #2]\n\t" \
74 "smull %[tt], %[mi], r1, %[br]\n\t" \
75 "smlal %[tt], %[mi], r0, %[bi]\n\t" \
76 "rsb %[bi], %[bi], #0\n\t" \
77 "smull %[br], %[mr], r0, %[br]\n\t" \
78 "mov %[tt], %[tt], lsr #17\n\t" \
79 "smlal %[br], %[mr], r1, %[bi]\n\t" \
80 "orr %[mi], %[tt], %[mi], lsl #15\n\t" \
81 "mov %[br], %[br], lsr #17\n\t" \
82 "orr %[mr], %[br], %[mr], lsl #15\n\t" \
83 : [mr]"=r"((m).r), [mi]"=r"((m).i), \
84 [br]"=&r"(br__), [bi]"=r"(bi__), [tt]"=r"(tt__) \
85 : [ap]"r"(&(a)), [bp]"r"(&(b)) \
86 : "r0", "r1" \
87 ); \
88 } \
89 while(0)
90
91#undef C_MULC
92#define C_MULC(m,a,b) \
93 do{ \
94 int br__; \
95 int bi__; \
96 int tt__; \
97 __asm__ __volatile__( \
98 "#C_MULC\n\t" \
99 "ldrsh %[br], [%[bp], #0]\n\t" \
100 "ldm %[ap], {r0,r1}\n\t" \
101 "ldrsh %[bi], [%[bp], #2]\n\t" \
102 "smull %[tt], %[mr], r0, %[br]\n\t" \
103 "smlal %[tt], %[mr], r1, %[bi]\n\t" \
104 "rsb %[bi], %[bi], #0\n\t" \
105 "smull %[br], %[mi], r1, %[br]\n\t" \
106 "mov %[tt], %[tt], lsr #15\n\t" \
107 "smlal %[br], %[mi], r0, %[bi]\n\t" \
108 "orr %[mr], %[tt], %[mr], lsl #17\n\t" \
109 "mov %[br], %[br], lsr #15\n\t" \
110 "orr %[mi], %[br], %[mi], lsl #17\n\t" \
111 : [mr]"=r"((m).r), [mi]"=r"((m).i), \
112 [br]"=&r"(br__), [bi]"=r"(bi__), [tt]"=r"(tt__) \
113 : [ap]"r"(&(a)), [bp]"r"(&(b)) \
114 : "r0", "r1" \
115 ); \
116 } \
117 while(0)
118
119#endif /* FIXED_POINT */
120
121#endif /* KISS_FFT_ARMv4_H */
diff --git a/lib/rbcodec/codecs/libopus/celt/arm/kiss_fft_armv5e.h b/lib/rbcodec/codecs/libopus/celt/arm/kiss_fft_armv5e.h
new file mode 100644
index 0000000000..9eca183d77
--- /dev/null
+++ b/lib/rbcodec/codecs/libopus/celt/arm/kiss_fft_armv5e.h
@@ -0,0 +1,118 @@
1/*Copyright (c) 2013, Xiph.Org Foundation and contributors.
2
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7
8 * Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
18 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 POSSIBILITY OF SUCH DAMAGE.*/
25
26#ifndef KISS_FFT_ARMv5E_H
27#define KISS_FFT_ARMv5E_H
28
29#if !defined(KISS_FFT_GUTS_H)
30#error "This file should only be included from _kiss_fft_guts.h"
31#endif
32
33#ifdef FIXED_POINT
34
35#if defined(__thumb__)||defined(__thumb2__)
36#define LDRD_CONS "Q"
37#else
38#define LDRD_CONS "Uq"
39#endif
40
41#undef C_MUL
42#define C_MUL(m,a,b) \
43 do{ \
44 int mr1__; \
45 int mr2__; \
46 int mi__; \
47 long long aval__; \
48 int bval__; \
49 __asm__( \
50 "#C_MUL\n\t" \
51 "ldrd %[aval], %H[aval], %[ap]\n\t" \
52 "ldr %[bval], %[bp]\n\t" \
53 "smulwb %[mi], %H[aval], %[bval]\n\t" \
54 "smulwb %[mr1], %[aval], %[bval]\n\t" \
55 "smulwt %[mr2], %H[aval], %[bval]\n\t" \
56 "smlawt %[mi], %[aval], %[bval], %[mi]\n\t" \
57 : [mr1]"=r"(mr1__), [mr2]"=r"(mr2__), [mi]"=r"(mi__), \
58 [aval]"=&r"(aval__), [bval]"=r"(bval__) \
59 : [ap]LDRD_CONS(a), [bp]"m"(b) \
60 ); \
61 (m).r = SHL32(SUB32(mr1__, mr2__), 1); \
62 (m).i = SHL32(mi__, 1); \
63 } \
64 while(0)
65
66#undef C_MUL4
67#define C_MUL4(m,a,b) \
68 do{ \
69 int mr1__; \
70 int mr2__; \
71 int mi__; \
72 long long aval__; \
73 int bval__; \
74 __asm__( \
75 "#C_MUL4\n\t" \
76 "ldrd %[aval], %H[aval], %[ap]\n\t" \
77 "ldr %[bval], %[bp]\n\t" \
78 "smulwb %[mi], %H[aval], %[bval]\n\t" \
79 "smulwb %[mr1], %[aval], %[bval]\n\t" \
80 "smulwt %[mr2], %H[aval], %[bval]\n\t" \
81 "smlawt %[mi], %[aval], %[bval], %[mi]\n\t" \
82 : [mr1]"=r"(mr1__), [mr2]"=r"(mr2__), [mi]"=r"(mi__), \
83 [aval]"=&r"(aval__), [bval]"=r"(bval__) \
84 : [ap]LDRD_CONS(a), [bp]"m"(b) \
85 ); \
86 (m).r = SHR32(SUB32(mr1__, mr2__), 1); \
87 (m).i = SHR32(mi__, 1); \
88 } \
89 while(0)
90
91#undef C_MULC
92#define C_MULC(m,a,b) \
93 do{ \
94 int mr__; \
95 int mi1__; \
96 int mi2__; \
97 long long aval__; \
98 int bval__; \
99 __asm__( \
100 "#C_MULC\n\t" \
101 "ldrd %[aval], %H[aval], %[ap]\n\t" \
102 "ldr %[bval], %[bp]\n\t" \
103 "smulwb %[mr], %[aval], %[bval]\n\t" \
104 "smulwb %[mi1], %H[aval], %[bval]\n\t" \
105 "smulwt %[mi2], %[aval], %[bval]\n\t" \
106 "smlawt %[mr], %H[aval], %[bval], %[mr]\n\t" \
107 : [mr]"=r"(mr__), [mi1]"=r"(mi1__), [mi2]"=r"(mi2__), \
108 [aval]"=&r"(aval__), [bval]"=r"(bval__) \
109 : [ap]LDRD_CONS(a), [bp]"m"(b) \
110 ); \
111 (m).r = SHL32(mr__, 1); \
112 (m).i = SHL32(SUB32(mi1__, mi2__), 1); \
113 } \
114 while(0)
115
116#endif /* FIXED_POINT */
117
118#endif /* KISS_FFT_GUTS_H */