summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libspeex/fixed_debug.h
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-05-08 10:36:38 -0400
committerSolomon Peachy <pizza@shaftnet.org>2024-06-20 07:08:35 -0400
commit547b6a570dbad844e79b4ba5eb934f043bab6318 (patch)
tree0cbdb670d73a2544d33985166c5abfa69e20a590 /lib/rbcodec/codecs/libspeex/fixed_debug.h
parent8ef20383b1e5025f7724e750832de6e28e50680d (diff)
downloadrockbox-547b6a570dbad844e79b4ba5eb934f043bab6318.tar.gz
rockbox-547b6a570dbad844e79b4ba5eb934f043bab6318.zip
codecs: Update libspeex from 1.2beta3 to 1.2rc1
This is a relatively minor bump, but it's the first step towards bringing this current. Change-Id: Iab6c9b0c77f0ba705280434ea74b513364719499
Diffstat (limited to 'lib/rbcodec/codecs/libspeex/fixed_debug.h')
-rw-r--r--lib/rbcodec/codecs/libspeex/fixed_debug.h58
1 files changed, 29 insertions, 29 deletions
diff --git a/lib/rbcodec/codecs/libspeex/fixed_debug.h b/lib/rbcodec/codecs/libspeex/fixed_debug.h
index d5c449f4d9..4d5fe11113 100644
--- a/lib/rbcodec/codecs/libspeex/fixed_debug.h
+++ b/lib/rbcodec/codecs/libspeex/fixed_debug.h
@@ -7,18 +7,18 @@
7 Redistribution and use in source and binary forms, with or without 7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions 8 modification, are permitted provided that the following conditions
9 are met: 9 are met:
10 10
11 - Redistributions of source code must retain the above copyright 11 - Redistributions of source code must retain the above copyright
12 notice, this list of conditions and the following disclaimer. 12 notice, this list of conditions and the following disclaimer.
13 13
14 - Redistributions in binary form must reproduce the above copyright 14 - Redistributions in binary form must reproduce the above copyright
15 notice, this list of conditions and the following disclaimer in the 15 notice, this list of conditions and the following disclaimer in the
16 documentation and/or other materials provided with the distribution. 16 documentation and/or other materials provided with the distribution.
17 17
18 - Neither the name of the Xiph.org Foundation nor the names of its 18 - Neither the name of the Xiph.org Foundation nor the names of its
19 contributors may be used to endorse or promote products derived from 19 contributors may be used to endorse or promote products derived from
20 this software without specific prior written permission. 20 this software without specific prior written permission.
21 21
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -101,7 +101,7 @@ static inline int _EXTEND32(int x, char *file, int line)
101} 101}
102 102
103#define SHR16(a, shift) _SHR16(a, shift, __FILE__, __LINE__) 103#define SHR16(a, shift) _SHR16(a, shift, __FILE__, __LINE__)
104static inline short _SHR16(int a, int shift, char *file, int line) 104static inline short _SHR16(int a, int shift, char *file, int line)
105{ 105{
106 int res; 106 int res;
107 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift)) 107 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
@@ -115,7 +115,7 @@ static inline short _SHR16(int a, int shift, char *file, int line)
115 return res; 115 return res;
116} 116}
117#define SHL16(a, shift) _SHL16(a, shift, __FILE__, __LINE__) 117#define SHL16(a, shift) _SHL16(a, shift, __FILE__, __LINE__)
118static inline short _SHL16(int a, int shift, char *file, int line) 118static inline short _SHL16(int a, int shift, char *file, int line)
119{ 119{
120 int res; 120 int res;
121 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift)) 121 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
@@ -129,7 +129,7 @@ static inline short _SHL16(int a, int shift, char *file, int line)
129 return res; 129 return res;
130} 130}
131 131
132static inline int SHR32(long long a, int shift) 132static inline int SHR32(long long a, int shift)
133{ 133{
134 long long res; 134 long long res;
135 if (!VERIFY_INT(a) || !VERIFY_SHORT(shift)) 135 if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
@@ -144,7 +144,7 @@ static inline int SHR32(long long a, int shift)
144 spx_mips++; 144 spx_mips++;
145 return res; 145 return res;
146} 146}
147static inline int SHL32(long long a, int shift) 147static inline int SHL32(long long a, int shift)
148{ 148{
149 long long res; 149 long long res;
150 if (!VERIFY_INT(a) || !VERIFY_SHORT(shift)) 150 if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
@@ -161,7 +161,7 @@ static inline int SHL32(long long a, int shift)
161} 161}
162 162
163#define PSHR16(a,shift) (SHR16(ADD16((a),((1<<((shift))>>1))),shift)) 163#define PSHR16(a,shift) (SHR16(ADD16((a),((1<<((shift))>>1))),shift))
164#define PSHR32(a,shift) (SHR32(ADD32((a),((1<<((shift))>>1))),shift)) 164#define PSHR32(a,shift) (SHR32(ADD32((a),((EXTEND32(1)<<((shift))>>1))),shift))
165#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift))) 165#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift)))
166 166
167#define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x))) 167#define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
@@ -171,7 +171,7 @@ static inline int SHL32(long long a, int shift)
171//#define SHL(a,shift) ((a) << (shift)) 171//#define SHL(a,shift) ((a) << (shift))
172 172
173#define ADD16(a, b) _ADD16(a, b, __FILE__, __LINE__) 173#define ADD16(a, b) _ADD16(a, b, __FILE__, __LINE__)
174static inline short _ADD16(int a, int b, char *file, int line) 174static inline short _ADD16(int a, int b, char *file, int line)
175{ 175{
176 int res; 176 int res;
177 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) 177 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -188,7 +188,7 @@ static inline short _ADD16(int a, int b, char *file, int line)
188} 188}
189 189
190#define SUB16(a, b) _SUB16(a, b, __FILE__, __LINE__) 190#define SUB16(a, b) _SUB16(a, b, __FILE__, __LINE__)
191static inline short _SUB16(int a, int b, char *file, int line) 191static inline short _SUB16(int a, int b, char *file, int line)
192{ 192{
193 int res; 193 int res;
194 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) 194 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -203,7 +203,7 @@ static inline short _SUB16(int a, int b, char *file, int line)
203} 203}
204 204
205#define ADD32(a, b) _ADD32(a, b, __FILE__, __LINE__) 205#define ADD32(a, b) _ADD32(a, b, __FILE__, __LINE__)
206static inline int _ADD32(long long a, long long b, char *file, int line) 206static inline int _ADD32(long long a, long long b, char *file, int line)
207{ 207{
208 long long res; 208 long long res;
209 if (!VERIFY_INT(a) || !VERIFY_INT(b)) 209 if (!VERIFY_INT(a) || !VERIFY_INT(b))
@@ -219,7 +219,7 @@ static inline int _ADD32(long long a, long long b, char *file, int line)
219 return res; 219 return res;
220} 220}
221 221
222static inline int SUB32(long long a, long long b) 222static inline int SUB32(long long a, long long b)
223{ 223{
224 long long res; 224 long long res;
225 if (!VERIFY_INT(a) || !VERIFY_INT(b)) 225 if (!VERIFY_INT(a) || !VERIFY_INT(b))
@@ -236,7 +236,7 @@ static inline int SUB32(long long a, long long b)
236#define ADD64(a,b) (MIPS_INC(a)+(b)) 236#define ADD64(a,b) (MIPS_INC(a)+(b))
237 237
238/* result fits in 16 bits */ 238/* result fits in 16 bits */
239static inline short MULT16_16_16(int a, int b) 239static inline short MULT16_16_16(int a, int b)
240{ 240{
241 int res; 241 int res;
242 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) 242 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -251,7 +251,7 @@ static inline short MULT16_16_16(int a, int b)
251} 251}
252 252
253#define MULT16_16(a, b) _MULT16_16(a, b, __FILE__, __LINE__) 253#define MULT16_16(a, b) _MULT16_16(a, b, __FILE__, __LINE__)
254static inline int _MULT16_16(int a, int b, char *file, int line) 254static inline int _MULT16_16(int a, int b, char *file, int line)
255{ 255{
256 long long res; 256 long long res;
257 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) 257 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -279,8 +279,8 @@ static inline int _MULT16_32_QX(int a, long long b, int Q, char *file, int line)
279 { 279 {
280 fprintf (stderr, "MULT16_32_Q%d: inputs are not short+int: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line); 280 fprintf (stderr, "MULT16_32_Q%d: inputs are not short+int: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
281 } 281 }
282 if (ABS32(b)>=(1<<(15+Q))) 282 if (ABS32(b)>=(EXTEND32(1)<<(15+Q)))
283 fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line); 283 fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
284 res = (((long long)a)*(long long)b) >> Q; 284 res = (((long long)a)*(long long)b) >> Q;
285 if (!VERIFY_INT(res)) 285 if (!VERIFY_INT(res))
286 fprintf (stderr, "MULT16_32_Q%d: output is not int: %d*%d=%d in %s: line %d\n", Q, (int)a, (int)b,(int)res, file, line); 286 fprintf (stderr, "MULT16_32_Q%d: output is not int: %d*%d=%d in %s: line %d\n", Q, (int)a, (int)b,(int)res, file, line);
@@ -295,9 +295,9 @@ static inline int MULT16_32_PX(int a, long long b, int Q)
295 { 295 {
296 fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b); 296 fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b);
297 } 297 }
298 if (ABS32(b)>=(1<<(15+Q))) 298 if (ABS32(b)>=(EXTEND32(1)<<(15+Q)))
299 fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b); 299 fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b);
300 res = ((((long long)a)*(long long)b) + ((1<<Q)>>1))>> Q; 300 res = ((((long long)a)*(long long)b) + ((EXTEND32(1)<<Q)>>1))>> Q;
301 if (!VERIFY_INT(res)) 301 if (!VERIFY_INT(res))
302 fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res); 302 fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res);
303 spx_mips+=5; 303 spx_mips+=5;
@@ -323,7 +323,7 @@ static inline int SATURATE(int a, int b)
323 return a; 323 return a;
324} 324}
325 325
326static inline int MULT16_16_Q11_32(int a, int b) 326static inline int MULT16_16_Q11_32(int a, int b)
327{ 327{
328 long long res; 328 long long res;
329 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) 329 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -337,7 +337,7 @@ static inline int MULT16_16_Q11_32(int a, int b)
337 spx_mips+=3; 337 spx_mips+=3;
338 return res; 338 return res;
339} 339}
340static inline short MULT16_16_Q13(int a, int b) 340static inline short MULT16_16_Q13(int a, int b)
341{ 341{
342 long long res; 342 long long res;
343 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) 343 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -351,7 +351,7 @@ static inline short MULT16_16_Q13(int a, int b)
351 spx_mips+=3; 351 spx_mips+=3;
352 return res; 352 return res;
353} 353}
354static inline short MULT16_16_Q14(int a, int b) 354static inline short MULT16_16_Q14(int a, int b)
355{ 355{
356 long long res; 356 long long res;
357 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) 357 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -365,7 +365,7 @@ static inline short MULT16_16_Q14(int a, int b)
365 spx_mips+=3; 365 spx_mips+=3;
366 return res; 366 return res;
367} 367}
368static inline short MULT16_16_Q15(int a, int b) 368static inline short MULT16_16_Q15(int a, int b)
369{ 369{
370 long long res; 370 long long res;
371 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) 371 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -382,7 +382,7 @@ static inline short MULT16_16_Q15(int a, int b)
382 return res; 382 return res;
383} 383}
384 384
385static inline short MULT16_16_P13(int a, int b) 385static inline short MULT16_16_P13(int a, int b)
386{ 386{
387 long long res; 387 long long res;
388 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) 388 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -399,7 +399,7 @@ static inline short MULT16_16_P13(int a, int b)
399 spx_mips+=4; 399 spx_mips+=4;
400 return res; 400 return res;
401} 401}
402static inline short MULT16_16_P14(int a, int b) 402static inline short MULT16_16_P14(int a, int b)
403{ 403{
404 long long res; 404 long long res;
405 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) 405 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -416,7 +416,7 @@ static inline short MULT16_16_P14(int a, int b)
416 spx_mips+=4; 416 spx_mips+=4;
417 return res; 417 return res;
418} 418}
419static inline short MULT16_16_P15(int a, int b) 419static inline short MULT16_16_P15(int a, int b)
420{ 420{
421 long long res; 421 long long res;
422 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) 422 if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -436,7 +436,7 @@ static inline short MULT16_16_P15(int a, int b)
436 436
437#define DIV32_16(a, b) _DIV32_16(a, b, __FILE__, __LINE__) 437#define DIV32_16(a, b) _DIV32_16(a, b, __FILE__, __LINE__)
438 438
439static inline int _DIV32_16(long long a, long long b, char *file, int line) 439static inline int _DIV32_16(long long a, long long b, char *file, int line)
440{ 440{
441 long long res; 441 long long res;
442 if (b==0) 442 if (b==0)
@@ -462,7 +462,7 @@ static inline int _DIV32_16(long long a, long long b, char *file, int line)
462} 462}
463 463
464#define DIV32(a, b) _DIV32(a, b, __FILE__, __LINE__) 464#define DIV32(a, b) _DIV32(a, b, __FILE__, __LINE__)
465static inline int _DIV32(long long a, long long b, char *file, int line) 465static inline int _DIV32(long long a, long long b, char *file, int line)
466{ 466{
467 long long res; 467 long long res;
468 if (b==0) 468 if (b==0)