summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libopus/celt/mathops.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libopus/celt/mathops.h')
-rw-r--r--lib/rbcodec/codecs/libopus/celt/mathops.h23
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 @@
44unsigned isqrt32(opus_uint32 _val); 44unsigned isqrt32(opus_uint32 _val);
45 45
46#ifndef OVERRIDE_CELT_MAXABS16 46#ifndef OVERRIDE_CELT_MAXABS16
47static inline opus_val32 celt_maxabs16(const opus_val16 *x, int len) 47static 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
63static inline opus_val32 celt_maxabs32(const opus_val32 *x, int len) 63static 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)). */
98static inline float celt_log2(float x) 98static 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). */
116static inline float celt_exp2(float x) 116static 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 */
148static inline opus_int16 celt_ilog2(opus_int32 x) 148static 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 */
157static inline opus_int16 celt_zlog2(opus_val32 x) 157static 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
166opus_val16 celt_cos_norm(opus_val32 x); 166opus_val16 celt_cos_norm(opus_val32 x);
167 167
168static inline opus_val16 celt_log2(opus_val32 x) 168/** Base-2 logarithm approximation (log2(x)). (Q14 input, Q10 output) */
169static 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
194static inline opus_val32 celt_exp2_frac(opus_val16 x) 195static 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) */
201static inline opus_val32 celt_exp2(opus_val16 x) 202static 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 */
227static inline opus_val16 celt_atan01(opus_val16 x) 228static 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 */
238static inline opus_val16 celt_atan2p(opus_val16 y, opus_val16 x) 239static OPUS_INLINE opus_val16 celt_atan2p(opus_val16 y, opus_val16 x)
239{ 240{
240 if (y < x) 241 if (y < x)
241 { 242 {