diff options
author | Nils Wallménius <nils@rockbox.org> | 2013-12-11 22:59:14 +0100 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2013-12-16 21:13:23 +0100 |
commit | e3c2ed7a71f65dc721c7210f120259ecd4ff65cb (patch) | |
tree | de593c1e927dcc036f1b6656f1f881995491b3b9 /lib/rbcodec/codecs/libopus/celt/mathops.h | |
parent | d0918b98fa0cfba21208a4fb5ed153687b8f02c3 (diff) | |
download | rockbox-e3c2ed7a71f65dc721c7210f120259ecd4ff65cb.tar.gz rockbox-e3c2ed7a71f65dc721c7210f120259ecd4ff65cb.zip |
Sync libopus to upstream release 1.1
Change-Id: I9fea7460fc33f60faff961b3389dd97b5191463c
Diffstat (limited to 'lib/rbcodec/codecs/libopus/celt/mathops.h')
-rw-r--r-- | lib/rbcodec/codecs/libopus/celt/mathops.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/rbcodec/codecs/libopus/celt/mathops.h b/lib/rbcodec/codecs/libopus/celt/mathops.h index 44fa97c697..a0525a9610 100644 --- a/lib/rbcodec/codecs/libopus/celt/mathops.h +++ b/lib/rbcodec/codecs/libopus/celt/mathops.h | |||
@@ -44,7 +44,7 @@ | |||
44 | unsigned isqrt32(opus_uint32 _val); | 44 | unsigned isqrt32(opus_uint32 _val); |
45 | 45 | ||
46 | #ifndef OVERRIDE_CELT_MAXABS16 | 46 | #ifndef OVERRIDE_CELT_MAXABS16 |
47 | static inline opus_val32 celt_maxabs16(const opus_val16 *x, int len) | 47 | static OPUS_INLINE opus_val32 celt_maxabs16(const opus_val16 *x, int len) |
48 | { | 48 | { |
49 | int i; | 49 | int i; |
50 | opus_val16 maxval = 0; | 50 | opus_val16 maxval = 0; |
@@ -60,7 +60,7 @@ static inline opus_val32 celt_maxabs16(const opus_val16 *x, int len) | |||
60 | 60 | ||
61 | #ifndef OVERRIDE_CELT_MAXABS32 | 61 | #ifndef OVERRIDE_CELT_MAXABS32 |
62 | #ifdef FIXED_POINT | 62 | #ifdef FIXED_POINT |
63 | static inline opus_val32 celt_maxabs32(const opus_val32 *x, int len) | 63 | static OPUS_INLINE opus_val32 celt_maxabs32(const opus_val32 *x, int len) |
64 | { | 64 | { |
65 | int i; | 65 | int i; |
66 | opus_val32 maxval = 0; | 66 | opus_val32 maxval = 0; |
@@ -95,7 +95,7 @@ static inline opus_val32 celt_maxabs32(const opus_val32 *x, int len) | |||
95 | denorm, +/- inf and NaN are *not* handled */ | 95 | denorm, +/- inf and NaN are *not* handled */ |
96 | 96 | ||
97 | /** Base-2 log approximation (log2(x)). */ | 97 | /** Base-2 log approximation (log2(x)). */ |
98 | static inline float celt_log2(float x) | 98 | static OPUS_INLINE float celt_log2(float x) |
99 | { | 99 | { |
100 | int integer; | 100 | int integer; |
101 | float frac; | 101 | float frac; |
@@ -113,7 +113,7 @@ static inline float celt_log2(float x) | |||
113 | } | 113 | } |
114 | 114 | ||
115 | /** Base-2 exponential approximation (2^x). */ | 115 | /** Base-2 exponential approximation (2^x). */ |
116 | static inline float celt_exp2(float x) | 116 | static OPUS_INLINE float celt_exp2(float x) |
117 | { | 117 | { |
118 | int integer; | 118 | int integer; |
119 | float frac; | 119 | float frac; |
@@ -145,7 +145,7 @@ static inline float celt_exp2(float x) | |||
145 | 145 | ||
146 | #ifndef OVERRIDE_CELT_ILOG2 | 146 | #ifndef OVERRIDE_CELT_ILOG2 |
147 | /** Integer log in base2. Undefined for zero and negative numbers */ | 147 | /** Integer log in base2. Undefined for zero and negative numbers */ |
148 | static inline opus_int16 celt_ilog2(opus_int32 x) | 148 | static OPUS_INLINE opus_int16 celt_ilog2(opus_int32 x) |
149 | { | 149 | { |
150 | celt_assert2(x>0, "celt_ilog2() only defined for strictly positive numbers"); | 150 | celt_assert2(x>0, "celt_ilog2() only defined for strictly positive numbers"); |
151 | return EC_ILOG(x)-1; | 151 | return EC_ILOG(x)-1; |
@@ -154,7 +154,7 @@ static inline opus_int16 celt_ilog2(opus_int32 x) | |||
154 | 154 | ||
155 | 155 | ||
156 | /** Integer log in base2. Defined for zero, but not for negative numbers */ | 156 | /** Integer log in base2. Defined for zero, but not for negative numbers */ |
157 | static inline opus_int16 celt_zlog2(opus_val32 x) | 157 | static OPUS_INLINE opus_int16 celt_zlog2(opus_val32 x) |
158 | { | 158 | { |
159 | return x <= 0 ? 0 : celt_ilog2(x); | 159 | return x <= 0 ? 0 : celt_ilog2(x); |
160 | } | 160 | } |
@@ -165,7 +165,8 @@ opus_val32 celt_sqrt(opus_val32 x); | |||
165 | 165 | ||
166 | opus_val16 celt_cos_norm(opus_val32 x); | 166 | opus_val16 celt_cos_norm(opus_val32 x); |
167 | 167 | ||
168 | static inline opus_val16 celt_log2(opus_val32 x) | 168 | /** Base-2 logarithm approximation (log2(x)). (Q14 input, Q10 output) */ |
169 | static OPUS_INLINE opus_val16 celt_log2(opus_val32 x) | ||
169 | { | 170 | { |
170 | int i; | 171 | int i; |
171 | opus_val16 n, frac; | 172 | opus_val16 n, frac; |
@@ -191,14 +192,14 @@ static inline opus_val16 celt_log2(opus_val32 x) | |||
191 | #define D2 14819 | 192 | #define D2 14819 |
192 | #define D3 10204 | 193 | #define D3 10204 |
193 | 194 | ||
194 | static inline opus_val32 celt_exp2_frac(opus_val16 x) | 195 | static OPUS_INLINE opus_val32 celt_exp2_frac(opus_val16 x) |
195 | { | 196 | { |
196 | opus_val16 frac; | 197 | opus_val16 frac; |
197 | frac = SHL16(x, 4); | 198 | frac = SHL16(x, 4); |
198 | return ADD16(D0, MULT16_16_Q15(frac, ADD16(D1, MULT16_16_Q15(frac, ADD16(D2 , MULT16_16_Q15(D3,frac)))))); | 199 | return ADD16(D0, MULT16_16_Q15(frac, ADD16(D1, MULT16_16_Q15(frac, ADD16(D2 , MULT16_16_Q15(D3,frac)))))); |
199 | } | 200 | } |
200 | /** Base-2 exponential approximation (2^x). (Q10 input, Q16 output) */ | 201 | /** Base-2 exponential approximation (2^x). (Q10 input, Q16 output) */ |
201 | static inline opus_val32 celt_exp2(opus_val16 x) | 202 | static OPUS_INLINE opus_val32 celt_exp2(opus_val16 x) |
202 | { | 203 | { |
203 | int integer; | 204 | int integer; |
204 | opus_val16 frac; | 205 | opus_val16 frac; |
@@ -224,7 +225,7 @@ opus_val32 frac_div32(opus_val32 a, opus_val32 b); | |||
224 | 225 | ||
225 | /* Atan approximation using a 4th order polynomial. Input is in Q15 format | 226 | /* Atan approximation using a 4th order polynomial. Input is in Q15 format |
226 | and normalized by pi/4. Output is in Q15 format */ | 227 | and normalized by pi/4. Output is in Q15 format */ |
227 | static inline opus_val16 celt_atan01(opus_val16 x) | 228 | static OPUS_INLINE opus_val16 celt_atan01(opus_val16 x) |
228 | { | 229 | { |
229 | return MULT16_16_P15(x, ADD32(M1, MULT16_16_P15(x, ADD32(M2, MULT16_16_P15(x, ADD32(M3, MULT16_16_P15(M4, x))))))); | 230 | return MULT16_16_P15(x, ADD32(M1, MULT16_16_P15(x, ADD32(M2, MULT16_16_P15(x, ADD32(M3, MULT16_16_P15(M4, x))))))); |
230 | } | 231 | } |
@@ -235,7 +236,7 @@ static inline opus_val16 celt_atan01(opus_val16 x) | |||
235 | #undef M4 | 236 | #undef M4 |
236 | 237 | ||
237 | /* atan2() approximation valid for positive input values */ | 238 | /* atan2() approximation valid for positive input values */ |
238 | static inline opus_val16 celt_atan2p(opus_val16 y, opus_val16 x) | 239 | static OPUS_INLINE opus_val16 celt_atan2p(opus_val16 y, opus_val16 x) |
239 | { | 240 | { |
240 | if (y < x) | 241 | if (y < x) |
241 | { | 242 | { |