OLD | NEW |
1 /* Copyright (C) 2007-2009 Xiph.Org Foundation | 1 /* Copyright (C) 2007-2009 Xiph.Org Foundation |
2 Copyright (C) 2003-2008 Jean-Marc Valin | 2 Copyright (C) 2003-2008 Jean-Marc Valin |
3 Copyright (C) 2007-2008 CSIRO | 3 Copyright (C) 2007-2008 CSIRO |
4 Copyright (C) 2013 Parrot */ | 4 Copyright (C) 2013 Parrot */ |
5 /* | 5 /* |
6 Redistribution and use in source and binary forms, with or without | 6 Redistribution and use in source and binary forms, with or without |
7 modification, are permitted provided that the following conditions | 7 modification, are permitted provided that the following conditions |
8 are met: | 8 are met: |
9 | 9 |
10 - Redistributions of source code must retain the above copyright | 10 - Redistributions of source code must retain the above copyright |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 __asm__( | 75 __asm__( |
76 "#MAC16_32_Q15\n\t" | 76 "#MAC16_32_Q15\n\t" |
77 "smlawb %0, %1, %2, %3;\n" | 77 "smlawb %0, %1, %2, %3;\n" |
78 : "=r"(res) | 78 : "=r"(res) |
79 : "r"(b<<1), "r"(a), "r"(c) | 79 : "r"(b<<1), "r"(a), "r"(c) |
80 ); | 80 ); |
81 return res; | 81 return res; |
82 } | 82 } |
83 #define MAC16_32_Q15(c, a, b) (MAC16_32_Q15_armv5e(c, a, b)) | 83 #define MAC16_32_Q15(c, a, b) (MAC16_32_Q15_armv5e(c, a, b)) |
84 | 84 |
| 85 /** 16x32 multiply, followed by a 16-bit shift right and 32-bit add. |
| 86 Result fits in 32 bits. */ |
| 87 #undef MAC16_32_Q16 |
| 88 static OPUS_INLINE opus_val32 MAC16_32_Q16_armv5e(opus_val32 c, opus_val16 a, |
| 89 opus_val32 b) |
| 90 { |
| 91 int res; |
| 92 __asm__( |
| 93 "#MAC16_32_Q16\n\t" |
| 94 "smlawb %0, %1, %2, %3;\n" |
| 95 : "=r"(res) |
| 96 : "r"(b), "r"(a), "r"(c) |
| 97 ); |
| 98 return res; |
| 99 } |
| 100 #define MAC16_32_Q16(c, a, b) (MAC16_32_Q16_armv5e(c, a, b)) |
| 101 |
85 /** 16x16 multiply-add where the result fits in 32 bits */ | 102 /** 16x16 multiply-add where the result fits in 32 bits */ |
86 #undef MAC16_16 | 103 #undef MAC16_16 |
87 static OPUS_INLINE opus_val32 MAC16_16_armv5e(opus_val32 c, opus_val16 a, | 104 static OPUS_INLINE opus_val32 MAC16_16_armv5e(opus_val32 c, opus_val16 a, |
88 opus_val16 b) | 105 opus_val16 b) |
89 { | 106 { |
90 int res; | 107 int res; |
91 __asm__( | 108 __asm__( |
92 "#MAC16_16\n\t" | 109 "#MAC16_16\n\t" |
93 "smlabb %0, %1, %2, %3;\n" | 110 "smlabb %0, %1, %2, %3;\n" |
94 : "=r"(res) | 111 : "=r"(res) |
(...skipping 11 matching lines...) Expand all Loading... |
106 __asm__( | 123 __asm__( |
107 "#MULT16_16\n\t" | 124 "#MULT16_16\n\t" |
108 "smulbb %0, %1, %2;\n" | 125 "smulbb %0, %1, %2;\n" |
109 : "=r"(res) | 126 : "=r"(res) |
110 : "r"(a), "r"(b) | 127 : "r"(a), "r"(b) |
111 ); | 128 ); |
112 return res; | 129 return res; |
113 } | 130 } |
114 #define MULT16_16(a, b) (MULT16_16_armv5e(a, b)) | 131 #define MULT16_16(a, b) (MULT16_16_armv5e(a, b)) |
115 | 132 |
| 133 #ifdef OPUS_ARM_INLINE_MEDIA |
| 134 |
| 135 #undef SIG2WORD16 |
| 136 static OPUS_INLINE opus_val16 SIG2WORD16_armv6(opus_val32 x) |
| 137 { |
| 138 celt_sig res; |
| 139 __asm__( |
| 140 "#SIG2WORD16\n\t" |
| 141 "ssat %0, #16, %1, ASR #12\n\t" |
| 142 : "=r"(res) |
| 143 : "r"(x+2048) |
| 144 ); |
| 145 return EXTRACT16(res); |
| 146 } |
| 147 #define SIG2WORD16(x) (SIG2WORD16_armv6(x)) |
| 148 |
| 149 #endif /* OPUS_ARM_INLINE_MEDIA */ |
| 150 |
116 #endif | 151 #endif |
OLD | NEW |