Replace "inline" with OPUS_INLINE.

Newer versions of MSVC are unhappy with the strategy of the build
 environment redefining "inline" (even though they don't support the
 actual keyword). Instead we define OPUS_INLINE to the right thing
 in opus_defines.h.

This is the same approach we use for restrict.
This commit is contained in:
Gregory Maxwell 2013-10-17 15:56:52 -07:00
parent 2891d852a3
commit 7830cf1bd2
65 changed files with 361 additions and 335 deletions

View file

@ -12,9 +12,7 @@ CFLAGS := -DUSE_ALLOCA $(CFLAGS)
# These options affect performance # These options affect performance
# HAVE_LRINTF: Use C99 intrinsics to speed up float-to-int conversion # HAVE_LRINTF: Use C99 intrinsics to speed up float-to-int conversion
# inline: Don't use the 'inline' keyword (for ANSI C compilers)
#CFLAGS := -DHAVE_LRINTF $(CFLAGS) #CFLAGS := -DHAVE_LRINTF $(CFLAGS)
#CFLAGS := -Dinline= $(CFLAGS)
###################### END OF OPTIONS ###################### ###################### END OF OPTIONS ######################

View file

@ -35,6 +35,7 @@
#define ARCH_H #define ARCH_H
#include "opus_types.h" #include "opus_types.h"
#include "opus_defines.h"
# if !defined(__GNUC_PREREQ) # if !defined(__GNUC_PREREQ)
# if defined(__GNUC__)&&defined(__GNUC_MINOR__) # if defined(__GNUC__)&&defined(__GNUC_MINOR__)
@ -54,7 +55,7 @@
#ifdef __GNUC__ #ifdef __GNUC__
__attribute__((noreturn)) __attribute__((noreturn))
#endif #endif
static inline void _celt_fatal(const char *str, const char *file, int line) static OPUS_INLINE void _celt_fatal(const char *str, const char *file, int line)
{ {
fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str); fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str);
abort(); abort();

View file

@ -49,10 +49,10 @@
# define WIN32_EXTRA_LEAN # define WIN32_EXTRA_LEAN
# include <windows.h> # include <windows.h>
static inline opus_uint32 opus_cpu_capabilities(void){ static OPUS_INLINE opus_uint32 opus_cpu_capabilities(void){
opus_uint32 flags; opus_uint32 flags;
flags=0; flags=0;
/* MSVC has no inline __asm support for ARM, but it does let you __emit /* MSVC has no OPUS_INLINE __asm support for ARM, but it does let you __emit
* instructions via their assembled hex code. * instructions via their assembled hex code.
* All of these instructions should be essentially nops. */ * All of these instructions should be essentially nops. */
# if defined(ARMv5E_ASM) # if defined(ARMv5E_ASM)

View file

@ -29,7 +29,7 @@
/** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 bits */ /** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 bits */
#undef MULT16_32_Q16 #undef MULT16_32_Q16
static inline opus_val32 MULT16_32_Q16_armv4(opus_val16 a, opus_val32 b) static OPUS_INLINE opus_val32 MULT16_32_Q16_armv4(opus_val16 a, opus_val32 b)
{ {
unsigned rd_lo; unsigned rd_lo;
int rd_hi; int rd_hi;
@ -46,7 +46,7 @@ static inline opus_val32 MULT16_32_Q16_armv4(opus_val16 a, opus_val32 b)
/** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 bits */ /** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 bits */
#undef MULT16_32_Q15 #undef MULT16_32_Q15
static inline opus_val32 MULT16_32_Q15_armv4(opus_val16 a, opus_val32 b) static OPUS_INLINE opus_val32 MULT16_32_Q15_armv4(opus_val16 a, opus_val32 b)
{ {
unsigned rd_lo; unsigned rd_lo;
int rd_hi; int rd_hi;

View file

@ -34,7 +34,7 @@
/** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 bits */ /** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 bits */
#undef MULT16_32_Q16 #undef MULT16_32_Q16
static inline opus_val32 MULT16_32_Q16_armv5e(opus_val16 a, opus_val32 b) static OPUS_INLINE opus_val32 MULT16_32_Q16_armv5e(opus_val16 a, opus_val32 b)
{ {
int res; int res;
__asm__( __asm__(
@ -50,7 +50,7 @@ static inline opus_val32 MULT16_32_Q16_armv5e(opus_val16 a, opus_val32 b)
/** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 bits */ /** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 bits */
#undef MULT16_32_Q15 #undef MULT16_32_Q15
static inline opus_val32 MULT16_32_Q15_armv5e(opus_val16 a, opus_val32 b) static OPUS_INLINE opus_val32 MULT16_32_Q15_armv5e(opus_val16 a, opus_val32 b)
{ {
int res; int res;
__asm__( __asm__(
@ -68,7 +68,7 @@ static inline opus_val32 MULT16_32_Q15_armv5e(opus_val16 a, opus_val32 b)
b must fit in 31 bits. b must fit in 31 bits.
Result fits in 32 bits. */ Result fits in 32 bits. */
#undef MAC16_32_Q15 #undef MAC16_32_Q15
static inline opus_val32 MAC16_32_Q15_armv5e(opus_val32 c, opus_val16 a, static OPUS_INLINE opus_val32 MAC16_32_Q15_armv5e(opus_val32 c, opus_val16 a,
opus_val32 b) opus_val32 b)
{ {
int res; int res;
@ -84,7 +84,7 @@ static inline opus_val32 MAC16_32_Q15_armv5e(opus_val32 c, opus_val16 a,
/** 16x16 multiply-add where the result fits in 32 bits */ /** 16x16 multiply-add where the result fits in 32 bits */
#undef MAC16_16 #undef MAC16_16
static inline opus_val32 MAC16_16_armv5e(opus_val32 c, opus_val16 a, static OPUS_INLINE opus_val32 MAC16_16_armv5e(opus_val32 c, opus_val16 a,
opus_val16 b) opus_val16 b)
{ {
int res; int res;
@ -100,7 +100,7 @@ static inline opus_val32 MAC16_16_armv5e(opus_val32 c, opus_val16 a,
/** 16x16 multiplication where the result fits in 32 bits */ /** 16x16 multiplication where the result fits in 32 bits */
#undef MULT16_16 #undef MULT16_16
static inline opus_val32 MULT16_16_armv5e(opus_val16 a, opus_val16 b) static OPUS_INLINE opus_val32 MULT16_16_armv5e(opus_val16 a, opus_val16 b)
{ {
int res; int res;
__asm__( __asm__(

View file

@ -138,7 +138,7 @@ int celt_decode_with_ec(OpusCustomDecoder * OPUS_RESTRICT st, const unsigned cha
#ifdef CUSTOM_MODES #ifdef CUSTOM_MODES
#define OPUS_CUSTOM_NOSTATIC #define OPUS_CUSTOM_NOSTATIC
#else #else
#define OPUS_CUSTOM_NOSTATIC static inline #define OPUS_CUSTOM_NOSTATIC static OPUS_INLINE
#endif #endif
static const unsigned char trim_icdf[11] = {126, 124, 119, 109, 87, 41, 19, 9, 4, 2, 0}; static const unsigned char trim_icdf[11] = {126, 124, 119, 109, 87, 41, 19, 9, 4, 2, 0};
@ -163,7 +163,7 @@ static const unsigned char fromOpusTable[16] = {
0x00, 0x08, 0x10, 0x18 0x00, 0x08, 0x10, 0x18
}; };
static inline int toOpus(unsigned char c) static OPUS_INLINE int toOpus(unsigned char c)
{ {
int ret=0; int ret=0;
if (c<0xA0) if (c<0xA0)
@ -174,7 +174,7 @@ static inline int toOpus(unsigned char c)
return ret|(c&0x7); return ret|(c&0x7);
} }
static inline int fromOpus(unsigned char c) static OPUS_INLINE int fromOpus(unsigned char c)
{ {
if (c<0x80) if (c<0x80)
return -1; return -1;

View file

@ -175,7 +175,7 @@ void opus_custom_decoder_destroy(CELTDecoder *st)
} }
#endif /* CUSTOM_MODES */ #endif /* CUSTOM_MODES */
static inline opus_val16 SIG2WORD16(celt_sig x) static OPUS_INLINE opus_val16 SIG2WORD16(celt_sig x)
{ {
#ifdef FIXED_POINT #ifdef FIXED_POINT
x = PSHR32(x, SIG_SHIFT); x = PSHR32(x, SIG_SHIFT);

View file

@ -28,6 +28,9 @@
#ifndef CPU_SUPPORT_H #ifndef CPU_SUPPORT_H
#define CPU_SUPPORT_H #define CPU_SUPPORT_H
#include "opus_types.h"
#include "opus_defines.h"
#if defined(OPUS_HAVE_RTCD) && defined(ARMv4_ASM) #if defined(OPUS_HAVE_RTCD) && defined(ARMv4_ASM)
#include "arm/armcpu.h" #include "arm/armcpu.h"
@ -42,7 +45,7 @@
#else #else
#define OPUS_ARCHMASK 0 #define OPUS_ARCHMASK 0
static inline int opus_select_arch(void) static OPUS_INLINE int opus_select_arch(void)
{ {
return 0; return 0;
} }

View file

@ -534,7 +534,7 @@ void decode_pulses(int *_y,int _n,int _k,ec_dec *_dec){
/*Computes the next row/column of any recurrence that obeys the relation /*Computes the next row/column of any recurrence that obeys the relation
u[i][j]=u[i-1][j]+u[i][j-1]+u[i-1][j-1]. u[i][j]=u[i-1][j]+u[i][j-1]+u[i-1][j-1].
_ui0 is the base case for the new row/column.*/ _ui0 is the base case for the new row/column.*/
static inline void unext(opus_uint32 *_ui,unsigned _len,opus_uint32 _ui0){ static OPUS_INLINE void unext(opus_uint32 *_ui,unsigned _len,opus_uint32 _ui0){
opus_uint32 ui1; opus_uint32 ui1;
unsigned j; unsigned j;
/*This do-while will overrun the array if we don't have storage for at least /*This do-while will overrun the array if we don't have storage for at least
@ -550,7 +550,7 @@ static inline void unext(opus_uint32 *_ui,unsigned _len,opus_uint32 _ui0){
/*Computes the previous row/column of any recurrence that obeys the relation /*Computes the previous row/column of any recurrence that obeys the relation
u[i-1][j]=u[i][j]-u[i][j-1]-u[i-1][j-1]. u[i-1][j]=u[i][j]-u[i][j-1]-u[i-1][j-1].
_ui0 is the base case for the new row/column.*/ _ui0 is the base case for the new row/column.*/
static inline void uprev(opus_uint32 *_ui,unsigned _n,opus_uint32 _ui0){ static OPUS_INLINE void uprev(opus_uint32 *_ui,unsigned _n,opus_uint32 _ui0){
opus_uint32 ui1; opus_uint32 ui1;
unsigned j; unsigned j;
/*This do-while will overrun the array if we don't have storage for at least /*This do-while will overrun the array if we don't have storage for at least
@ -617,7 +617,7 @@ static void cwrsi(int _n,int _k,opus_uint32 _i,int *_y,opus_uint32 *_u){
of size 1 with associated sign bits. of size 1 with associated sign bits.
_y: The vector of pulses, whose sum of absolute values is K. _y: The vector of pulses, whose sum of absolute values is K.
_k: Returns K.*/ _k: Returns K.*/
static inline opus_uint32 icwrs1(const int *_y,int *_k){ static OPUS_INLINE opus_uint32 icwrs1(const int *_y,int *_k){
*_k=abs(_y[0]); *_k=abs(_y[0]);
return _y[0]<0; return _y[0]<0;
} }
@ -626,7 +626,7 @@ static inline opus_uint32 icwrs1(const int *_y,int *_k){
of size _n with associated sign bits. of size _n with associated sign bits.
_y: The vector of pulses, whose sum of absolute values must be _k. _y: The vector of pulses, whose sum of absolute values must be _k.
_nc: Returns V(_n,_k).*/ _nc: Returns V(_n,_k).*/
static inline opus_uint32 icwrs(int _n,int _k,opus_uint32 *_nc,const int *_y, static OPUS_INLINE opus_uint32 icwrs(int _n,int _k,opus_uint32 *_nc,const int *_y,
opus_uint32 *_u){ opus_uint32 *_u){
opus_uint32 i; opus_uint32 i;
int j; int j;

View file

@ -33,7 +33,7 @@
#if !defined(_ecintrin_H) #if !defined(_ecintrin_H)
# define _ecintrin_H (1) # define _ecintrin_H (1)
/*Some specific platforms may have optimized intrinsic or inline assembly /*Some specific platforms may have optimized intrinsic or OPUS_INLINE assembly
versions of these functions which can substantially improve performance. versions of these functions which can substantially improve performance.
We define macros for them to allow easy incorporation of these non-ANSI We define macros for them to allow easy incorporation of these non-ANSI
features.*/ features.*/

View file

@ -26,6 +26,7 @@
*/ */
#include "opus_types.h" #include "opus_types.h"
#include "opus_defines.h"
#if !defined(_entcode_H) #if !defined(_entcode_H)
# define _entcode_H (1) # define _entcode_H (1)
@ -83,15 +84,15 @@ struct ec_ctx{
int error; int error;
}; };
static inline opus_uint32 ec_range_bytes(ec_ctx *_this){ static OPUS_INLINE opus_uint32 ec_range_bytes(ec_ctx *_this){
return _this->offs; return _this->offs;
} }
static inline unsigned char *ec_get_buffer(ec_ctx *_this){ static OPUS_INLINE unsigned char *ec_get_buffer(ec_ctx *_this){
return _this->buf; return _this->buf;
} }
static inline int ec_get_error(ec_ctx *_this){ static OPUS_INLINE int ec_get_error(ec_ctx *_this){
return _this->error; return _this->error;
} }
@ -101,7 +102,7 @@ static inline int ec_get_error(ec_ctx *_this){
Return: The number of bits. Return: The number of bits.
This will always be slightly larger than the exact value (e.g., all This will always be slightly larger than the exact value (e.g., all
rounding error is in the positive direction).*/ rounding error is in the positive direction).*/
static inline int ec_tell(ec_ctx *_this){ static OPUS_INLINE int ec_tell(ec_ctx *_this){
return _this->nbits_total-EC_ILOG(_this->rng); return _this->nbits_total-EC_ILOG(_this->rng);
} }

View file

@ -34,7 +34,7 @@
#include "dsplib.h" #include "dsplib.h"
#undef IMUL32 #undef IMUL32
static inline long IMUL32(long i, long j) static OPUS_INLINE long IMUL32(long i, long j)
{ {
long ac0, ac1; long ac0, ac1;
ac0 = _lmpy(i>>16,j); ac0 = _lmpy(i>>16,j);

View file

@ -33,9 +33,9 @@
#define FIXED_DEBUG_H #define FIXED_DEBUG_H
#include <stdio.h> #include <stdio.h>
#include "opus_defines.h"
#ifdef CELT_C #ifdef CELT_C
#include "opus_defines.h"
OPUS_EXPORT opus_int64 celt_mips=0; OPUS_EXPORT opus_int64 celt_mips=0;
#else #else
extern opus_int64 celt_mips; extern opus_int64 celt_mips;
@ -59,7 +59,7 @@ extern opus_int64 celt_mips;
#define SHR(a,b) SHR32(a,b) #define SHR(a,b) SHR32(a,b)
#define PSHR(a,b) PSHR32(a,b) #define PSHR(a,b) PSHR32(a,b)
static inline short NEG16(int x) static OPUS_INLINE short NEG16(int x)
{ {
int res; int res;
if (!VERIFY_SHORT(x)) if (!VERIFY_SHORT(x))
@ -80,7 +80,7 @@ static inline short NEG16(int x)
celt_mips++; celt_mips++;
return res; return res;
} }
static inline int NEG32(opus_int64 x) static OPUS_INLINE int NEG32(opus_int64 x)
{ {
opus_int64 res; opus_int64 res;
if (!VERIFY_INT(x)) if (!VERIFY_INT(x))
@ -103,7 +103,7 @@ static inline int NEG32(opus_int64 x)
} }
#define EXTRACT16(x) EXTRACT16_(x, __FILE__, __LINE__) #define EXTRACT16(x) EXTRACT16_(x, __FILE__, __LINE__)
static inline short EXTRACT16_(int x, char *file, int line) static OPUS_INLINE short EXTRACT16_(int x, char *file, int line)
{ {
int res; int res;
if (!VERIFY_SHORT(x)) if (!VERIFY_SHORT(x))
@ -119,7 +119,7 @@ static inline short EXTRACT16_(int x, char *file, int line)
} }
#define EXTEND32(x) EXTEND32_(x, __FILE__, __LINE__) #define EXTEND32(x) EXTEND32_(x, __FILE__, __LINE__)
static inline int EXTEND32_(int x, char *file, int line) static OPUS_INLINE int EXTEND32_(int x, char *file, int line)
{ {
int res; int res;
if (!VERIFY_SHORT(x)) if (!VERIFY_SHORT(x))
@ -135,7 +135,7 @@ static inline int EXTEND32_(int x, char *file, int line)
} }
#define SHR16(a, shift) SHR16_(a, shift, __FILE__, __LINE__) #define SHR16(a, shift) SHR16_(a, shift, __FILE__, __LINE__)
static inline short SHR16_(int a, int shift, char *file, int line) static OPUS_INLINE short SHR16_(int a, int shift, char *file, int line)
{ {
int res; int res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift)) if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
@ -157,7 +157,7 @@ static inline short SHR16_(int a, int shift, char *file, int line)
return res; return res;
} }
#define SHL16(a, shift) SHL16_(a, shift, __FILE__, __LINE__) #define SHL16(a, shift) SHL16_(a, shift, __FILE__, __LINE__)
static inline short SHL16_(int a, int shift, char *file, int line) static OPUS_INLINE short SHL16_(int a, int shift, char *file, int line)
{ {
int res; int res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift)) if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
@ -179,7 +179,7 @@ static inline short SHL16_(int a, int shift, char *file, int line)
return res; return res;
} }
static inline int SHR32(opus_int64 a, int shift) static OPUS_INLINE int SHR32(opus_int64 a, int shift)
{ {
opus_int64 res; opus_int64 res;
if (!VERIFY_INT(a) || !VERIFY_SHORT(shift)) if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
@ -201,7 +201,7 @@ static inline int SHR32(opus_int64 a, int shift)
return res; return res;
} }
#define SHL32(a, shift) SHL32_(a, shift, __FILE__, __LINE__) #define SHL32(a, shift) SHL32_(a, shift, __FILE__, __LINE__)
static inline int SHL32_(opus_int64 a, int shift, char *file, int line) static OPUS_INLINE int SHL32_(opus_int64 a, int shift, char *file, int line)
{ {
opus_int64 res; opus_int64 res;
if (!VERIFY_INT(a) || !VERIFY_SHORT(shift)) if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
@ -234,7 +234,7 @@ static inline int SHL32_(opus_int64 a, int shift, char *file, int line)
//#define SHL(a,shift) ((a) << (shift)) //#define SHL(a,shift) ((a) << (shift))
#define ADD16(a, b) ADD16_(a, b, __FILE__, __LINE__) #define ADD16(a, b) ADD16_(a, b, __FILE__, __LINE__)
static inline short ADD16_(int a, int b, char *file, int line) static OPUS_INLINE short ADD16_(int a, int b, char *file, int line)
{ {
int res; int res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@ -257,7 +257,7 @@ static inline short ADD16_(int a, int b, char *file, int line)
} }
#define SUB16(a, b) SUB16_(a, b, __FILE__, __LINE__) #define SUB16(a, b) SUB16_(a, b, __FILE__, __LINE__)
static inline short SUB16_(int a, int b, char *file, int line) static OPUS_INLINE short SUB16_(int a, int b, char *file, int line)
{ {
int res; int res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@ -280,7 +280,7 @@ static inline short SUB16_(int a, int b, char *file, int line)
} }
#define ADD32(a, b) ADD32_(a, b, __FILE__, __LINE__) #define ADD32(a, b) ADD32_(a, b, __FILE__, __LINE__)
static inline int ADD32_(opus_int64 a, opus_int64 b, char *file, int line) static OPUS_INLINE int ADD32_(opus_int64 a, opus_int64 b, char *file, int line)
{ {
opus_int64 res; opus_int64 res;
if (!VERIFY_INT(a) || !VERIFY_INT(b)) if (!VERIFY_INT(a) || !VERIFY_INT(b))
@ -303,7 +303,7 @@ static inline int ADD32_(opus_int64 a, opus_int64 b, char *file, int line)
} }
#define SUB32(a, b) SUB32_(a, b, __FILE__, __LINE__) #define SUB32(a, b) SUB32_(a, b, __FILE__, __LINE__)
static inline int SUB32_(opus_int64 a, opus_int64 b, char *file, int line) static OPUS_INLINE int SUB32_(opus_int64 a, opus_int64 b, char *file, int line)
{ {
opus_int64 res; opus_int64 res;
if (!VERIFY_INT(a) || !VERIFY_INT(b)) if (!VERIFY_INT(a) || !VERIFY_INT(b))
@ -327,7 +327,7 @@ static inline int SUB32_(opus_int64 a, opus_int64 b, char *file, int line)
#undef UADD32 #undef UADD32
#define UADD32(a, b) UADD32_(a, b, __FILE__, __LINE__) #define UADD32(a, b) UADD32_(a, b, __FILE__, __LINE__)
static inline unsigned int UADD32_(opus_uint64 a, opus_uint64 b, char *file, int line) static OPUS_INLINE unsigned int UADD32_(opus_uint64 a, opus_uint64 b, char *file, int line)
{ {
opus_uint64 res; opus_uint64 res;
if (!VERIFY_UINT(a) || !VERIFY_UINT(b)) if (!VERIFY_UINT(a) || !VERIFY_UINT(b))
@ -351,7 +351,7 @@ static inline unsigned int UADD32_(opus_uint64 a, opus_uint64 b, char *file, int
#undef USUB32 #undef USUB32
#define USUB32(a, b) USUB32_(a, b, __FILE__, __LINE__) #define USUB32(a, b) USUB32_(a, b, __FILE__, __LINE__)
static inline unsigned int USUB32_(opus_uint64 a, opus_uint64 b, char *file, int line) static OPUS_INLINE unsigned int USUB32_(opus_uint64 a, opus_uint64 b, char *file, int line)
{ {
opus_uint64 res; opus_uint64 res;
if (!VERIFY_UINT(a) || !VERIFY_UINT(b)) if (!VERIFY_UINT(a) || !VERIFY_UINT(b))
@ -381,7 +381,7 @@ static inline unsigned int USUB32_(opus_uint64 a, opus_uint64 b, char *file, int
} }
/* result fits in 16 bits */ /* result fits in 16 bits */
static inline short MULT16_16_16(int a, int b) static OPUS_INLINE short MULT16_16_16(int a, int b)
{ {
int res; int res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@ -404,7 +404,7 @@ static inline short MULT16_16_16(int a, int b)
} }
#define MULT16_16(a, b) MULT16_16_(a, b, __FILE__, __LINE__) #define MULT16_16(a, b) MULT16_16_(a, b, __FILE__, __LINE__)
static inline int MULT16_16_(int a, int b, char *file, int line) static OPUS_INLINE int MULT16_16_(int a, int b, char *file, int line)
{ {
opus_int64 res; opus_int64 res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@ -429,7 +429,7 @@ static inline int MULT16_16_(int a, int b, char *file, int line)
#define MAC16_16(c,a,b) (celt_mips-=2,ADD32((c),MULT16_16((a),(b)))) #define MAC16_16(c,a,b) (celt_mips-=2,ADD32((c),MULT16_16((a),(b))))
#define MULT16_32_QX(a, b, Q) MULT16_32_QX_(a, b, Q, __FILE__, __LINE__) #define MULT16_32_QX(a, b, Q) MULT16_32_QX_(a, b, Q, __FILE__, __LINE__)
static inline int MULT16_32_QX_(int a, opus_int64 b, int Q, char *file, int line) static OPUS_INLINE int MULT16_32_QX_(int a, opus_int64 b, int Q, char *file, int line)
{ {
opus_int64 res; opus_int64 res;
if (!VERIFY_SHORT(a) || !VERIFY_INT(b)) if (!VERIFY_SHORT(a) || !VERIFY_INT(b))
@ -462,7 +462,7 @@ static inline int MULT16_32_QX_(int a, opus_int64 b, int Q, char *file, int line
} }
#define MULT16_32_PX(a, b, Q) MULT16_32_PX_(a, b, Q, __FILE__, __LINE__) #define MULT16_32_PX(a, b, Q) MULT16_32_PX_(a, b, Q, __FILE__, __LINE__)
static inline int MULT16_32_PX_(int a, opus_int64 b, int Q, char *file, int line) static OPUS_INLINE int MULT16_32_PX_(int a, opus_int64 b, int Q, char *file, int line)
{ {
opus_int64 res; opus_int64 res;
if (!VERIFY_SHORT(a) || !VERIFY_INT(b)) if (!VERIFY_SHORT(a) || !VERIFY_INT(b))
@ -497,7 +497,7 @@ static inline int MULT16_32_PX_(int a, opus_int64 b, int Q, char *file, int line
#define MULT16_32_Q15(a,b) MULT16_32_QX(a,b,15) #define MULT16_32_Q15(a,b) MULT16_32_QX(a,b,15)
#define MAC16_32_Q15(c,a,b) (celt_mips-=2,ADD32((c),MULT16_32_Q15((a),(b)))) #define MAC16_32_Q15(c,a,b) (celt_mips-=2,ADD32((c),MULT16_32_Q15((a),(b))))
static inline int SATURATE(int a, int b) static OPUS_INLINE int SATURATE(int a, int b)
{ {
if (a>b) if (a>b)
a=b; a=b;
@ -507,7 +507,7 @@ static inline int SATURATE(int a, int b)
return a; return a;
} }
static inline int MULT16_16_Q11_32(int a, int b) static OPUS_INLINE int MULT16_16_Q11_32(int a, int b)
{ {
opus_int64 res; opus_int64 res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@ -529,7 +529,7 @@ static inline int MULT16_16_Q11_32(int a, int b)
celt_mips+=3; celt_mips+=3;
return res; return res;
} }
static inline short MULT16_16_Q13(int a, int b) static OPUS_INLINE short MULT16_16_Q13(int a, int b)
{ {
opus_int64 res; opus_int64 res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@ -551,7 +551,7 @@ static inline short MULT16_16_Q13(int a, int b)
celt_mips+=3; celt_mips+=3;
return res; return res;
} }
static inline short MULT16_16_Q14(int a, int b) static OPUS_INLINE short MULT16_16_Q14(int a, int b)
{ {
opus_int64 res; opus_int64 res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@ -575,7 +575,7 @@ static inline short MULT16_16_Q14(int a, int b)
} }
#define MULT16_16_Q15(a, b) MULT16_16_Q15_(a, b, __FILE__, __LINE__) #define MULT16_16_Q15(a, b) MULT16_16_Q15_(a, b, __FILE__, __LINE__)
static inline short MULT16_16_Q15_(int a, int b, char *file, int line) static OPUS_INLINE short MULT16_16_Q15_(int a, int b, char *file, int line)
{ {
opus_int64 res; opus_int64 res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@ -598,7 +598,7 @@ static inline short MULT16_16_Q15_(int a, int b, char *file, int line)
return res; return res;
} }
static inline short MULT16_16_P13(int a, int b) static OPUS_INLINE short MULT16_16_P13(int a, int b)
{ {
opus_int64 res; opus_int64 res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@ -628,7 +628,7 @@ static inline short MULT16_16_P13(int a, int b)
celt_mips+=4; celt_mips+=4;
return res; return res;
} }
static inline short MULT16_16_P14(int a, int b) static OPUS_INLINE short MULT16_16_P14(int a, int b)
{ {
opus_int64 res; opus_int64 res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@ -658,7 +658,7 @@ static inline short MULT16_16_P14(int a, int b)
celt_mips+=4; celt_mips+=4;
return res; return res;
} }
static inline short MULT16_16_P15(int a, int b) static OPUS_INLINE short MULT16_16_P15(int a, int b)
{ {
opus_int64 res; opus_int64 res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@ -691,7 +691,7 @@ static inline short MULT16_16_P15(int a, int b)
#define DIV32_16(a, b) DIV32_16_(a, b, __FILE__, __LINE__) #define DIV32_16(a, b) DIV32_16_(a, b, __FILE__, __LINE__)
static inline int DIV32_16_(opus_int64 a, opus_int64 b, char *file, int line) static OPUS_INLINE int DIV32_16_(opus_int64 a, opus_int64 b, char *file, int line)
{ {
opus_int64 res; opus_int64 res;
if (b==0) if (b==0)
@ -726,7 +726,7 @@ static inline int DIV32_16_(opus_int64 a, opus_int64 b, char *file, int line)
} }
#define DIV32(a, b) DIV32_(a, b, __FILE__, __LINE__) #define DIV32(a, b) DIV32_(a, b, __FILE__, __LINE__)
static inline int DIV32_(opus_int64 a, opus_int64 b, char *file, int line) static OPUS_INLINE int DIV32_(opus_int64 a, opus_int64 b, char *file, int line)
{ {
opus_int64 res; opus_int64 res;
if (b==0) if (b==0)

View file

@ -101,7 +101,7 @@
#include <math.h> #include <math.h>
/* Win32 doesn't seem to have these functions. /* Win32 doesn't seem to have these functions.
** Therefore implement inline versions of these functions here. ** Therefore implement OPUS_INLINE versions of these functions here.
*/ */
__inline long int __inline long int
@ -128,7 +128,7 @@
#endif #endif
#ifndef DISABLE_FLOAT_API #ifndef DISABLE_FLOAT_API
static inline opus_int16 FLOAT2INT16(float x) static OPUS_INLINE opus_int16 FLOAT2INT16(float x)
{ {
x = x*CELT_SIG_SCALE; x = x*CELT_SIG_SCALE;
x = MAX32(x, -32768); x = MAX32(x, -32768);

View file

@ -139,7 +139,7 @@ opus_val32 celt_sqrt(opus_val32 x)
#define L3 8277 #define L3 8277
#define L4 -626 #define L4 -626
static inline opus_val16 _celt_cos_pi_2(opus_val16 x) static OPUS_INLINE opus_val16 _celt_cos_pi_2(opus_val16 x)
{ {
opus_val16 x2; opus_val16 x2;

View file

@ -44,7 +44,7 @@
unsigned isqrt32(opus_uint32 _val); unsigned isqrt32(opus_uint32 _val);
#ifndef OVERRIDE_CELT_MAXABS16 #ifndef OVERRIDE_CELT_MAXABS16
static inline opus_val32 celt_maxabs16(const opus_val16 *x, int len) static OPUS_INLINE opus_val32 celt_maxabs16(const opus_val16 *x, int len)
{ {
int i; int i;
opus_val16 maxval = 0; opus_val16 maxval = 0;
@ -60,7 +60,7 @@ static inline opus_val32 celt_maxabs16(const opus_val16 *x, int len)
#ifndef OVERRIDE_CELT_MAXABS32 #ifndef OVERRIDE_CELT_MAXABS32
#ifdef FIXED_POINT #ifdef FIXED_POINT
static inline opus_val32 celt_maxabs32(const opus_val32 *x, int len) static OPUS_INLINE opus_val32 celt_maxabs32(const opus_val32 *x, int len)
{ {
int i; int i;
opus_val32 maxval = 0; opus_val32 maxval = 0;
@ -95,7 +95,7 @@ static inline opus_val32 celt_maxabs32(const opus_val32 *x, int len)
denorm, +/- inf and NaN are *not* handled */ denorm, +/- inf and NaN are *not* handled */
/** Base-2 log approximation (log2(x)). */ /** Base-2 log approximation (log2(x)). */
static inline float celt_log2(float x) static OPUS_INLINE float celt_log2(float x)
{ {
int integer; int integer;
float frac; float frac;
@ -113,7 +113,7 @@ static inline float celt_log2(float x)
} }
/** Base-2 exponential approximation (2^x). */ /** Base-2 exponential approximation (2^x). */
static inline float celt_exp2(float x) static OPUS_INLINE float celt_exp2(float x)
{ {
int integer; int integer;
float frac; float frac;
@ -145,7 +145,7 @@ static inline float celt_exp2(float x)
#ifndef OVERRIDE_CELT_ILOG2 #ifndef OVERRIDE_CELT_ILOG2
/** Integer log in base2. Undefined for zero and negative numbers */ /** Integer log in base2. Undefined for zero and negative numbers */
static inline opus_int16 celt_ilog2(opus_int32 x) static OPUS_INLINE opus_int16 celt_ilog2(opus_int32 x)
{ {
celt_assert2(x>0, "celt_ilog2() only defined for strictly positive numbers"); celt_assert2(x>0, "celt_ilog2() only defined for strictly positive numbers");
return EC_ILOG(x)-1; return EC_ILOG(x)-1;
@ -154,7 +154,7 @@ static inline opus_int16 celt_ilog2(opus_int32 x)
/** Integer log in base2. Defined for zero, but not for negative numbers */ /** Integer log in base2. Defined for zero, but not for negative numbers */
static inline opus_int16 celt_zlog2(opus_val32 x) static OPUS_INLINE opus_int16 celt_zlog2(opus_val32 x)
{ {
return x <= 0 ? 0 : celt_ilog2(x); return x <= 0 ? 0 : celt_ilog2(x);
} }
@ -166,7 +166,7 @@ opus_val32 celt_sqrt(opus_val32 x);
opus_val16 celt_cos_norm(opus_val32 x); opus_val16 celt_cos_norm(opus_val32 x);
/** Base-2 logarithm approximation (log2(x)). (Q14 input, Q10 output) */ /** Base-2 logarithm approximation (log2(x)). (Q14 input, Q10 output) */
static inline opus_val16 celt_log2(opus_val32 x) static OPUS_INLINE opus_val16 celt_log2(opus_val32 x)
{ {
int i; int i;
opus_val16 n, frac; opus_val16 n, frac;
@ -192,14 +192,14 @@ static inline opus_val16 celt_log2(opus_val32 x)
#define D2 14819 #define D2 14819
#define D3 10204 #define D3 10204
static inline opus_val32 celt_exp2_frac(opus_val16 x) static OPUS_INLINE opus_val32 celt_exp2_frac(opus_val16 x)
{ {
opus_val16 frac; opus_val16 frac;
frac = SHL16(x, 4); frac = SHL16(x, 4);
return ADD16(D0, MULT16_16_Q15(frac, ADD16(D1, MULT16_16_Q15(frac, ADD16(D2 , MULT16_16_Q15(D3,frac)))))); return ADD16(D0, MULT16_16_Q15(frac, ADD16(D1, MULT16_16_Q15(frac, ADD16(D2 , MULT16_16_Q15(D3,frac))))));
} }
/** Base-2 exponential approximation (2^x). (Q10 input, Q16 output) */ /** Base-2 exponential approximation (2^x). (Q10 input, Q16 output) */
static inline opus_val32 celt_exp2(opus_val16 x) static OPUS_INLINE opus_val32 celt_exp2(opus_val16 x)
{ {
int integer; int integer;
opus_val16 frac; opus_val16 frac;
@ -225,7 +225,7 @@ opus_val32 frac_div32(opus_val32 a, opus_val32 b);
/* Atan approximation using a 4th order polynomial. Input is in Q15 format /* Atan approximation using a 4th order polynomial. Input is in Q15 format
and normalized by pi/4. Output is in Q15 format */ and normalized by pi/4. Output is in Q15 format */
static inline opus_val16 celt_atan01(opus_val16 x) static OPUS_INLINE opus_val16 celt_atan01(opus_val16 x)
{ {
return MULT16_16_P15(x, ADD32(M1, MULT16_16_P15(x, ADD32(M2, MULT16_16_P15(x, ADD32(M3, MULT16_16_P15(M4, x))))))); return MULT16_16_P15(x, ADD32(M1, MULT16_16_P15(x, ADD32(M2, MULT16_16_P15(x, ADD32(M3, MULT16_16_P15(M4, x)))))));
} }
@ -236,7 +236,7 @@ static inline opus_val16 celt_atan01(opus_val16 x)
#undef M4 #undef M4
/* atan2() approximation valid for positive input values */ /* atan2() approximation valid for positive input values */
static inline opus_val16 celt_atan2p(opus_val16 y, opus_val16 x) static OPUS_INLINE opus_val16 celt_atan2p(opus_val16 y, opus_val16 x)
{ {
if (y < x) if (y < x)
{ {

View file

@ -35,13 +35,16 @@
# include "custom_support.h" # include "custom_support.h"
#endif #endif
#include "opus_types.h"
#include "opus_defines.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
/** Opus wrapper for malloc(). To do your own dynamic allocation, all you need to do is replace this function and opus_free */ /** Opus wrapper for malloc(). To do your own dynamic allocation, all you need to do is replace this function and opus_free */
#ifndef OVERRIDE_OPUS_ALLOC #ifndef OVERRIDE_OPUS_ALLOC
static inline void *opus_alloc (size_t size) static OPUS_INLINE void *opus_alloc (size_t size)
{ {
return malloc(size); return malloc(size);
} }
@ -49,7 +52,7 @@ static inline void *opus_alloc (size_t size)
/** Same as celt_alloc(), except that the area is only needed inside a CELT call (might cause problem with wideband though) */ /** Same as celt_alloc(), except that the area is only needed inside a CELT call (might cause problem with wideband though) */
#ifndef OVERRIDE_OPUS_ALLOC_SCRATCH #ifndef OVERRIDE_OPUS_ALLOC_SCRATCH
static inline void *opus_alloc_scratch (size_t size) static OPUS_INLINE void *opus_alloc_scratch (size_t size)
{ {
/* Scratch space doesn't need to be cleared */ /* Scratch space doesn't need to be cleared */
return opus_alloc(size); return opus_alloc(size);
@ -58,7 +61,7 @@ static inline void *opus_alloc_scratch (size_t size)
/** Opus wrapper for free(). To do your own dynamic allocation, all you need to do is replace this function and opus_alloc */ /** Opus wrapper for free(). To do your own dynamic allocation, all you need to do is replace this function and opus_alloc */
#ifndef OVERRIDE_OPUS_FREE #ifndef OVERRIDE_OPUS_FREE
static inline void opus_free (void *ptr) static OPUS_INLINE void opus_free (void *ptr)
{ {
free(ptr); free(ptr);
} }

View file

@ -52,7 +52,7 @@ opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod,
/* OPT: This is the kernel you really want to optimize. It gets used a lot /* OPT: This is the kernel you really want to optimize. It gets used a lot
by the prefilter and by the PLC. */ by the prefilter and by the PLC. */
#ifndef OVERRIDE_XCORR_KERNEL #ifndef OVERRIDE_XCORR_KERNEL
static inline void xcorr_kernel(const opus_val16 * x, const opus_val16 * y, opus_val32 sum[4], int len) static OPUS_INLINE void xcorr_kernel(const opus_val16 * x, const opus_val16 * y, opus_val32 sum[4], int len)
{ {
int j; int j;
opus_val16 y_0, y_1, y_2, y_3; opus_val16 y_0, y_1, y_2, y_3;
@ -119,7 +119,7 @@ static inline void xcorr_kernel(const opus_val16 * x, const opus_val16 * y, opus
#endif /* OVERRIDE_XCORR_KERNEL */ #endif /* OVERRIDE_XCORR_KERNEL */
#ifndef OVERRIDE_DUAL_INNER_PROD #ifndef OVERRIDE_DUAL_INNER_PROD
static inline void dual_inner_prod(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02, static OPUS_INLINE void dual_inner_prod(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02,
int N, opus_val32 *xy1, opus_val32 *xy2) int N, opus_val32 *xy1, opus_val32 *xy2)
{ {
int i; int i;

View file

@ -245,7 +245,7 @@ void compute_pulse_cache(CELTMode *m, int LM)
#define ALLOC_STEPS 6 #define ALLOC_STEPS 6
static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int skip_start, static OPUS_INLINE int interp_bits2pulses(const CELTMode *m, int start, int end, int skip_start,
const int *bits1, const int *bits2, const int *thresh, const int *cap, opus_int32 total, opus_int32 *_balance, const int *bits1, const int *bits2, const int *thresh, const int *cap, opus_int32 total, opus_int32 *_balance,
int skip_rsv, int *intensity, int intensity_rsv, int *dual_stereo, int dual_stereo_rsv, int *bits, int skip_rsv, int *intensity, int intensity_rsv, int *dual_stereo, int dual_stereo_rsv, int *bits,
int *ebits, int *fine_priority, int C, int LM, ec_ctx *ec, int encode, int prev, int signalBandwidth) int *ebits, int *fine_priority, int C, int LM, ec_ctx *ec, int encode, int prev, int signalBandwidth)

View file

@ -45,12 +45,12 @@
void compute_pulse_cache(CELTMode *m, int LM); void compute_pulse_cache(CELTMode *m, int LM);
static inline int get_pulses(int i) static OPUS_INLINE int get_pulses(int i)
{ {
return i<8 ? i : (8 + (i&7)) << ((i>>3)-1); return i<8 ? i : (8 + (i&7)) << ((i>>3)-1);
} }
static inline int bits2pulses(const CELTMode *m, int band, int LM, int bits) static OPUS_INLINE int bits2pulses(const CELTMode *m, int band, int LM, int bits)
{ {
int i; int i;
int lo, hi; int lo, hi;
@ -77,7 +77,7 @@ static inline int bits2pulses(const CELTMode *m, int band, int LM, int bits)
return hi; return hi;
} }
static inline int pulses2bits(const CELTMode *m, int band, int LM, int pulses) static OPUS_INLINE int pulses2bits(const CELTMode *m, int band, int LM, int pulses)
{ {
const unsigned char *cache; const unsigned char *cache;

View file

@ -32,6 +32,9 @@
#ifndef STACK_ALLOC_H #ifndef STACK_ALLOC_H
#define STACK_ALLOC_H #define STACK_ALLOC_H
#include "opus_types.h"
#include "opus_defines.h"
#if (!defined (VAR_ARRAYS) && !defined (USE_ALLOCA) && !defined (NONTHREADSAFE_PSEUDOSTACK)) #if (!defined (VAR_ARRAYS) && !defined (USE_ALLOCA) && !defined (NONTHREADSAFE_PSEUDOSTACK))
#error "Opus requires one of VAR_ARRAYS, USE_ALLOCA, or NONTHREADSAFE_PSEUDOSTACK be defined to select the temporary allocation mode." #error "Opus requires one of VAR_ARRAYS, USE_ALLOCA, or NONTHREADSAFE_PSEUDOSTACK be defined to select the temporary allocation mode."
#endif #endif
@ -159,7 +162,7 @@ extern char *global_stack_top;
#else #else
static inline int _opus_false(void) {return 0;} static OPUS_INLINE int _opus_false(void) {return 0;}
#define OPUS_CHECK_ARRAY(ptr, len) _opus_false() #define OPUS_CHECK_ARRAY(ptr, len) _opus_false()
#define OPUS_CHECK_VALUE(value) _opus_false() #define OPUS_CHECK_VALUE(value) _opus_false()
#define OPUS_PRINT_INT(value) do{}while(0) #define OPUS_PRINT_INT(value) do{}while(0)

View file

@ -36,7 +36,7 @@
#include "arch.h" #include "arch.h"
#define OVERRIDE_XCORR_KERNEL #define OVERRIDE_XCORR_KERNEL
static inline void xcorr_kernel(const opus_val16 *x, const opus_val16 *y, opus_val32 sum[4], int len) static OPUS_INLINE void xcorr_kernel(const opus_val16 *x, const opus_val16 *y, opus_val32 sum[4], int len)
{ {
int j; int j;
__m128 xsum1, xsum2; __m128 xsum1, xsum2;
@ -72,7 +72,7 @@ static inline void xcorr_kernel(const opus_val16 *x, const opus_val16 *y, opus_v
} }
#define OVERRIDE_DUAL_INNER_PROD #define OVERRIDE_DUAL_INNER_PROD
static inline void dual_inner_prod(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02, static OPUS_INLINE void dual_inner_prod(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02,
int N, opus_val32 *xy1, opus_val32 *xy2) int N, opus_val32 *xy1, opus_val32 *xy2)
{ {
int i; int i;
@ -102,7 +102,7 @@ static inline void dual_inner_prod(const opus_val16 *x, const opus_val16 *y01, c
} }
#define OVERRIDE_COMB_FILTER_CONST #define OVERRIDE_COMB_FILTER_CONST
static inline void comb_filter_const(opus_val32 *y, opus_val32 *x, int T, int N, static OPUS_INLINE void comb_filter_const(opus_val32 *y, opus_val32 *x, int T, int N,
opus_val16 g10, opus_val16 g11, opus_val16 g12) opus_val16 g10, opus_val16 g11, opus_val16 g12)
{ {
int i; int i;

View file

@ -47,7 +47,7 @@ extern "C" {
#else #else
# define OPUS_CUSTOM_EXPORT # define OPUS_CUSTOM_EXPORT
# ifdef OPUS_BUILD # ifdef OPUS_BUILD
# define OPUS_CUSTOM_EXPORT_STATIC static inline # define OPUS_CUSTOM_EXPORT_STATIC static OPUS_INLINE
# else # else
# define OPUS_CUSTOM_EXPORT_STATIC # define OPUS_CUSTOM_EXPORT_STATIC
# endif # endif

View file

@ -98,6 +98,18 @@ extern "C" {
# define OPUS_RESTRICT restrict # define OPUS_RESTRICT restrict
#endif #endif
#if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
# if OPUS_GNUC_PREREQ(2,7)
# define OPUS_INLINE __inline__
# elif (defined(_MSC_VER))
# define OPUS_INLINE __inline
# else
# define OPUS_INLINE
# endif
#else
# define OPUS_INLINE inline
#endif
/**Warning attributes for opus functions /**Warning attributes for opus functions
* NONNULL is not used in OPUS_BUILD to avoid the compiler optimizing out * NONNULL is not used in OPUS_BUILD to avoid the compiler optimizing out
* some paranoid null checks. */ * some paranoid null checks. */

View file

@ -44,7 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
/* Helper function for A2NLSF(..) */ /* Helper function for A2NLSF(..) */
/* Transforms polynomials from cos(n*f) to cos(f)^n */ /* Transforms polynomials from cos(n*f) to cos(f)^n */
static inline void silk_A2NLSF_trans_poly( static OPUS_INLINE void silk_A2NLSF_trans_poly(
opus_int32 *p, /* I/O Polynomial */ opus_int32 *p, /* I/O Polynomial */
const opus_int dd /* I Polynomial order (= filter order / 2 ) */ const opus_int dd /* I Polynomial order (= filter order / 2 ) */
) )
@ -60,7 +60,7 @@ static inline void silk_A2NLSF_trans_poly(
} }
/* Helper function for A2NLSF(..) */ /* Helper function for A2NLSF(..) */
/* Polynomial evaluation */ /* Polynomial evaluation */
static inline opus_int32 silk_A2NLSF_eval_poly( /* return the polynomial evaluation, in Q16 */ static OPUS_INLINE opus_int32 silk_A2NLSF_eval_poly( /* return the polynomial evaluation, in Q16 */
opus_int32 *p, /* I Polynomial, Q16 */ opus_int32 *p, /* I Polynomial, Q16 */
const opus_int32 x, /* I Evaluation point, Q12 */ const opus_int32 x, /* I Evaluation point, Q12 */
const opus_int dd /* I Order */ const opus_int dd /* I Order */
@ -77,7 +77,7 @@ static inline opus_int32 silk_A2NLSF_eval_poly( /* return the polynomial evaluat
return y32; return y32;
} }
static inline void silk_A2NLSF_init( static OPUS_INLINE void silk_A2NLSF_init(
const opus_int32 *a_Q16, const opus_int32 *a_Q16,
opus_int32 *P, opus_int32 *P,
opus_int32 *Q, opus_int32 *Q,

View file

@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "stack_alloc.h" #include "stack_alloc.h"
/* Generates excitation for CNG LPC synthesis */ /* Generates excitation for CNG LPC synthesis */
static inline void silk_CNG_exc( static OPUS_INLINE void silk_CNG_exc(
opus_int32 residual_Q10[], /* O CNG residual signal Q10 */ opus_int32 residual_Q10[], /* O CNG residual signal Q10 */
opus_int32 exc_buf_Q14[], /* I Random samples buffer Q10 */ opus_int32 exc_buf_Q14[], /* I Random samples buffer Q10 */
opus_int32 Gain_Q16, /* I Gain to apply */ opus_int32 Gain_Q16, /* I Gain to apply */

View file

@ -26,7 +26,7 @@ POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/ ***********************************************************************/
/*! \file silk_Inlines.h /*! \file silk_Inlines.h
* \brief silk_Inlines.h defines inline signal processing functions. * \brief silk_Inlines.h defines OPUS_INLINE signal processing functions.
*/ */
#ifndef SILK_FIX_INLINES_H #ifndef SILK_FIX_INLINES_H
@ -38,7 +38,7 @@ extern "C"
#endif #endif
/* count leading zeros of opus_int64 */ /* count leading zeros of opus_int64 */
static inline opus_int32 silk_CLZ64( opus_int64 in ) static OPUS_INLINE opus_int32 silk_CLZ64( opus_int64 in )
{ {
opus_int32 in_upper; opus_int32 in_upper;
@ -53,7 +53,7 @@ static inline opus_int32 silk_CLZ64( opus_int64 in )
} }
/* get number of leading zeros and fractional part (the bits right after the leading one */ /* get number of leading zeros and fractional part (the bits right after the leading one */
static inline void silk_CLZ_FRAC( static OPUS_INLINE void silk_CLZ_FRAC(
opus_int32 in, /* I input */ opus_int32 in, /* I input */
opus_int32 *lz, /* O number of leading zeros */ opus_int32 *lz, /* O number of leading zeros */
opus_int32 *frac_Q7 /* O the 7 bits right after the leading one */ opus_int32 *frac_Q7 /* O the 7 bits right after the leading one */
@ -68,7 +68,7 @@ static inline void silk_CLZ_FRAC(
/* Approximation of square root */ /* Approximation of square root */
/* Accuracy: < +/- 10% for output values > 15 */ /* Accuracy: < +/- 10% for output values > 15 */
/* < +/- 2.5% for output values > 120 */ /* < +/- 2.5% for output values > 120 */
static inline opus_int32 silk_SQRT_APPROX( opus_int32 x ) static OPUS_INLINE opus_int32 silk_SQRT_APPROX( opus_int32 x )
{ {
opus_int32 y, lz, frac_Q7; opus_int32 y, lz, frac_Q7;
@ -94,7 +94,7 @@ static inline opus_int32 silk_SQRT_APPROX( opus_int32 x )
} }
/* Divide two int32 values and return result as int32 in a given Q-domain */ /* Divide two int32 values and return result as int32 in a given Q-domain */
static inline opus_int32 silk_DIV32_varQ( /* O returns a good approximation of "(a32 << Qres) / b32" */ static OPUS_INLINE opus_int32 silk_DIV32_varQ( /* O returns a good approximation of "(a32 << Qres) / b32" */
const opus_int32 a32, /* I numerator (Q0) */ const opus_int32 a32, /* I numerator (Q0) */
const opus_int32 b32, /* I denominator (Q0) */ const opus_int32 b32, /* I denominator (Q0) */
const opus_int Qres /* I Q-domain of result (>= 0) */ const opus_int Qres /* I Q-domain of result (>= 0) */
@ -140,7 +140,7 @@ static inline opus_int32 silk_DIV32_varQ( /* O returns a good approximation
} }
/* Invert int32 value and return result as int32 in a given Q-domain */ /* Invert int32 value and return result as int32 in a given Q-domain */
static inline opus_int32 silk_INVERSE32_varQ( /* O returns a good approximation of "(1 << Qres) / b32" */ static OPUS_INLINE opus_int32 silk_INVERSE32_varQ( /* O returns a good approximation of "(1 << Qres) / b32" */
const opus_int32 b32, /* I denominator (Q0) */ const opus_int32 b32, /* I denominator (Q0) */
const opus_int Qres /* I Q-domain of result (> 0) */ const opus_int Qres /* I Q-domain of result (> 0) */
) )

View file

@ -38,7 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "main.h" #include "main.h"
/* Helper function, interpolates the filter taps */ /* Helper function, interpolates the filter taps */
static inline void silk_LP_interpolate_filter_taps( static OPUS_INLINE void silk_LP_interpolate_filter_taps(
opus_int32 B_Q28[ TRANSITION_NB ], opus_int32 B_Q28[ TRANSITION_NB ],
opus_int32 A_Q28[ TRANSITION_NA ], opus_int32 A_Q28[ TRANSITION_NA ],
const opus_int ind, const opus_int ind,

View file

@ -34,11 +34,11 @@ POSSIBILITY OF SUCH DAMAGE.
extern opus_int64 ops_count; extern opus_int64 ops_count;
static inline opus_int64 silk_SaveCount(){ static OPUS_INLINE opus_int64 silk_SaveCount(){
return(ops_count); return(ops_count);
} }
static inline opus_int64 silk_SaveResetCount(){ static OPUS_INLINE opus_int64 silk_SaveResetCount(){
opus_int64 ret; opus_int64 ret;
ret = ops_count; ret = ops_count;
@ -46,12 +46,12 @@ static inline opus_int64 silk_SaveResetCount(){
return(ret); return(ret);
} }
static inline silk_PrintCount(){ static OPUS_INLINE silk_PrintCount(){
printf("ops_count = %d \n ", (opus_int32)ops_count); printf("ops_count = %d \n ", (opus_int32)ops_count);
} }
#undef silk_MUL #undef silk_MUL
static inline opus_int32 silk_MUL(opus_int32 a32, opus_int32 b32){ static OPUS_INLINE opus_int32 silk_MUL(opus_int32 a32, opus_int32 b32){
opus_int32 ret; opus_int32 ret;
ops_count += 4; ops_count += 4;
ret = a32 * b32; ret = a32 * b32;
@ -59,14 +59,14 @@ static inline opus_int32 silk_MUL(opus_int32 a32, opus_int32 b32){
} }
#undef silk_MUL_uint #undef silk_MUL_uint
static inline opus_uint32 silk_MUL_uint(opus_uint32 a32, opus_uint32 b32){ static OPUS_INLINE opus_uint32 silk_MUL_uint(opus_uint32 a32, opus_uint32 b32){
opus_uint32 ret; opus_uint32 ret;
ops_count += 4; ops_count += 4;
ret = a32 * b32; ret = a32 * b32;
return ret; return ret;
} }
#undef silk_MLA #undef silk_MLA
static inline opus_int32 silk_MLA(opus_int32 a32, opus_int32 b32, opus_int32 c32){ static OPUS_INLINE opus_int32 silk_MLA(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret; opus_int32 ret;
ops_count += 4; ops_count += 4;
ret = a32 + b32 * c32; ret = a32 + b32 * c32;
@ -74,7 +74,7 @@ static inline opus_int32 silk_MLA(opus_int32 a32, opus_int32 b32, opus_int32 c32
} }
#undef silk_MLA_uint #undef silk_MLA_uint
static inline opus_int32 silk_MLA_uint(opus_uint32 a32, opus_uint32 b32, opus_uint32 c32){ static OPUS_INLINE opus_int32 silk_MLA_uint(opus_uint32 a32, opus_uint32 b32, opus_uint32 c32){
opus_uint32 ret; opus_uint32 ret;
ops_count += 4; ops_count += 4;
ret = a32 + b32 * c32; ret = a32 + b32 * c32;
@ -82,14 +82,14 @@ static inline opus_int32 silk_MLA_uint(opus_uint32 a32, opus_uint32 b32, opus_ui
} }
#undef silk_SMULWB #undef silk_SMULWB
static inline opus_int32 silk_SMULWB(opus_int32 a32, opus_int32 b32){ static OPUS_INLINE opus_int32 silk_SMULWB(opus_int32 a32, opus_int32 b32){
opus_int32 ret; opus_int32 ret;
ops_count += 5; ops_count += 5;
ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16); ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16);
return ret; return ret;
} }
#undef silk_SMLAWB #undef silk_SMLAWB
static inline opus_int32 silk_SMLAWB(opus_int32 a32, opus_int32 b32, opus_int32 c32){ static OPUS_INLINE opus_int32 silk_SMLAWB(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret; opus_int32 ret;
ops_count += 5; ops_count += 5;
ret = ((a32) + ((((b32) >> 16) * (opus_int32)((opus_int16)(c32))) + ((((b32) & 0x0000FFFF) * (opus_int32)((opus_int16)(c32))) >> 16))); ret = ((a32) + ((((b32) >> 16) * (opus_int32)((opus_int16)(c32))) + ((((b32) & 0x0000FFFF) * (opus_int32)((opus_int16)(c32))) >> 16)));
@ -97,14 +97,14 @@ static inline opus_int32 silk_SMLAWB(opus_int32 a32, opus_int32 b32, opus_int32
} }
#undef silk_SMULWT #undef silk_SMULWT
static inline opus_int32 silk_SMULWT(opus_int32 a32, opus_int32 b32){ static OPUS_INLINE opus_int32 silk_SMULWT(opus_int32 a32, opus_int32 b32){
opus_int32 ret; opus_int32 ret;
ops_count += 4; ops_count += 4;
ret = (a32 >> 16) * (b32 >> 16) + (((a32 & 0x0000FFFF) * (b32 >> 16)) >> 16); ret = (a32 >> 16) * (b32 >> 16) + (((a32 & 0x0000FFFF) * (b32 >> 16)) >> 16);
return ret; return ret;
} }
#undef silk_SMLAWT #undef silk_SMLAWT
static inline opus_int32 silk_SMLAWT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ static OPUS_INLINE opus_int32 silk_SMLAWT(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret; opus_int32 ret;
ops_count += 4; ops_count += 4;
ret = a32 + ((b32 >> 16) * (c32 >> 16)) + (((b32 & 0x0000FFFF) * ((c32 >> 16)) >> 16)); ret = a32 + ((b32 >> 16) * (c32 >> 16)) + (((b32 & 0x0000FFFF) * ((c32 >> 16)) >> 16));
@ -112,14 +112,14 @@ static inline opus_int32 silk_SMLAWT(opus_int32 a32, opus_int32 b32, opus_int32
} }
#undef silk_SMULBB #undef silk_SMULBB
static inline opus_int32 silk_SMULBB(opus_int32 a32, opus_int32 b32){ static OPUS_INLINE opus_int32 silk_SMULBB(opus_int32 a32, opus_int32 b32){
opus_int32 ret; opus_int32 ret;
ops_count += 1; ops_count += 1;
ret = (opus_int32)((opus_int16)a32) * (opus_int32)((opus_int16)b32); ret = (opus_int32)((opus_int16)a32) * (opus_int32)((opus_int16)b32);
return ret; return ret;
} }
#undef silk_SMLABB #undef silk_SMLABB
static inline opus_int32 silk_SMLABB(opus_int32 a32, opus_int32 b32, opus_int32 c32){ static OPUS_INLINE opus_int32 silk_SMLABB(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret; opus_int32 ret;
ops_count += 1; ops_count += 1;
ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32); ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32);
@ -127,7 +127,7 @@ static inline opus_int32 silk_SMLABB(opus_int32 a32, opus_int32 b32, opus_int32
} }
#undef silk_SMULBT #undef silk_SMULBT
static inline opus_int32 silk_SMULBT(opus_int32 a32, opus_int32 b32 ){ static OPUS_INLINE opus_int32 silk_SMULBT(opus_int32 a32, opus_int32 b32 ){
opus_int32 ret; opus_int32 ret;
ops_count += 4; ops_count += 4;
ret = ((opus_int32)((opus_int16)a32)) * (b32 >> 16); ret = ((opus_int32)((opus_int16)a32)) * (b32 >> 16);
@ -135,7 +135,7 @@ static inline opus_int32 silk_SMULBT(opus_int32 a32, opus_int32 b32 ){
} }
#undef silk_SMLABT #undef silk_SMLABT
static inline opus_int32 silk_SMLABT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ static OPUS_INLINE opus_int32 silk_SMLABT(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret; opus_int32 ret;
ops_count += 1; ops_count += 1;
ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16); ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16);
@ -143,7 +143,7 @@ static inline opus_int32 silk_SMLABT(opus_int32 a32, opus_int32 b32, opus_int32
} }
#undef silk_SMULTT #undef silk_SMULTT
static inline opus_int32 silk_SMULTT(opus_int32 a32, opus_int32 b32){ static OPUS_INLINE opus_int32 silk_SMULTT(opus_int32 a32, opus_int32 b32){
opus_int32 ret; opus_int32 ret;
ops_count += 1; ops_count += 1;
ret = (a32 >> 16) * (b32 >> 16); ret = (a32 >> 16) * (b32 >> 16);
@ -151,7 +151,7 @@ static inline opus_int32 silk_SMULTT(opus_int32 a32, opus_int32 b32){
} }
#undef silk_SMLATT #undef silk_SMLATT
static inline opus_int32 silk_SMLATT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ static OPUS_INLINE opus_int32 silk_SMLATT(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret; opus_int32 ret;
ops_count += 1; ops_count += 1;
ret = a32 + (b32 >> 16) * (c32 >> 16); ret = a32 + (b32 >> 16) * (c32 >> 16);
@ -179,7 +179,7 @@ static inline opus_int32 silk_SMLATT(opus_int32 a32, opus_int32 b32, opus_int32
#define silk_SMLAWT_ovflw silk_SMLAWT #define silk_SMLAWT_ovflw silk_SMLAWT
#undef silk_SMULL #undef silk_SMULL
static inline opus_int64 silk_SMULL(opus_int32 a32, opus_int32 b32){ static OPUS_INLINE opus_int64 silk_SMULL(opus_int32 a32, opus_int32 b32){
opus_int64 ret; opus_int64 ret;
ops_count += 8; ops_count += 8;
ret = ((opus_int64)(a32) * /*(opus_int64)*/(b32)); ret = ((opus_int64)(a32) * /*(opus_int64)*/(b32));
@ -187,14 +187,14 @@ static inline opus_int64 silk_SMULL(opus_int32 a32, opus_int32 b32){
} }
#undef silk_SMLAL #undef silk_SMLAL
static inline opus_int64 silk_SMLAL(opus_int64 a64, opus_int32 b32, opus_int32 c32){ static OPUS_INLINE opus_int64 silk_SMLAL(opus_int64 a64, opus_int32 b32, opus_int32 c32){
opus_int64 ret; opus_int64 ret;
ops_count += 8; ops_count += 8;
ret = a64 + ((opus_int64)(b32) * /*(opus_int64)*/(c32)); ret = a64 + ((opus_int64)(b32) * /*(opus_int64)*/(c32));
return ret; return ret;
} }
#undef silk_SMLALBB #undef silk_SMLALBB
static inline opus_int64 silk_SMLALBB(opus_int64 a64, opus_int16 b16, opus_int16 c16){ static OPUS_INLINE opus_int64 silk_SMLALBB(opus_int64 a64, opus_int16 b16, opus_int16 c16){
opus_int64 ret; opus_int64 ret;
ops_count += 4; ops_count += 4;
ret = a64 + ((opus_int64)(b16) * /*(opus_int64)*/(c16)); ret = a64 + ((opus_int64)(b16) * /*(opus_int64)*/(c16));
@ -202,7 +202,7 @@ static inline opus_int64 silk_SMLALBB(opus_int64 a64, opus_int16 b16, opus_int16
} }
#undef SigProcFIX_CLZ16 #undef SigProcFIX_CLZ16
static inline opus_int32 SigProcFIX_CLZ16(opus_int16 in16) static OPUS_INLINE opus_int32 SigProcFIX_CLZ16(opus_int16 in16)
{ {
opus_int32 out32 = 0; opus_int32 out32 = 0;
ops_count += 10; ops_count += 10;
@ -240,7 +240,7 @@ static inline opus_int32 SigProcFIX_CLZ16(opus_int16 in16)
} }
#undef SigProcFIX_CLZ32 #undef SigProcFIX_CLZ32
static inline opus_int32 SigProcFIX_CLZ32(opus_int32 in32) static OPUS_INLINE opus_int32 SigProcFIX_CLZ32(opus_int32 in32)
{ {
/* test highest 16 bits and convert to opus_int16 */ /* test highest 16 bits and convert to opus_int16 */
ops_count += 2; ops_count += 2;
@ -252,19 +252,19 @@ static inline opus_int32 SigProcFIX_CLZ32(opus_int32 in32)
} }
#undef silk_DIV32 #undef silk_DIV32
static inline opus_int32 silk_DIV32(opus_int32 a32, opus_int32 b32){ static OPUS_INLINE opus_int32 silk_DIV32(opus_int32 a32, opus_int32 b32){
ops_count += 64; ops_count += 64;
return a32 / b32; return a32 / b32;
} }
#undef silk_DIV32_16 #undef silk_DIV32_16
static inline opus_int32 silk_DIV32_16(opus_int32 a32, opus_int32 b32){ static OPUS_INLINE opus_int32 silk_DIV32_16(opus_int32 a32, opus_int32 b32){
ops_count += 32; ops_count += 32;
return a32 / b32; return a32 / b32;
} }
#undef silk_SAT8 #undef silk_SAT8
static inline opus_int8 silk_SAT8(opus_int64 a){ static OPUS_INLINE opus_int8 silk_SAT8(opus_int64 a){
opus_int8 tmp; opus_int8 tmp;
ops_count += 1; ops_count += 1;
tmp = (opus_int8)((a) > silk_int8_MAX ? silk_int8_MAX : \ tmp = (opus_int8)((a) > silk_int8_MAX ? silk_int8_MAX : \
@ -273,7 +273,7 @@ static inline opus_int8 silk_SAT8(opus_int64 a){
} }
#undef silk_SAT16 #undef silk_SAT16
static inline opus_int16 silk_SAT16(opus_int64 a){ static OPUS_INLINE opus_int16 silk_SAT16(opus_int64 a){
opus_int16 tmp; opus_int16 tmp;
ops_count += 1; ops_count += 1;
tmp = (opus_int16)((a) > silk_int16_MAX ? silk_int16_MAX : \ tmp = (opus_int16)((a) > silk_int16_MAX ? silk_int16_MAX : \
@ -281,7 +281,7 @@ static inline opus_int16 silk_SAT16(opus_int64 a){
return(tmp); return(tmp);
} }
#undef silk_SAT32 #undef silk_SAT32
static inline opus_int32 silk_SAT32(opus_int64 a){ static OPUS_INLINE opus_int32 silk_SAT32(opus_int64 a){
opus_int32 tmp; opus_int32 tmp;
ops_count += 1; ops_count += 1;
tmp = (opus_int32)((a) > silk_int32_MAX ? silk_int32_MAX : \ tmp = (opus_int32)((a) > silk_int32_MAX ? silk_int32_MAX : \
@ -289,7 +289,7 @@ static inline opus_int32 silk_SAT32(opus_int64 a){
return(tmp); return(tmp);
} }
#undef silk_POS_SAT32 #undef silk_POS_SAT32
static inline opus_int32 silk_POS_SAT32(opus_int64 a){ static OPUS_INLINE opus_int32 silk_POS_SAT32(opus_int64 a){
opus_int32 tmp; opus_int32 tmp;
ops_count += 1; ops_count += 1;
tmp = (opus_int32)((a) > silk_int32_MAX ? silk_int32_MAX : (a)); tmp = (opus_int32)((a) > silk_int32_MAX ? silk_int32_MAX : (a));
@ -297,14 +297,14 @@ static inline opus_int32 silk_POS_SAT32(opus_int64 a){
} }
#undef silk_ADD_POS_SAT8 #undef silk_ADD_POS_SAT8
static inline opus_int8 silk_ADD_POS_SAT8(opus_int64 a, opus_int64 b){ static OPUS_INLINE opus_int8 silk_ADD_POS_SAT8(opus_int64 a, opus_int64 b){
opus_int8 tmp; opus_int8 tmp;
ops_count += 1; ops_count += 1;
tmp = (opus_int8)((((a)+(b)) & 0x80) ? silk_int8_MAX : ((a)+(b))); tmp = (opus_int8)((((a)+(b)) & 0x80) ? silk_int8_MAX : ((a)+(b)));
return(tmp); return(tmp);
} }
#undef silk_ADD_POS_SAT16 #undef silk_ADD_POS_SAT16
static inline opus_int16 silk_ADD_POS_SAT16(opus_int64 a, opus_int64 b){ static OPUS_INLINE opus_int16 silk_ADD_POS_SAT16(opus_int64 a, opus_int64 b){
opus_int16 tmp; opus_int16 tmp;
ops_count += 1; ops_count += 1;
tmp = (opus_int16)((((a)+(b)) & 0x8000) ? silk_int16_MAX : ((a)+(b))); tmp = (opus_int16)((((a)+(b)) & 0x8000) ? silk_int16_MAX : ((a)+(b)));
@ -312,7 +312,7 @@ static inline opus_int16 silk_ADD_POS_SAT16(opus_int64 a, opus_int64 b){
} }
#undef silk_ADD_POS_SAT32 #undef silk_ADD_POS_SAT32
static inline opus_int32 silk_ADD_POS_SAT32(opus_int64 a, opus_int64 b){ static OPUS_INLINE opus_int32 silk_ADD_POS_SAT32(opus_int64 a, opus_int64 b){
opus_int32 tmp; opus_int32 tmp;
ops_count += 1; ops_count += 1;
tmp = (opus_int32)((((a)+(b)) & 0x80000000) ? silk_int32_MAX : ((a)+(b))); tmp = (opus_int32)((((a)+(b)) & 0x80000000) ? silk_int32_MAX : ((a)+(b)));
@ -320,7 +320,7 @@ static inline opus_int32 silk_ADD_POS_SAT32(opus_int64 a, opus_int64 b){
} }
#undef silk_ADD_POS_SAT64 #undef silk_ADD_POS_SAT64
static inline opus_int64 silk_ADD_POS_SAT64(opus_int64 a, opus_int64 b){ static OPUS_INLINE opus_int64 silk_ADD_POS_SAT64(opus_int64 a, opus_int64 b){
opus_int64 tmp; opus_int64 tmp;
ops_count += 1; ops_count += 1;
tmp = ((((a)+(b)) & 0x8000000000000000LL) ? silk_int64_MAX : ((a)+(b))); tmp = ((((a)+(b)) & 0x8000000000000000LL) ? silk_int64_MAX : ((a)+(b)));
@ -328,40 +328,40 @@ static inline opus_int64 silk_ADD_POS_SAT64(opus_int64 a, opus_int64 b){
} }
#undef silk_LSHIFT8 #undef silk_LSHIFT8
static inline opus_int8 silk_LSHIFT8(opus_int8 a, opus_int32 shift){ static OPUS_INLINE opus_int8 silk_LSHIFT8(opus_int8 a, opus_int32 shift){
opus_int8 ret; opus_int8 ret;
ops_count += 1; ops_count += 1;
ret = a << shift; ret = a << shift;
return ret; return ret;
} }
#undef silk_LSHIFT16 #undef silk_LSHIFT16
static inline opus_int16 silk_LSHIFT16(opus_int16 a, opus_int32 shift){ static OPUS_INLINE opus_int16 silk_LSHIFT16(opus_int16 a, opus_int32 shift){
opus_int16 ret; opus_int16 ret;
ops_count += 1; ops_count += 1;
ret = a << shift; ret = a << shift;
return ret; return ret;
} }
#undef silk_LSHIFT32 #undef silk_LSHIFT32
static inline opus_int32 silk_LSHIFT32(opus_int32 a, opus_int32 shift){ static OPUS_INLINE opus_int32 silk_LSHIFT32(opus_int32 a, opus_int32 shift){
opus_int32 ret; opus_int32 ret;
ops_count += 1; ops_count += 1;
ret = a << shift; ret = a << shift;
return ret; return ret;
} }
#undef silk_LSHIFT64 #undef silk_LSHIFT64
static inline opus_int64 silk_LSHIFT64(opus_int64 a, opus_int shift){ static OPUS_INLINE opus_int64 silk_LSHIFT64(opus_int64 a, opus_int shift){
ops_count += 1; ops_count += 1;
return a << shift; return a << shift;
} }
#undef silk_LSHIFT_ovflw #undef silk_LSHIFT_ovflw
static inline opus_int32 silk_LSHIFT_ovflw(opus_int32 a, opus_int32 shift){ static OPUS_INLINE opus_int32 silk_LSHIFT_ovflw(opus_int32 a, opus_int32 shift){
ops_count += 1; ops_count += 1;
return a << shift; return a << shift;
} }
#undef silk_LSHIFT_uint #undef silk_LSHIFT_uint
static inline opus_uint32 silk_LSHIFT_uint(opus_uint32 a, opus_int32 shift){ static OPUS_INLINE opus_uint32 silk_LSHIFT_uint(opus_uint32 a, opus_int32 shift){
opus_uint32 ret; opus_uint32 ret;
ops_count += 1; ops_count += 1;
ret = a << shift; ret = a << shift;
@ -369,83 +369,83 @@ static inline opus_uint32 silk_LSHIFT_uint(opus_uint32 a, opus_int32 shift){
} }
#undef silk_RSHIFT8 #undef silk_RSHIFT8
static inline opus_int8 silk_RSHIFT8(opus_int8 a, opus_int32 shift){ static OPUS_INLINE opus_int8 silk_RSHIFT8(opus_int8 a, opus_int32 shift){
ops_count += 1; ops_count += 1;
return a >> shift; return a >> shift;
} }
#undef silk_RSHIFT16 #undef silk_RSHIFT16
static inline opus_int16 silk_RSHIFT16(opus_int16 a, opus_int32 shift){ static OPUS_INLINE opus_int16 silk_RSHIFT16(opus_int16 a, opus_int32 shift){
ops_count += 1; ops_count += 1;
return a >> shift; return a >> shift;
} }
#undef silk_RSHIFT32 #undef silk_RSHIFT32
static inline opus_int32 silk_RSHIFT32(opus_int32 a, opus_int32 shift){ static OPUS_INLINE opus_int32 silk_RSHIFT32(opus_int32 a, opus_int32 shift){
ops_count += 1; ops_count += 1;
return a >> shift; return a >> shift;
} }
#undef silk_RSHIFT64 #undef silk_RSHIFT64
static inline opus_int64 silk_RSHIFT64(opus_int64 a, opus_int64 shift){ static OPUS_INLINE opus_int64 silk_RSHIFT64(opus_int64 a, opus_int64 shift){
ops_count += 1; ops_count += 1;
return a >> shift; return a >> shift;
} }
#undef silk_RSHIFT_uint #undef silk_RSHIFT_uint
static inline opus_uint32 silk_RSHIFT_uint(opus_uint32 a, opus_int32 shift){ static OPUS_INLINE opus_uint32 silk_RSHIFT_uint(opus_uint32 a, opus_int32 shift){
ops_count += 1; ops_count += 1;
return a >> shift; return a >> shift;
} }
#undef silk_ADD_LSHIFT #undef silk_ADD_LSHIFT
static inline opus_int32 silk_ADD_LSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){ static OPUS_INLINE opus_int32 silk_ADD_LSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret; opus_int32 ret;
ops_count += 1; ops_count += 1;
ret = a + (b << shift); ret = a + (b << shift);
return ret; /* shift >= 0*/ return ret; /* shift >= 0*/
} }
#undef silk_ADD_LSHIFT32 #undef silk_ADD_LSHIFT32
static inline opus_int32 silk_ADD_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ static OPUS_INLINE opus_int32 silk_ADD_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret; opus_int32 ret;
ops_count += 1; ops_count += 1;
ret = a + (b << shift); ret = a + (b << shift);
return ret; /* shift >= 0*/ return ret; /* shift >= 0*/
} }
#undef silk_ADD_LSHIFT_uint #undef silk_ADD_LSHIFT_uint
static inline opus_uint32 silk_ADD_LSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){ static OPUS_INLINE opus_uint32 silk_ADD_LSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){
opus_uint32 ret; opus_uint32 ret;
ops_count += 1; ops_count += 1;
ret = a + (b << shift); ret = a + (b << shift);
return ret; /* shift >= 0*/ return ret; /* shift >= 0*/
} }
#undef silk_ADD_RSHIFT #undef silk_ADD_RSHIFT
static inline opus_int32 silk_ADD_RSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){ static OPUS_INLINE opus_int32 silk_ADD_RSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret; opus_int32 ret;
ops_count += 1; ops_count += 1;
ret = a + (b >> shift); ret = a + (b >> shift);
return ret; /* shift > 0*/ return ret; /* shift > 0*/
} }
#undef silk_ADD_RSHIFT32 #undef silk_ADD_RSHIFT32
static inline opus_int32 silk_ADD_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ static OPUS_INLINE opus_int32 silk_ADD_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret; opus_int32 ret;
ops_count += 1; ops_count += 1;
ret = a + (b >> shift); ret = a + (b >> shift);
return ret; /* shift > 0*/ return ret; /* shift > 0*/
} }
#undef silk_ADD_RSHIFT_uint #undef silk_ADD_RSHIFT_uint
static inline opus_uint32 silk_ADD_RSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){ static OPUS_INLINE opus_uint32 silk_ADD_RSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){
opus_uint32 ret; opus_uint32 ret;
ops_count += 1; ops_count += 1;
ret = a + (b >> shift); ret = a + (b >> shift);
return ret; /* shift > 0*/ return ret; /* shift > 0*/
} }
#undef silk_SUB_LSHIFT32 #undef silk_SUB_LSHIFT32
static inline opus_int32 silk_SUB_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ static OPUS_INLINE opus_int32 silk_SUB_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret; opus_int32 ret;
ops_count += 1; ops_count += 1;
ret = a - (b << shift); ret = a - (b << shift);
return ret; /* shift >= 0*/ return ret; /* shift >= 0*/
} }
#undef silk_SUB_RSHIFT32 #undef silk_SUB_RSHIFT32
static inline opus_int32 silk_SUB_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ static OPUS_INLINE opus_int32 silk_SUB_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret; opus_int32 ret;
ops_count += 1; ops_count += 1;
ret = a - (b >> shift); ret = a - (b >> shift);
@ -453,7 +453,7 @@ static inline opus_int32 silk_SUB_RSHIFT32(opus_int32 a, opus_int32 b, opus_int3
} }
#undef silk_RSHIFT_ROUND #undef silk_RSHIFT_ROUND
static inline opus_int32 silk_RSHIFT_ROUND(opus_int32 a, opus_int32 shift){ static OPUS_INLINE opus_int32 silk_RSHIFT_ROUND(opus_int32 a, opus_int32 shift){
opus_int32 ret; opus_int32 ret;
ops_count += 3; ops_count += 3;
ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1; ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1;
@ -461,7 +461,7 @@ static inline opus_int32 silk_RSHIFT_ROUND(opus_int32 a, opus_int32 shift){
} }
#undef silk_RSHIFT_ROUND64 #undef silk_RSHIFT_ROUND64
static inline opus_int64 silk_RSHIFT_ROUND64(opus_int64 a, opus_int32 shift){ static OPUS_INLINE opus_int64 silk_RSHIFT_ROUND64(opus_int64 a, opus_int32 shift){
opus_int64 ret; opus_int64 ret;
ops_count += 6; ops_count += 6;
ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1; ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1;
@ -469,13 +469,13 @@ static inline opus_int64 silk_RSHIFT_ROUND64(opus_int64 a, opus_int32 shift){
} }
#undef silk_abs_int64 #undef silk_abs_int64
static inline opus_int64 silk_abs_int64(opus_int64 a){ static OPUS_INLINE opus_int64 silk_abs_int64(opus_int64 a){
ops_count += 1; ops_count += 1;
return (((a) > 0) ? (a) : -(a)); /* Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN*/ return (((a) > 0) ? (a) : -(a)); /* Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN*/
} }
#undef silk_abs_int32 #undef silk_abs_int32
static inline opus_int32 silk_abs_int32(opus_int32 a){ static OPUS_INLINE opus_int32 silk_abs_int32(opus_int32 a){
ops_count += 1; ops_count += 1;
return silk_abs(a); return silk_abs(a);
} }
@ -498,7 +498,7 @@ static silk_sign(a){
} }
#undef silk_ADD16 #undef silk_ADD16
static inline opus_int16 silk_ADD16(opus_int16 a, opus_int16 b){ static OPUS_INLINE opus_int16 silk_ADD16(opus_int16 a, opus_int16 b){
opus_int16 ret; opus_int16 ret;
ops_count += 1; ops_count += 1;
ret = a + b; ret = a + b;
@ -506,7 +506,7 @@ static inline opus_int16 silk_ADD16(opus_int16 a, opus_int16 b){
} }
#undef silk_ADD32 #undef silk_ADD32
static inline opus_int32 silk_ADD32(opus_int32 a, opus_int32 b){ static OPUS_INLINE opus_int32 silk_ADD32(opus_int32 a, opus_int32 b){
opus_int32 ret; opus_int32 ret;
ops_count += 1; ops_count += 1;
ret = a + b; ret = a + b;
@ -514,7 +514,7 @@ static inline opus_int32 silk_ADD32(opus_int32 a, opus_int32 b){
} }
#undef silk_ADD64 #undef silk_ADD64
static inline opus_int64 silk_ADD64(opus_int64 a, opus_int64 b){ static OPUS_INLINE opus_int64 silk_ADD64(opus_int64 a, opus_int64 b){
opus_int64 ret; opus_int64 ret;
ops_count += 2; ops_count += 2;
ret = a + b; ret = a + b;
@ -522,7 +522,7 @@ static inline opus_int64 silk_ADD64(opus_int64 a, opus_int64 b){
} }
#undef silk_SUB16 #undef silk_SUB16
static inline opus_int16 silk_SUB16(opus_int16 a, opus_int16 b){ static OPUS_INLINE opus_int16 silk_SUB16(opus_int16 a, opus_int16 b){
opus_int16 ret; opus_int16 ret;
ops_count += 1; ops_count += 1;
ret = a - b; ret = a - b;
@ -530,7 +530,7 @@ static inline opus_int16 silk_SUB16(opus_int16 a, opus_int16 b){
} }
#undef silk_SUB32 #undef silk_SUB32
static inline opus_int32 silk_SUB32(opus_int32 a, opus_int32 b){ static OPUS_INLINE opus_int32 silk_SUB32(opus_int32 a, opus_int32 b){
opus_int32 ret; opus_int32 ret;
ops_count += 1; ops_count += 1;
ret = a - b; ret = a - b;
@ -538,7 +538,7 @@ static inline opus_int32 silk_SUB32(opus_int32 a, opus_int32 b){
} }
#undef silk_SUB64 #undef silk_SUB64
static inline opus_int64 silk_SUB64(opus_int64 a, opus_int64 b){ static OPUS_INLINE opus_int64 silk_SUB64(opus_int64 a, opus_int64 b){
opus_int64 ret; opus_int64 ret;
ops_count += 2; ops_count += 2;
ret = a - b; ret = a - b;
@ -546,7 +546,7 @@ static inline opus_int64 silk_SUB64(opus_int64 a, opus_int64 b){
} }
#undef silk_ADD_SAT16 #undef silk_ADD_SAT16
static inline opus_int16 silk_ADD_SAT16( opus_int16 a16, opus_int16 b16 ) { static OPUS_INLINE opus_int16 silk_ADD_SAT16( opus_int16 a16, opus_int16 b16 ) {
opus_int16 res; opus_int16 res;
/* Nb will be counted in AKP_add32 and silk_SAT16*/ /* Nb will be counted in AKP_add32 and silk_SAT16*/
res = (opus_int16)silk_SAT16( silk_ADD32( (opus_int32)(a16), (b16) ) ); res = (opus_int16)silk_SAT16( silk_ADD32( (opus_int32)(a16), (b16) ) );
@ -554,7 +554,7 @@ static inline opus_int16 silk_ADD_SAT16( opus_int16 a16, opus_int16 b16 ) {
} }
#undef silk_ADD_SAT32 #undef silk_ADD_SAT32
static inline opus_int32 silk_ADD_SAT32(opus_int32 a32, opus_int32 b32){ static OPUS_INLINE opus_int32 silk_ADD_SAT32(opus_int32 a32, opus_int32 b32){
opus_int32 res; opus_int32 res;
ops_count += 1; ops_count += 1;
res = ((((a32) + (b32)) & 0x80000000) == 0 ? \ res = ((((a32) + (b32)) & 0x80000000) == 0 ? \
@ -564,7 +564,7 @@ static inline opus_int32 silk_ADD_SAT32(opus_int32 a32, opus_int32 b32){
} }
#undef silk_ADD_SAT64 #undef silk_ADD_SAT64
static inline opus_int64 silk_ADD_SAT64( opus_int64 a64, opus_int64 b64 ) { static OPUS_INLINE opus_int64 silk_ADD_SAT64( opus_int64 a64, opus_int64 b64 ) {
opus_int64 res; opus_int64 res;
ops_count += 1; ops_count += 1;
res = ((((a64) + (b64)) & 0x8000000000000000LL) == 0 ? \ res = ((((a64) + (b64)) & 0x8000000000000000LL) == 0 ? \
@ -574,7 +574,7 @@ static inline opus_int64 silk_ADD_SAT64( opus_int64 a64, opus_int64 b64 ) {
} }
#undef silk_SUB_SAT16 #undef silk_SUB_SAT16
static inline opus_int16 silk_SUB_SAT16( opus_int16 a16, opus_int16 b16 ) { static OPUS_INLINE opus_int16 silk_SUB_SAT16( opus_int16 a16, opus_int16 b16 ) {
opus_int16 res; opus_int16 res;
silk_assert(0); silk_assert(0);
/* Nb will be counted in sub-macros*/ /* Nb will be counted in sub-macros*/
@ -583,7 +583,7 @@ static inline opus_int16 silk_SUB_SAT16( opus_int16 a16, opus_int16 b16 ) {
} }
#undef silk_SUB_SAT32 #undef silk_SUB_SAT32
static inline opus_int32 silk_SUB_SAT32( opus_int32 a32, opus_int32 b32 ) { static OPUS_INLINE opus_int32 silk_SUB_SAT32( opus_int32 a32, opus_int32 b32 ) {
opus_int32 res; opus_int32 res;
ops_count += 1; ops_count += 1;
res = ((((a32)-(b32)) & 0x80000000) == 0 ? \ res = ((((a32)-(b32)) & 0x80000000) == 0 ? \
@ -593,7 +593,7 @@ static inline opus_int32 silk_SUB_SAT32( opus_int32 a32, opus_int32 b32 ) {
} }
#undef silk_SUB_SAT64 #undef silk_SUB_SAT64
static inline opus_int64 silk_SUB_SAT64( opus_int64 a64, opus_int64 b64 ) { static OPUS_INLINE opus_int64 silk_SUB_SAT64( opus_int64 a64, opus_int64 b64 ) {
opus_int64 res; opus_int64 res;
ops_count += 1; ops_count += 1;
res = ((((a64)-(b64)) & 0x8000000000000000LL) == 0 ? \ res = ((((a64)-(b64)) & 0x8000000000000000LL) == 0 ? \
@ -604,7 +604,7 @@ static inline opus_int64 silk_SUB_SAT64( opus_int64 a64, opus_int64 b64 ) {
} }
#undef silk_SMULWW #undef silk_SMULWW
static inline opus_int32 silk_SMULWW(opus_int32 a32, opus_int32 b32){ static OPUS_INLINE opus_int32 silk_SMULWW(opus_int32 a32, opus_int32 b32){
opus_int32 ret; opus_int32 ret;
/* Nb will be counted in sub-macros*/ /* Nb will be counted in sub-macros*/
ret = silk_MLA(silk_SMULWB((a32), (b32)), (a32), silk_RSHIFT_ROUND((b32), 16)); ret = silk_MLA(silk_SMULWB((a32), (b32)), (a32), silk_RSHIFT_ROUND((b32), 16));
@ -612,7 +612,7 @@ static inline opus_int32 silk_SMULWW(opus_int32 a32, opus_int32 b32){
} }
#undef silk_SMLAWW #undef silk_SMLAWW
static inline opus_int32 silk_SMLAWW(opus_int32 a32, opus_int32 b32, opus_int32 c32){ static OPUS_INLINE opus_int32 silk_SMLAWW(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret; opus_int32 ret;
/* Nb will be counted in sub-macros*/ /* Nb will be counted in sub-macros*/
ret = silk_MLA(silk_SMLAWB((a32), (b32), (c32)), (b32), silk_RSHIFT_ROUND((c32), 16)); ret = silk_MLA(silk_SMLAWB((a32), (b32), (c32)), (b32), silk_RSHIFT_ROUND((c32), 16));
@ -620,26 +620,26 @@ static inline opus_int32 silk_SMLAWW(opus_int32 a32, opus_int32 b32, opus_int32
} }
#undef silk_min_int #undef silk_min_int
static inline opus_int silk_min_int(opus_int a, opus_int b) static OPUS_INLINE opus_int silk_min_int(opus_int a, opus_int b)
{ {
ops_count += 1; ops_count += 1;
return (((a) < (b)) ? (a) : (b)); return (((a) < (b)) ? (a) : (b));
} }
#undef silk_min_16 #undef silk_min_16
static inline opus_int16 silk_min_16(opus_int16 a, opus_int16 b) static OPUS_INLINE opus_int16 silk_min_16(opus_int16 a, opus_int16 b)
{ {
ops_count += 1; ops_count += 1;
return (((a) < (b)) ? (a) : (b)); return (((a) < (b)) ? (a) : (b));
} }
#undef silk_min_32 #undef silk_min_32
static inline opus_int32 silk_min_32(opus_int32 a, opus_int32 b) static OPUS_INLINE opus_int32 silk_min_32(opus_int32 a, opus_int32 b)
{ {
ops_count += 1; ops_count += 1;
return (((a) < (b)) ? (a) : (b)); return (((a) < (b)) ? (a) : (b));
} }
#undef silk_min_64 #undef silk_min_64
static inline opus_int64 silk_min_64(opus_int64 a, opus_int64 b) static OPUS_INLINE opus_int64 silk_min_64(opus_int64 a, opus_int64 b)
{ {
ops_count += 1; ops_count += 1;
return (((a) < (b)) ? (a) : (b)); return (((a) < (b)) ? (a) : (b));
@ -647,26 +647,26 @@ static inline opus_int64 silk_min_64(opus_int64 a, opus_int64 b)
/* silk_min() versions with typecast in the function call */ /* silk_min() versions with typecast in the function call */
#undef silk_max_int #undef silk_max_int
static inline opus_int silk_max_int(opus_int a, opus_int b) static OPUS_INLINE opus_int silk_max_int(opus_int a, opus_int b)
{ {
ops_count += 1; ops_count += 1;
return (((a) > (b)) ? (a) : (b)); return (((a) > (b)) ? (a) : (b));
} }
#undef silk_max_16 #undef silk_max_16
static inline opus_int16 silk_max_16(opus_int16 a, opus_int16 b) static OPUS_INLINE opus_int16 silk_max_16(opus_int16 a, opus_int16 b)
{ {
ops_count += 1; ops_count += 1;
return (((a) > (b)) ? (a) : (b)); return (((a) > (b)) ? (a) : (b));
} }
#undef silk_max_32 #undef silk_max_32
static inline opus_int32 silk_max_32(opus_int32 a, opus_int32 b) static OPUS_INLINE opus_int32 silk_max_32(opus_int32 a, opus_int32 b)
{ {
ops_count += 1; ops_count += 1;
return (((a) > (b)) ? (a) : (b)); return (((a) > (b)) ? (a) : (b));
} }
#undef silk_max_64 #undef silk_max_64
static inline opus_int64 silk_max_64(opus_int64 a, opus_int64 b) static OPUS_INLINE opus_int64 silk_max_64(opus_int64 a, opus_int64 b)
{ {
ops_count += 1; ops_count += 1;
return (((a) > (b)) ? (a) : (b)); return (((a) > (b)) ? (a) : (b));
@ -674,7 +674,7 @@ static inline opus_int64 silk_max_64(opus_int64 a, opus_int64 b)
#undef silk_LIMIT_int #undef silk_LIMIT_int
static inline opus_int silk_LIMIT_int(opus_int a, opus_int limit1, opus_int limit2) static OPUS_INLINE opus_int silk_LIMIT_int(opus_int a, opus_int limit1, opus_int limit2)
{ {
opus_int ret; opus_int ret;
ops_count += 6; ops_count += 6;
@ -686,7 +686,7 @@ static inline opus_int silk_LIMIT_int(opus_int a, opus_int limit1, opus_int limi
} }
#undef silk_LIMIT_16 #undef silk_LIMIT_16
static inline opus_int16 silk_LIMIT_16(opus_int16 a, opus_int16 limit1, opus_int16 limit2) static OPUS_INLINE opus_int16 silk_LIMIT_16(opus_int16 a, opus_int16 limit1, opus_int16 limit2)
{ {
opus_int16 ret; opus_int16 ret;
ops_count += 6; ops_count += 6;
@ -699,7 +699,7 @@ return(ret);
#undef silk_LIMIT_32 #undef silk_LIMIT_32
static inline opus_int silk_LIMIT_32(opus_int32 a, opus_int32 limit1, opus_int32 limit2) static OPUS_INLINE opus_int silk_LIMIT_32(opus_int32 a, opus_int32 limit1, opus_int32 limit2)
{ {
opus_int32 ret; opus_int32 ret;
ops_count += 6; ops_count += 6;

View file

@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
#undef silk_ADD16 #undef silk_ADD16
#define silk_ADD16(a,b) silk_ADD16_((a), (b), __FILE__, __LINE__) #define silk_ADD16(a,b) silk_ADD16_((a), (b), __FILE__, __LINE__)
static inline opus_int16 silk_ADD16_(opus_int16 a, opus_int16 b, char *file, int line){ static OPUS_INLINE opus_int16 silk_ADD16_(opus_int16 a, opus_int16 b, char *file, int line){
opus_int16 ret; opus_int16 ret;
ret = a + b; ret = a + b;
@ -52,7 +52,7 @@ static inline opus_int16 silk_ADD16_(opus_int16 a, opus_int16 b, char *file, int
#undef silk_ADD32 #undef silk_ADD32
#define silk_ADD32(a,b) silk_ADD32_((a), (b), __FILE__, __LINE__) #define silk_ADD32(a,b) silk_ADD32_((a), (b), __FILE__, __LINE__)
static inline opus_int32 silk_ADD32_(opus_int32 a, opus_int32 b, char *file, int line){ static OPUS_INLINE opus_int32 silk_ADD32_(opus_int32 a, opus_int32 b, char *file, int line){
opus_int32 ret; opus_int32 ret;
ret = a + b; ret = a + b;
@ -68,7 +68,7 @@ static inline opus_int32 silk_ADD32_(opus_int32 a, opus_int32 b, char *file, int
#undef silk_ADD64 #undef silk_ADD64
#define silk_ADD64(a,b) silk_ADD64_((a), (b), __FILE__, __LINE__) #define silk_ADD64(a,b) silk_ADD64_((a), (b), __FILE__, __LINE__)
static inline opus_int64 silk_ADD64_(opus_int64 a, opus_int64 b, char *file, int line){ static OPUS_INLINE opus_int64 silk_ADD64_(opus_int64 a, opus_int64 b, char *file, int line){
opus_int64 ret; opus_int64 ret;
ret = a + b; ret = a + b;
@ -84,7 +84,7 @@ static inline opus_int64 silk_ADD64_(opus_int64 a, opus_int64 b, char *file, int
#undef silk_SUB16 #undef silk_SUB16
#define silk_SUB16(a,b) silk_SUB16_((a), (b), __FILE__, __LINE__) #define silk_SUB16(a,b) silk_SUB16_((a), (b), __FILE__, __LINE__)
static inline opus_int16 silk_SUB16_(opus_int16 a, opus_int16 b, char *file, int line){ static OPUS_INLINE opus_int16 silk_SUB16_(opus_int16 a, opus_int16 b, char *file, int line){
opus_int16 ret; opus_int16 ret;
ret = a - b; ret = a - b;
@ -100,7 +100,7 @@ static inline opus_int16 silk_SUB16_(opus_int16 a, opus_int16 b, char *file, int
#undef silk_SUB32 #undef silk_SUB32
#define silk_SUB32(a,b) silk_SUB32_((a), (b), __FILE__, __LINE__) #define silk_SUB32(a,b) silk_SUB32_((a), (b), __FILE__, __LINE__)
static inline opus_int32 silk_SUB32_(opus_int32 a, opus_int32 b, char *file, int line){ static OPUS_INLINE opus_int32 silk_SUB32_(opus_int32 a, opus_int32 b, char *file, int line){
opus_int32 ret; opus_int32 ret;
ret = a - b; ret = a - b;
@ -116,7 +116,7 @@ static inline opus_int32 silk_SUB32_(opus_int32 a, opus_int32 b, char *file, int
#undef silk_SUB64 #undef silk_SUB64
#define silk_SUB64(a,b) silk_SUB64_((a), (b), __FILE__, __LINE__) #define silk_SUB64(a,b) silk_SUB64_((a), (b), __FILE__, __LINE__)
static inline opus_int64 silk_SUB64_(opus_int64 a, opus_int64 b, char *file, int line){ static OPUS_INLINE opus_int64 silk_SUB64_(opus_int64 a, opus_int64 b, char *file, int line){
opus_int64 ret; opus_int64 ret;
ret = a - b; ret = a - b;
@ -132,7 +132,7 @@ static inline opus_int64 silk_SUB64_(opus_int64 a, opus_int64 b, char *file, int
#undef silk_ADD_SAT16 #undef silk_ADD_SAT16
#define silk_ADD_SAT16(a,b) silk_ADD_SAT16_((a), (b), __FILE__, __LINE__) #define silk_ADD_SAT16(a,b) silk_ADD_SAT16_((a), (b), __FILE__, __LINE__)
static inline opus_int16 silk_ADD_SAT16_( opus_int16 a16, opus_int16 b16, char *file, int line) { static OPUS_INLINE opus_int16 silk_ADD_SAT16_( opus_int16 a16, opus_int16 b16, char *file, int line) {
opus_int16 res; opus_int16 res;
res = (opus_int16)silk_SAT16( silk_ADD32( (opus_int32)(a16), (b16) ) ); res = (opus_int16)silk_SAT16( silk_ADD32( (opus_int32)(a16), (b16) ) );
if ( res != silk_SAT16( (opus_int32)a16 + (opus_int32)b16 ) ) if ( res != silk_SAT16( (opus_int32)a16 + (opus_int32)b16 ) )
@ -147,7 +147,7 @@ static inline opus_int16 silk_ADD_SAT16_( opus_int16 a16, opus_int16 b16, char *
#undef silk_ADD_SAT32 #undef silk_ADD_SAT32
#define silk_ADD_SAT32(a,b) silk_ADD_SAT32_((a), (b), __FILE__, __LINE__) #define silk_ADD_SAT32(a,b) silk_ADD_SAT32_((a), (b), __FILE__, __LINE__)
static inline opus_int32 silk_ADD_SAT32_(opus_int32 a32, opus_int32 b32, char *file, int line){ static OPUS_INLINE opus_int32 silk_ADD_SAT32_(opus_int32 a32, opus_int32 b32, char *file, int line){
opus_int32 res; opus_int32 res;
res = ((((opus_uint32)(a32) + (opus_uint32)(b32)) & 0x80000000) == 0 ? \ res = ((((opus_uint32)(a32) + (opus_uint32)(b32)) & 0x80000000) == 0 ? \
((((a32) & (b32)) & 0x80000000) != 0 ? silk_int32_MIN : (a32)+(b32)) : \ ((((a32) & (b32)) & 0x80000000) != 0 ? silk_int32_MIN : (a32)+(b32)) : \
@ -164,7 +164,7 @@ static inline opus_int32 silk_ADD_SAT32_(opus_int32 a32, opus_int32 b32, char *f
#undef silk_ADD_SAT64 #undef silk_ADD_SAT64
#define silk_ADD_SAT64(a,b) silk_ADD_SAT64_((a), (b), __FILE__, __LINE__) #define silk_ADD_SAT64(a,b) silk_ADD_SAT64_((a), (b), __FILE__, __LINE__)
static inline opus_int64 silk_ADD_SAT64_( opus_int64 a64, opus_int64 b64, char *file, int line) { static OPUS_INLINE opus_int64 silk_ADD_SAT64_( opus_int64 a64, opus_int64 b64, char *file, int line) {
opus_int64 res; opus_int64 res;
int fail = 0; int fail = 0;
res = ((((a64) + (b64)) & 0x8000000000000000LL) == 0 ? \ res = ((((a64) + (b64)) & 0x8000000000000000LL) == 0 ? \
@ -193,7 +193,7 @@ static inline opus_int64 silk_ADD_SAT64_( opus_int64 a64, opus_int64 b64, char *
#undef silk_SUB_SAT16 #undef silk_SUB_SAT16
#define silk_SUB_SAT16(a,b) silk_SUB_SAT16_((a), (b), __FILE__, __LINE__) #define silk_SUB_SAT16(a,b) silk_SUB_SAT16_((a), (b), __FILE__, __LINE__)
static inline opus_int16 silk_SUB_SAT16_( opus_int16 a16, opus_int16 b16, char *file, int line ) { static OPUS_INLINE opus_int16 silk_SUB_SAT16_( opus_int16 a16, opus_int16 b16, char *file, int line ) {
opus_int16 res; opus_int16 res;
res = (opus_int16)silk_SAT16( silk_SUB32( (opus_int32)(a16), (b16) ) ); res = (opus_int16)silk_SAT16( silk_SUB32( (opus_int32)(a16), (b16) ) );
if ( res != silk_SAT16( (opus_int32)a16 - (opus_int32)b16 ) ) if ( res != silk_SAT16( (opus_int32)a16 - (opus_int32)b16 ) )
@ -208,7 +208,7 @@ static inline opus_int16 silk_SUB_SAT16_( opus_int16 a16, opus_int16 b16, char *
#undef silk_SUB_SAT32 #undef silk_SUB_SAT32
#define silk_SUB_SAT32(a,b) silk_SUB_SAT32_((a), (b), __FILE__, __LINE__) #define silk_SUB_SAT32(a,b) silk_SUB_SAT32_((a), (b), __FILE__, __LINE__)
static inline opus_int32 silk_SUB_SAT32_( opus_int32 a32, opus_int32 b32, char *file, int line ) { static OPUS_INLINE opus_int32 silk_SUB_SAT32_( opus_int32 a32, opus_int32 b32, char *file, int line ) {
opus_int32 res; opus_int32 res;
res = ((((opus_uint32)(a32)-(opus_uint32)(b32)) & 0x80000000) == 0 ? \ res = ((((opus_uint32)(a32)-(opus_uint32)(b32)) & 0x80000000) == 0 ? \
(( (a32) & ((b32)^0x80000000) & 0x80000000) ? silk_int32_MIN : (a32)-(b32)) : \ (( (a32) & ((b32)^0x80000000) & 0x80000000) ? silk_int32_MIN : (a32)-(b32)) : \
@ -225,7 +225,7 @@ static inline opus_int32 silk_SUB_SAT32_( opus_int32 a32, opus_int32 b32, char *
#undef silk_SUB_SAT64 #undef silk_SUB_SAT64
#define silk_SUB_SAT64(a,b) silk_SUB_SAT64_((a), (b), __FILE__, __LINE__) #define silk_SUB_SAT64(a,b) silk_SUB_SAT64_((a), (b), __FILE__, __LINE__)
static inline opus_int64 silk_SUB_SAT64_( opus_int64 a64, opus_int64 b64, char *file, int line ) { static OPUS_INLINE opus_int64 silk_SUB_SAT64_( opus_int64 a64, opus_int64 b64, char *file, int line ) {
opus_int64 res; opus_int64 res;
int fail = 0; int fail = 0;
res = ((((a64)-(b64)) & 0x8000000000000000LL) == 0 ? \ res = ((((a64)-(b64)) & 0x8000000000000000LL) == 0 ? \
@ -254,7 +254,7 @@ static inline opus_int64 silk_SUB_SAT64_( opus_int64 a64, opus_int64 b64, char *
#undef silk_MUL #undef silk_MUL
#define silk_MUL(a,b) silk_MUL_((a), (b), __FILE__, __LINE__) #define silk_MUL(a,b) silk_MUL_((a), (b), __FILE__, __LINE__)
static inline opus_int32 silk_MUL_(opus_int32 a32, opus_int32 b32, char *file, int line){ static OPUS_INLINE opus_int32 silk_MUL_(opus_int32 a32, opus_int32 b32, char *file, int line){
opus_int32 ret; opus_int32 ret;
opus_int64 ret64; opus_int64 ret64;
ret = a32 * b32; ret = a32 * b32;
@ -271,7 +271,7 @@ static inline opus_int32 silk_MUL_(opus_int32 a32, opus_int32 b32, char *file, i
#undef silk_MUL_uint #undef silk_MUL_uint
#define silk_MUL_uint(a,b) silk_MUL_uint_((a), (b), __FILE__, __LINE__) #define silk_MUL_uint(a,b) silk_MUL_uint_((a), (b), __FILE__, __LINE__)
static inline opus_uint32 silk_MUL_uint_(opus_uint32 a32, opus_uint32 b32, char *file, int line){ static OPUS_INLINE opus_uint32 silk_MUL_uint_(opus_uint32 a32, opus_uint32 b32, char *file, int line){
opus_uint32 ret; opus_uint32 ret;
ret = a32 * b32; ret = a32 * b32;
if ( (opus_uint64)ret != (opus_uint64)a32 * (opus_uint64)b32 ) if ( (opus_uint64)ret != (opus_uint64)a32 * (opus_uint64)b32 )
@ -286,7 +286,7 @@ static inline opus_uint32 silk_MUL_uint_(opus_uint32 a32, opus_uint32 b32, char
#undef silk_MLA #undef silk_MLA
#define silk_MLA(a,b,c) silk_MLA_((a), (b), (c), __FILE__, __LINE__) #define silk_MLA(a,b,c) silk_MLA_((a), (b), (c), __FILE__, __LINE__)
static inline opus_int32 silk_MLA_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ static OPUS_INLINE opus_int32 silk_MLA_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){
opus_int32 ret; opus_int32 ret;
ret = a32 + b32 * c32; ret = a32 + b32 * c32;
if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (opus_int64)c32 ) if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (opus_int64)c32 )
@ -301,7 +301,7 @@ static inline opus_int32 silk_MLA_(opus_int32 a32, opus_int32 b32, opus_int32 c3
#undef silk_MLA_uint #undef silk_MLA_uint
#define silk_MLA_uint(a,b,c) silk_MLA_uint_((a), (b), (c), __FILE__, __LINE__) #define silk_MLA_uint(a,b,c) silk_MLA_uint_((a), (b), (c), __FILE__, __LINE__)
static inline opus_int32 silk_MLA_uint_(opus_uint32 a32, opus_uint32 b32, opus_uint32 c32, char *file, int line){ static OPUS_INLINE opus_int32 silk_MLA_uint_(opus_uint32 a32, opus_uint32 b32, opus_uint32 c32, char *file, int line){
opus_uint32 ret; opus_uint32 ret;
ret = a32 + b32 * c32; ret = a32 + b32 * c32;
if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (opus_int64)c32 ) if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (opus_int64)c32 )
@ -316,7 +316,7 @@ static inline opus_int32 silk_MLA_uint_(opus_uint32 a32, opus_uint32 b32, opus_u
#undef silk_SMULWB #undef silk_SMULWB
#define silk_SMULWB(a,b) silk_SMULWB_((a), (b), __FILE__, __LINE__) #define silk_SMULWB(a,b) silk_SMULWB_((a), (b), __FILE__, __LINE__)
static inline opus_int32 silk_SMULWB_(opus_int32 a32, opus_int32 b32, char *file, int line){ static OPUS_INLINE opus_int32 silk_SMULWB_(opus_int32 a32, opus_int32 b32, char *file, int line){
opus_int32 ret; opus_int32 ret;
ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16); ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16);
if ( (opus_int64)ret != ((opus_int64)a32 * (opus_int16)b32) >> 16 ) if ( (opus_int64)ret != ((opus_int64)a32 * (opus_int16)b32) >> 16 )
@ -331,7 +331,7 @@ static inline opus_int32 silk_SMULWB_(opus_int32 a32, opus_int32 b32, char *file
#undef silk_SMLAWB #undef silk_SMLAWB
#define silk_SMLAWB(a,b,c) silk_SMLAWB_((a), (b), (c), __FILE__, __LINE__) #define silk_SMLAWB(a,b,c) silk_SMLAWB_((a), (b), (c), __FILE__, __LINE__)
static inline opus_int32 silk_SMLAWB_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ static OPUS_INLINE opus_int32 silk_SMLAWB_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){
opus_int32 ret; opus_int32 ret;
ret = silk_ADD32( a32, silk_SMULWB( b32, c32 ) ); ret = silk_ADD32( a32, silk_SMULWB( b32, c32 ) );
if ( silk_ADD32( a32, silk_SMULWB( b32, c32 ) ) != silk_ADD_SAT32( a32, silk_SMULWB( b32, c32 ) ) ) if ( silk_ADD32( a32, silk_SMULWB( b32, c32 ) ) != silk_ADD_SAT32( a32, silk_SMULWB( b32, c32 ) ) )
@ -346,7 +346,7 @@ static inline opus_int32 silk_SMLAWB_(opus_int32 a32, opus_int32 b32, opus_int32
#undef silk_SMULWT #undef silk_SMULWT
#define silk_SMULWT(a,b) silk_SMULWT_((a), (b), __FILE__, __LINE__) #define silk_SMULWT(a,b) silk_SMULWT_((a), (b), __FILE__, __LINE__)
static inline opus_int32 silk_SMULWT_(opus_int32 a32, opus_int32 b32, char *file, int line){ static OPUS_INLINE opus_int32 silk_SMULWT_(opus_int32 a32, opus_int32 b32, char *file, int line){
opus_int32 ret; opus_int32 ret;
ret = (a32 >> 16) * (b32 >> 16) + (((a32 & 0x0000FFFF) * (b32 >> 16)) >> 16); ret = (a32 >> 16) * (b32 >> 16) + (((a32 & 0x0000FFFF) * (b32 >> 16)) >> 16);
if ( (opus_int64)ret != ((opus_int64)a32 * (b32 >> 16)) >> 16 ) if ( (opus_int64)ret != ((opus_int64)a32 * (b32 >> 16)) >> 16 )
@ -361,7 +361,7 @@ static inline opus_int32 silk_SMULWT_(opus_int32 a32, opus_int32 b32, char *file
#undef silk_SMLAWT #undef silk_SMLAWT
#define silk_SMLAWT(a,b,c) silk_SMLAWT_((a), (b), (c), __FILE__, __LINE__) #define silk_SMLAWT(a,b,c) silk_SMLAWT_((a), (b), (c), __FILE__, __LINE__)
static inline opus_int32 silk_SMLAWT_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ static OPUS_INLINE opus_int32 silk_SMLAWT_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){
opus_int32 ret; opus_int32 ret;
ret = a32 + ((b32 >> 16) * (c32 >> 16)) + (((b32 & 0x0000FFFF) * ((c32 >> 16)) >> 16)); ret = a32 + ((b32 >> 16) * (c32 >> 16)) + (((b32 & 0x0000FFFF) * ((c32 >> 16)) >> 16));
if ( (opus_int64)ret != (opus_int64)a32 + (((opus_int64)b32 * (c32 >> 16)) >> 16) ) if ( (opus_int64)ret != (opus_int64)a32 + (((opus_int64)b32 * (c32 >> 16)) >> 16) )
@ -376,7 +376,7 @@ static inline opus_int32 silk_SMLAWT_(opus_int32 a32, opus_int32 b32, opus_int32
#undef silk_SMULL #undef silk_SMULL
#define silk_SMULL(a,b) silk_SMULL_((a), (b), __FILE__, __LINE__) #define silk_SMULL(a,b) silk_SMULL_((a), (b), __FILE__, __LINE__)
static inline opus_int64 silk_SMULL_(opus_int64 a64, opus_int64 b64, char *file, int line){ static OPUS_INLINE opus_int64 silk_SMULL_(opus_int64 a64, opus_int64 b64, char *file, int line){
opus_int64 ret64; opus_int64 ret64;
int fail = 0; int fail = 0;
ret64 = a64 * b64; ret64 = a64 * b64;
@ -398,7 +398,7 @@ static inline opus_int64 silk_SMULL_(opus_int64 a64, opus_int64 b64, char *file,
/* no checking needed for silk_SMULBB */ /* no checking needed for silk_SMULBB */
#undef silk_SMLABB #undef silk_SMLABB
#define silk_SMLABB(a,b,c) silk_SMLABB_((a), (b), (c), __FILE__, __LINE__) #define silk_SMLABB(a,b,c) silk_SMLABB_((a), (b), (c), __FILE__, __LINE__)
static inline opus_int32 silk_SMLABB_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ static OPUS_INLINE opus_int32 silk_SMLABB_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){
opus_int32 ret; opus_int32 ret;
ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32); ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32);
if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (opus_int16)c32 ) if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (opus_int16)c32 )
@ -414,7 +414,7 @@ static inline opus_int32 silk_SMLABB_(opus_int32 a32, opus_int32 b32, opus_int32
/* no checking needed for silk_SMULBT */ /* no checking needed for silk_SMULBT */
#undef silk_SMLABT #undef silk_SMLABT
#define silk_SMLABT(a,b,c) silk_SMLABT_((a), (b), (c), __FILE__, __LINE__) #define silk_SMLABT(a,b,c) silk_SMLABT_((a), (b), (c), __FILE__, __LINE__)
static inline opus_int32 silk_SMLABT_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ static OPUS_INLINE opus_int32 silk_SMLABT_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){
opus_int32 ret; opus_int32 ret;
ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16); ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16);
if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (c32 >> 16) ) if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (c32 >> 16) )
@ -430,7 +430,7 @@ static inline opus_int32 silk_SMLABT_(opus_int32 a32, opus_int32 b32, opus_int32
/* no checking needed for silk_SMULTT */ /* no checking needed for silk_SMULTT */
#undef silk_SMLATT #undef silk_SMLATT
#define silk_SMLATT(a,b,c) silk_SMLATT_((a), (b), (c), __FILE__, __LINE__) #define silk_SMLATT(a,b,c) silk_SMLATT_((a), (b), (c), __FILE__, __LINE__)
static inline opus_int32 silk_SMLATT_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ static OPUS_INLINE opus_int32 silk_SMLATT_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){
opus_int32 ret; opus_int32 ret;
ret = a32 + (b32 >> 16) * (c32 >> 16); ret = a32 + (b32 >> 16) * (c32 >> 16);
if ( (opus_int64)ret != (opus_int64)a32 + (b32 >> 16) * (c32 >> 16) ) if ( (opus_int64)ret != (opus_int64)a32 + (b32 >> 16) * (c32 >> 16) )
@ -445,7 +445,7 @@ static inline opus_int32 silk_SMLATT_(opus_int32 a32, opus_int32 b32, opus_int32
#undef silk_SMULWW #undef silk_SMULWW
#define silk_SMULWW(a,b) silk_SMULWW_((a), (b), __FILE__, __LINE__) #define silk_SMULWW(a,b) silk_SMULWW_((a), (b), __FILE__, __LINE__)
static inline opus_int32 silk_SMULWW_(opus_int32 a32, opus_int32 b32, char *file, int line){ static OPUS_INLINE opus_int32 silk_SMULWW_(opus_int32 a32, opus_int32 b32, char *file, int line){
opus_int32 ret, tmp1, tmp2; opus_int32 ret, tmp1, tmp2;
opus_int64 ret64; opus_int64 ret64;
int fail = 0; int fail = 0;
@ -476,7 +476,7 @@ static inline opus_int32 silk_SMULWW_(opus_int32 a32, opus_int32 b32, char *file
#undef silk_SMLAWW #undef silk_SMLAWW
#define silk_SMLAWW(a,b,c) silk_SMLAWW_((a), (b), (c), __FILE__, __LINE__) #define silk_SMLAWW(a,b,c) silk_SMLAWW_((a), (b), (c), __FILE__, __LINE__)
static inline opus_int32 silk_SMLAWW_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ static OPUS_INLINE opus_int32 silk_SMLAWW_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){
opus_int32 ret, tmp; opus_int32 ret, tmp;
tmp = silk_SMULWW( b32, c32 ); tmp = silk_SMULWW( b32, c32 );
@ -505,7 +505,7 @@ static inline opus_int32 silk_SMLAWW_(opus_int32 a32, opus_int32 b32, opus_int32
#undef silk_DIV32 #undef silk_DIV32
#define silk_DIV32(a,b) silk_DIV32_((a), (b), __FILE__, __LINE__) #define silk_DIV32(a,b) silk_DIV32_((a), (b), __FILE__, __LINE__)
static inline opus_int32 silk_DIV32_(opus_int32 a32, opus_int32 b32, char *file, int line){ static OPUS_INLINE opus_int32 silk_DIV32_(opus_int32 a32, opus_int32 b32, char *file, int line){
if ( b32 == 0 ) if ( b32 == 0 )
{ {
fprintf (stderr, "silk_DIV32(%d, %d) in %s: line %d\n", a32, b32, file, line); fprintf (stderr, "silk_DIV32(%d, %d) in %s: line %d\n", a32, b32, file, line);
@ -518,7 +518,7 @@ static inline opus_int32 silk_DIV32_(opus_int32 a32, opus_int32 b32, char *file,
#undef silk_DIV32_16 #undef silk_DIV32_16
#define silk_DIV32_16(a,b) silk_DIV32_16_((a), (b), __FILE__, __LINE__) #define silk_DIV32_16(a,b) silk_DIV32_16_((a), (b), __FILE__, __LINE__)
static inline opus_int32 silk_DIV32_16_(opus_int32 a32, opus_int32 b32, char *file, int line){ static OPUS_INLINE opus_int32 silk_DIV32_16_(opus_int32 a32, opus_int32 b32, char *file, int line){
int fail = 0; int fail = 0;
fail |= b32 == 0; fail |= b32 == 0;
fail |= b32 > silk_int16_MAX; fail |= b32 > silk_int16_MAX;
@ -544,7 +544,7 @@ static inline opus_int32 silk_DIV32_16_(opus_int32 a32, opus_int32 b32, char *fi
#undef silk_LSHIFT8 #undef silk_LSHIFT8
#define silk_LSHIFT8(a,b) silk_LSHIFT8_((a), (b), __FILE__, __LINE__) #define silk_LSHIFT8(a,b) silk_LSHIFT8_((a), (b), __FILE__, __LINE__)
static inline opus_int8 silk_LSHIFT8_(opus_int8 a, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_int8 silk_LSHIFT8_(opus_int8 a, opus_int32 shift, char *file, int line){
opus_int8 ret; opus_int8 ret;
int fail = 0; int fail = 0;
ret = a << shift; ret = a << shift;
@ -563,7 +563,7 @@ static inline opus_int8 silk_LSHIFT8_(opus_int8 a, opus_int32 shift, char *file,
#undef silk_LSHIFT16 #undef silk_LSHIFT16
#define silk_LSHIFT16(a,b) silk_LSHIFT16_((a), (b), __FILE__, __LINE__) #define silk_LSHIFT16(a,b) silk_LSHIFT16_((a), (b), __FILE__, __LINE__)
static inline opus_int16 silk_LSHIFT16_(opus_int16 a, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_int16 silk_LSHIFT16_(opus_int16 a, opus_int32 shift, char *file, int line){
opus_int16 ret; opus_int16 ret;
int fail = 0; int fail = 0;
ret = a << shift; ret = a << shift;
@ -582,7 +582,7 @@ static inline opus_int16 silk_LSHIFT16_(opus_int16 a, opus_int32 shift, char *fi
#undef silk_LSHIFT32 #undef silk_LSHIFT32
#define silk_LSHIFT32(a,b) silk_LSHIFT32_((a), (b), __FILE__, __LINE__) #define silk_LSHIFT32(a,b) silk_LSHIFT32_((a), (b), __FILE__, __LINE__)
static inline opus_int32 silk_LSHIFT32_(opus_int32 a, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_int32 silk_LSHIFT32_(opus_int32 a, opus_int32 shift, char *file, int line){
opus_int32 ret; opus_int32 ret;
int fail = 0; int fail = 0;
ret = a << shift; ret = a << shift;
@ -601,7 +601,7 @@ static inline opus_int32 silk_LSHIFT32_(opus_int32 a, opus_int32 shift, char *fi
#undef silk_LSHIFT64 #undef silk_LSHIFT64
#define silk_LSHIFT64(a,b) silk_LSHIFT64_((a), (b), __FILE__, __LINE__) #define silk_LSHIFT64(a,b) silk_LSHIFT64_((a), (b), __FILE__, __LINE__)
static inline opus_int64 silk_LSHIFT64_(opus_int64 a, opus_int shift, char *file, int line){ static OPUS_INLINE opus_int64 silk_LSHIFT64_(opus_int64 a, opus_int shift, char *file, int line){
opus_int64 ret; opus_int64 ret;
int fail = 0; int fail = 0;
ret = a << shift; ret = a << shift;
@ -620,7 +620,7 @@ static inline opus_int64 silk_LSHIFT64_(opus_int64 a, opus_int shift, char *file
#undef silk_LSHIFT_ovflw #undef silk_LSHIFT_ovflw
#define silk_LSHIFT_ovflw(a,b) silk_LSHIFT_ovflw_((a), (b), __FILE__, __LINE__) #define silk_LSHIFT_ovflw(a,b) silk_LSHIFT_ovflw_((a), (b), __FILE__, __LINE__)
static inline opus_int32 silk_LSHIFT_ovflw_(opus_int32 a, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_int32 silk_LSHIFT_ovflw_(opus_int32 a, opus_int32 shift, char *file, int line){
if ( (shift < 0) || (shift >= 32) ) /* no check for overflow */ if ( (shift < 0) || (shift >= 32) ) /* no check for overflow */
{ {
fprintf (stderr, "silk_LSHIFT_ovflw(%d, %d) in %s: line %d\n", a, shift, file, line); fprintf (stderr, "silk_LSHIFT_ovflw(%d, %d) in %s: line %d\n", a, shift, file, line);
@ -633,7 +633,7 @@ static inline opus_int32 silk_LSHIFT_ovflw_(opus_int32 a, opus_int32 shift, char
#undef silk_LSHIFT_uint #undef silk_LSHIFT_uint
#define silk_LSHIFT_uint(a,b) silk_LSHIFT_uint_((a), (b), __FILE__, __LINE__) #define silk_LSHIFT_uint(a,b) silk_LSHIFT_uint_((a), (b), __FILE__, __LINE__)
static inline opus_uint32 silk_LSHIFT_uint_(opus_uint32 a, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_uint32 silk_LSHIFT_uint_(opus_uint32 a, opus_int32 shift, char *file, int line){
opus_uint32 ret; opus_uint32 ret;
ret = a << shift; ret = a << shift;
if ( (shift < 0) || ((opus_int64)ret != ((opus_int64)a) << shift)) if ( (shift < 0) || ((opus_int64)ret != ((opus_int64)a) << shift))
@ -648,7 +648,7 @@ static inline opus_uint32 silk_LSHIFT_uint_(opus_uint32 a, opus_int32 shift, cha
#undef silk_RSHIFT8 #undef silk_RSHIFT8
#define silk_RSHITF8(a,b) silk_RSHIFT8_((a), (b), __FILE__, __LINE__) #define silk_RSHITF8(a,b) silk_RSHIFT8_((a), (b), __FILE__, __LINE__)
static inline opus_int8 silk_RSHIFT8_(opus_int8 a, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_int8 silk_RSHIFT8_(opus_int8 a, opus_int32 shift, char *file, int line){
if ( (shift < 0) || (shift>=8) ) if ( (shift < 0) || (shift>=8) )
{ {
fprintf (stderr, "silk_RSHITF8(%d, %d) in %s: line %d\n", a, shift, file, line); fprintf (stderr, "silk_RSHITF8(%d, %d) in %s: line %d\n", a, shift, file, line);
@ -661,7 +661,7 @@ static inline opus_int8 silk_RSHIFT8_(opus_int8 a, opus_int32 shift, char *file,
#undef silk_RSHIFT16 #undef silk_RSHIFT16
#define silk_RSHITF16(a,b) silk_RSHIFT16_((a), (b), __FILE__, __LINE__) #define silk_RSHITF16(a,b) silk_RSHIFT16_((a), (b), __FILE__, __LINE__)
static inline opus_int16 silk_RSHIFT16_(opus_int16 a, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_int16 silk_RSHIFT16_(opus_int16 a, opus_int32 shift, char *file, int line){
if ( (shift < 0) || (shift>=16) ) if ( (shift < 0) || (shift>=16) )
{ {
fprintf (stderr, "silk_RSHITF16(%d, %d) in %s: line %d\n", a, shift, file, line); fprintf (stderr, "silk_RSHITF16(%d, %d) in %s: line %d\n", a, shift, file, line);
@ -674,7 +674,7 @@ static inline opus_int16 silk_RSHIFT16_(opus_int16 a, opus_int32 shift, char *fi
#undef silk_RSHIFT32 #undef silk_RSHIFT32
#define silk_RSHIFT32(a,b) silk_RSHIFT32_((a), (b), __FILE__, __LINE__) #define silk_RSHIFT32(a,b) silk_RSHIFT32_((a), (b), __FILE__, __LINE__)
static inline opus_int32 silk_RSHIFT32_(opus_int32 a, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_int32 silk_RSHIFT32_(opus_int32 a, opus_int32 shift, char *file, int line){
if ( (shift < 0) || (shift>=32) ) if ( (shift < 0) || (shift>=32) )
{ {
fprintf (stderr, "silk_RSHITF32(%d, %d) in %s: line %d\n", a, shift, file, line); fprintf (stderr, "silk_RSHITF32(%d, %d) in %s: line %d\n", a, shift, file, line);
@ -687,7 +687,7 @@ static inline opus_int32 silk_RSHIFT32_(opus_int32 a, opus_int32 shift, char *fi
#undef silk_RSHIFT64 #undef silk_RSHIFT64
#define silk_RSHIFT64(a,b) silk_RSHIFT64_((a), (b), __FILE__, __LINE__) #define silk_RSHIFT64(a,b) silk_RSHIFT64_((a), (b), __FILE__, __LINE__)
static inline opus_int64 silk_RSHIFT64_(opus_int64 a, opus_int64 shift, char *file, int line){ static OPUS_INLINE opus_int64 silk_RSHIFT64_(opus_int64 a, opus_int64 shift, char *file, int line){
if ( (shift < 0) || (shift>=64) ) if ( (shift < 0) || (shift>=64) )
{ {
fprintf (stderr, "silk_RSHITF64(%lld, %lld) in %s: line %d\n", (long long)a, (long long)shift, file, line); fprintf (stderr, "silk_RSHITF64(%lld, %lld) in %s: line %d\n", (long long)a, (long long)shift, file, line);
@ -700,7 +700,7 @@ static inline opus_int64 silk_RSHIFT64_(opus_int64 a, opus_int64 shift, char *fi
#undef silk_RSHIFT_uint #undef silk_RSHIFT_uint
#define silk_RSHIFT_uint(a,b) silk_RSHIFT_uint_((a), (b), __FILE__, __LINE__) #define silk_RSHIFT_uint(a,b) silk_RSHIFT_uint_((a), (b), __FILE__, __LINE__)
static inline opus_uint32 silk_RSHIFT_uint_(opus_uint32 a, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_uint32 silk_RSHIFT_uint_(opus_uint32 a, opus_int32 shift, char *file, int line){
if ( (shift < 0) || (shift>32) ) if ( (shift < 0) || (shift>32) )
{ {
fprintf (stderr, "silk_RSHIFT_uint(%u, %d) in %s: line %d\n", a, shift, file, line); fprintf (stderr, "silk_RSHIFT_uint(%u, %d) in %s: line %d\n", a, shift, file, line);
@ -713,7 +713,7 @@ static inline opus_uint32 silk_RSHIFT_uint_(opus_uint32 a, opus_int32 shift, cha
#undef silk_ADD_LSHIFT #undef silk_ADD_LSHIFT
#define silk_ADD_LSHIFT(a,b,c) silk_ADD_LSHIFT_((a), (b), (c), __FILE__, __LINE__) #define silk_ADD_LSHIFT(a,b,c) silk_ADD_LSHIFT_((a), (b), (c), __FILE__, __LINE__)
static inline int silk_ADD_LSHIFT_(int a, int b, int shift, char *file, int line){ static OPUS_INLINE int silk_ADD_LSHIFT_(int a, int b, int shift, char *file, int line){
opus_int16 ret; opus_int16 ret;
ret = a + (b << shift); ret = a + (b << shift);
if ( (shift < 0) || (shift>15) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) << shift)) ) if ( (shift < 0) || (shift>15) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) << shift)) )
@ -728,7 +728,7 @@ static inline int silk_ADD_LSHIFT_(int a, int b, int shift, char *file, int line
#undef silk_ADD_LSHIFT32 #undef silk_ADD_LSHIFT32
#define silk_ADD_LSHIFT32(a,b,c) silk_ADD_LSHIFT32_((a), (b), (c), __FILE__, __LINE__) #define silk_ADD_LSHIFT32(a,b,c) silk_ADD_LSHIFT32_((a), (b), (c), __FILE__, __LINE__)
static inline opus_int32 silk_ADD_LSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_int32 silk_ADD_LSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){
opus_int32 ret; opus_int32 ret;
ret = a + (b << shift); ret = a + (b << shift);
if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) << shift)) ) if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) << shift)) )
@ -743,7 +743,7 @@ static inline opus_int32 silk_ADD_LSHIFT32_(opus_int32 a, opus_int32 b, opus_int
#undef silk_ADD_LSHIFT_uint #undef silk_ADD_LSHIFT_uint
#define silk_ADD_LSHIFT_uint(a,b,c) silk_ADD_LSHIFT_uint_((a), (b), (c), __FILE__, __LINE__) #define silk_ADD_LSHIFT_uint(a,b,c) silk_ADD_LSHIFT_uint_((a), (b), (c), __FILE__, __LINE__)
static inline opus_uint32 silk_ADD_LSHIFT_uint_(opus_uint32 a, opus_uint32 b, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_uint32 silk_ADD_LSHIFT_uint_(opus_uint32 a, opus_uint32 b, opus_int32 shift, char *file, int line){
opus_uint32 ret; opus_uint32 ret;
ret = a + (b << shift); ret = a + (b << shift);
if ( (shift < 0) || (shift>32) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) << shift)) ) if ( (shift < 0) || (shift>32) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) << shift)) )
@ -758,7 +758,7 @@ static inline opus_uint32 silk_ADD_LSHIFT_uint_(opus_uint32 a, opus_uint32 b, op
#undef silk_ADD_RSHIFT #undef silk_ADD_RSHIFT
#define silk_ADD_RSHIFT(a,b,c) silk_ADD_RSHIFT_((a), (b), (c), __FILE__, __LINE__) #define silk_ADD_RSHIFT(a,b,c) silk_ADD_RSHIFT_((a), (b), (c), __FILE__, __LINE__)
static inline int silk_ADD_RSHIFT_(int a, int b, int shift, char *file, int line){ static OPUS_INLINE int silk_ADD_RSHIFT_(int a, int b, int shift, char *file, int line){
opus_int16 ret; opus_int16 ret;
ret = a + (b >> shift); ret = a + (b >> shift);
if ( (shift < 0) || (shift>15) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) >> shift)) ) if ( (shift < 0) || (shift>15) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) >> shift)) )
@ -773,7 +773,7 @@ static inline int silk_ADD_RSHIFT_(int a, int b, int shift, char *file, int line
#undef silk_ADD_RSHIFT32 #undef silk_ADD_RSHIFT32
#define silk_ADD_RSHIFT32(a,b,c) silk_ADD_RSHIFT32_((a), (b), (c), __FILE__, __LINE__) #define silk_ADD_RSHIFT32(a,b,c) silk_ADD_RSHIFT32_((a), (b), (c), __FILE__, __LINE__)
static inline opus_int32 silk_ADD_RSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_int32 silk_ADD_RSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){
opus_int32 ret; opus_int32 ret;
ret = a + (b >> shift); ret = a + (b >> shift);
if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) >> shift)) ) if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) >> shift)) )
@ -788,7 +788,7 @@ static inline opus_int32 silk_ADD_RSHIFT32_(opus_int32 a, opus_int32 b, opus_int
#undef silk_ADD_RSHIFT_uint #undef silk_ADD_RSHIFT_uint
#define silk_ADD_RSHIFT_uint(a,b,c) silk_ADD_RSHIFT_uint_((a), (b), (c), __FILE__, __LINE__) #define silk_ADD_RSHIFT_uint(a,b,c) silk_ADD_RSHIFT_uint_((a), (b), (c), __FILE__, __LINE__)
static inline opus_uint32 silk_ADD_RSHIFT_uint_(opus_uint32 a, opus_uint32 b, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_uint32 silk_ADD_RSHIFT_uint_(opus_uint32 a, opus_uint32 b, opus_int32 shift, char *file, int line){
opus_uint32 ret; opus_uint32 ret;
ret = a + (b >> shift); ret = a + (b >> shift);
if ( (shift < 0) || (shift>32) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) >> shift)) ) if ( (shift < 0) || (shift>32) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) >> shift)) )
@ -803,7 +803,7 @@ static inline opus_uint32 silk_ADD_RSHIFT_uint_(opus_uint32 a, opus_uint32 b, op
#undef silk_SUB_LSHIFT32 #undef silk_SUB_LSHIFT32
#define silk_SUB_LSHIFT32(a,b,c) silk_SUB_LSHIFT32_((a), (b), (c), __FILE__, __LINE__) #define silk_SUB_LSHIFT32(a,b,c) silk_SUB_LSHIFT32_((a), (b), (c), __FILE__, __LINE__)
static inline opus_int32 silk_SUB_LSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_int32 silk_SUB_LSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){
opus_int32 ret; opus_int32 ret;
ret = a - (b << shift); ret = a - (b << shift);
if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a - (((opus_int64)b) << shift)) ) if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a - (((opus_int64)b) << shift)) )
@ -818,7 +818,7 @@ static inline opus_int32 silk_SUB_LSHIFT32_(opus_int32 a, opus_int32 b, opus_int
#undef silk_SUB_RSHIFT32 #undef silk_SUB_RSHIFT32
#define silk_SUB_RSHIFT32(a,b,c) silk_SUB_RSHIFT32_((a), (b), (c), __FILE__, __LINE__) #define silk_SUB_RSHIFT32(a,b,c) silk_SUB_RSHIFT32_((a), (b), (c), __FILE__, __LINE__)
static inline opus_int32 silk_SUB_RSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_int32 silk_SUB_RSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){
opus_int32 ret; opus_int32 ret;
ret = a - (b >> shift); ret = a - (b >> shift);
if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a - (((opus_int64)b) >> shift)) ) if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a - (((opus_int64)b) >> shift)) )
@ -833,7 +833,7 @@ static inline opus_int32 silk_SUB_RSHIFT32_(opus_int32 a, opus_int32 b, opus_int
#undef silk_RSHIFT_ROUND #undef silk_RSHIFT_ROUND
#define silk_RSHIFT_ROUND(a,b) silk_RSHIFT_ROUND_((a), (b), __FILE__, __LINE__) #define silk_RSHIFT_ROUND(a,b) silk_RSHIFT_ROUND_((a), (b), __FILE__, __LINE__)
static inline opus_int32 silk_RSHIFT_ROUND_(opus_int32 a, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_int32 silk_RSHIFT_ROUND_(opus_int32 a, opus_int32 shift, char *file, int line){
opus_int32 ret; opus_int32 ret;
ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1; ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1;
/* the marco definition can't handle a shift of zero */ /* the marco definition can't handle a shift of zero */
@ -849,7 +849,7 @@ static inline opus_int32 silk_RSHIFT_ROUND_(opus_int32 a, opus_int32 shift, char
#undef silk_RSHIFT_ROUND64 #undef silk_RSHIFT_ROUND64
#define silk_RSHIFT_ROUND64(a,b) silk_RSHIFT_ROUND64_((a), (b), __FILE__, __LINE__) #define silk_RSHIFT_ROUND64(a,b) silk_RSHIFT_ROUND64_((a), (b), __FILE__, __LINE__)
static inline opus_int64 silk_RSHIFT_ROUND64_(opus_int64 a, opus_int32 shift, char *file, int line){ static OPUS_INLINE opus_int64 silk_RSHIFT_ROUND64_(opus_int64 a, opus_int32 shift, char *file, int line){
opus_int64 ret; opus_int64 ret;
/* the marco definition can't handle a shift of zero */ /* the marco definition can't handle a shift of zero */
if ( (shift <= 0) || (shift>=64) ) if ( (shift <= 0) || (shift>=64) )
@ -865,14 +865,14 @@ static inline opus_int64 silk_RSHIFT_ROUND64_(opus_int64 a, opus_int32 shift, ch
/* silk_abs is used on floats also, so doesn't work... */ /* silk_abs is used on floats also, so doesn't work... */
/*#undef silk_abs /*#undef silk_abs
static inline opus_int32 silk_abs(opus_int32 a){ static OPUS_INLINE opus_int32 silk_abs(opus_int32 a){
silk_assert(a != 0x80000000); silk_assert(a != 0x80000000);
return (((a) > 0) ? (a) : -(a)); // Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN return (((a) > 0) ? (a) : -(a)); // Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN
}*/ }*/
#undef silk_abs_int64 #undef silk_abs_int64
#define silk_abs_int64(a) silk_abs_int64_((a), __FILE__, __LINE__) #define silk_abs_int64(a) silk_abs_int64_((a), __FILE__, __LINE__)
static inline opus_int64 silk_abs_int64_(opus_int64 a, char *file, int line){ static OPUS_INLINE opus_int64 silk_abs_int64_(opus_int64 a, char *file, int line){
if ( a == silk_int64_MIN ) if ( a == silk_int64_MIN )
{ {
fprintf (stderr, "silk_abs_int64(%lld) in %s: line %d\n", (long long)a, file, line); fprintf (stderr, "silk_abs_int64(%lld) in %s: line %d\n", (long long)a, file, line);
@ -885,7 +885,7 @@ static inline opus_int64 silk_abs_int64_(opus_int64 a, char *file, int line){
#undef silk_abs_int32 #undef silk_abs_int32
#define silk_abs_int32(a) silk_abs_int32_((a), __FILE__, __LINE__) #define silk_abs_int32(a) silk_abs_int32_((a), __FILE__, __LINE__)
static inline opus_int32 silk_abs_int32_(opus_int32 a, char *file, int line){ static OPUS_INLINE opus_int32 silk_abs_int32_(opus_int32 a, char *file, int line){
if ( a == silk_int32_MIN ) if ( a == silk_int32_MIN )
{ {
fprintf (stderr, "silk_abs_int32(%d) in %s: line %d\n", a, file, line); fprintf (stderr, "silk_abs_int32(%d) in %s: line %d\n", a, file, line);
@ -898,7 +898,7 @@ static inline opus_int32 silk_abs_int32_(opus_int32 a, char *file, int line){
#undef silk_CHECK_FIT8 #undef silk_CHECK_FIT8
#define silk_CHECK_FIT8(a) silk_CHECK_FIT8_((a), __FILE__, __LINE__) #define silk_CHECK_FIT8(a) silk_CHECK_FIT8_((a), __FILE__, __LINE__)
static inline opus_int8 silk_CHECK_FIT8_( opus_int64 a, char *file, int line ){ static OPUS_INLINE opus_int8 silk_CHECK_FIT8_( opus_int64 a, char *file, int line ){
opus_int8 ret; opus_int8 ret;
ret = (opus_int8)a; ret = (opus_int8)a;
if ( (opus_int64)ret != a ) if ( (opus_int64)ret != a )
@ -913,7 +913,7 @@ static inline opus_int8 silk_CHECK_FIT8_( opus_int64 a, char *file, int line ){
#undef silk_CHECK_FIT16 #undef silk_CHECK_FIT16
#define silk_CHECK_FIT16(a) silk_CHECK_FIT16_((a), __FILE__, __LINE__) #define silk_CHECK_FIT16(a) silk_CHECK_FIT16_((a), __FILE__, __LINE__)
static inline opus_int16 silk_CHECK_FIT16_( opus_int64 a, char *file, int line ){ static OPUS_INLINE opus_int16 silk_CHECK_FIT16_( opus_int64 a, char *file, int line ){
opus_int16 ret; opus_int16 ret;
ret = (opus_int16)a; ret = (opus_int16)a;
if ( (opus_int64)ret != a ) if ( (opus_int64)ret != a )
@ -928,7 +928,7 @@ static inline opus_int16 silk_CHECK_FIT16_( opus_int64 a, char *file, int line )
#undef silk_CHECK_FIT32 #undef silk_CHECK_FIT32
#define silk_CHECK_FIT32(a) silk_CHECK_FIT32_((a), __FILE__, __LINE__) #define silk_CHECK_FIT32(a) silk_CHECK_FIT32_((a), __FILE__, __LINE__)
static inline opus_int32 silk_CHECK_FIT32_( opus_int64 a, char *file, int line ){ static OPUS_INLINE opus_int32 silk_CHECK_FIT32_( opus_int64 a, char *file, int line ){
opus_int32 ret; opus_int32 ret;
ret = (opus_int32)a; ret = (opus_int32)a;
if ( (opus_int64)ret != a ) if ( (opus_int64)ret != a )

View file

@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define QA 16 #define QA 16
/* helper function for NLSF2A(..) */ /* helper function for NLSF2A(..) */
static inline void silk_NLSF2A_find_poly( static OPUS_INLINE void silk_NLSF2A_find_poly(
opus_int32 *out, /* O intermediate polynomial, QA [dd+1] */ opus_int32 *out, /* O intermediate polynomial, QA [dd+1] */
const opus_int32 *cLSF, /* I vector of interleaved 2*cos(LSFs), QA [d] */ const opus_int32 *cLSF, /* I vector of interleaved 2*cos(LSFs), QA [d] */
opus_int dd /* I polynomial order (= 1/2 * filter order) */ opus_int dd /* I polynomial order (= 1/2 * filter order) */

View file

@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "main.h" #include "main.h"
/* Predictive dequantizer for NLSF residuals */ /* Predictive dequantizer for NLSF residuals */
static inline void silk_NLSF_residual_dequant( /* O Returns RD value in Q30 */ static OPUS_INLINE void silk_NLSF_residual_dequant( /* O Returns RD value in Q30 */
opus_int16 x_Q10[], /* O Output [ order ] */ opus_int16 x_Q10[], /* O Output [ order ] */
const opus_int8 indices[], /* I Quantization indices [ order ] */ const opus_int8 indices[], /* I Quantization indices [ order ] */
const opus_uint8 pred_coef_Q8[], /* I Backward predictor coefs [ order ] */ const opus_uint8 pred_coef_Q8[], /* I Backward predictor coefs [ order ] */

View file

@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "main.h" #include "main.h"
#include "stack_alloc.h" #include "stack_alloc.h"
static inline void silk_nsq_scale_states( static OPUS_INLINE void silk_nsq_scale_states(
const silk_encoder_state *psEncC, /* I Encoder State */ const silk_encoder_state *psEncC, /* I Encoder State */
silk_nsq_state *NSQ, /* I/O NSQ state */ silk_nsq_state *NSQ, /* I/O NSQ state */
const opus_int32 x_Q3[], /* I input in Q3 */ const opus_int32 x_Q3[], /* I input in Q3 */
@ -46,7 +46,7 @@ static inline void silk_nsq_scale_states(
const opus_int signal_type /* I Signal type */ const opus_int signal_type /* I Signal type */
); );
static inline void silk_noise_shape_quantizer( static OPUS_INLINE void silk_noise_shape_quantizer(
silk_nsq_state *NSQ, /* I/O NSQ state */ silk_nsq_state *NSQ, /* I/O NSQ state */
opus_int signalType, /* I Signal type */ opus_int signalType, /* I Signal type */
const opus_int32 x_sc_Q10[], /* I */ const opus_int32 x_sc_Q10[], /* I */
@ -172,7 +172,7 @@ void silk_NSQ(
/***********************************/ /***********************************/
/* silk_noise_shape_quantizer */ /* silk_noise_shape_quantizer */
/***********************************/ /***********************************/
static inline void silk_noise_shape_quantizer( static OPUS_INLINE void silk_noise_shape_quantizer(
silk_nsq_state *NSQ, /* I/O NSQ state */ silk_nsq_state *NSQ, /* I/O NSQ state */
opus_int signalType, /* I Signal type */ opus_int signalType, /* I Signal type */
const opus_int32 x_sc_Q10[], /* I */ const opus_int32 x_sc_Q10[], /* I */
@ -370,7 +370,7 @@ static inline void silk_noise_shape_quantizer(
silk_memcpy( NSQ->sLPC_Q14, &NSQ->sLPC_Q14[ length ], NSQ_LPC_BUF_LENGTH * sizeof( opus_int32 ) ); silk_memcpy( NSQ->sLPC_Q14, &NSQ->sLPC_Q14[ length ], NSQ_LPC_BUF_LENGTH * sizeof( opus_int32 ) );
} }
static inline void silk_nsq_scale_states( static OPUS_INLINE void silk_nsq_scale_states(
const silk_encoder_state *psEncC, /* I Encoder State */ const silk_encoder_state *psEncC, /* I Encoder State */
silk_nsq_state *NSQ, /* I/O NSQ state */ silk_nsq_state *NSQ, /* I/O NSQ state */
const opus_int32 x_Q3[], /* I input in Q3 */ const opus_int32 x_Q3[], /* I input in Q3 */

View file

@ -57,7 +57,7 @@ typedef struct {
typedef NSQ_sample_struct NSQ_sample_pair[ 2 ]; typedef NSQ_sample_struct NSQ_sample_pair[ 2 ];
static inline void silk_nsq_del_dec_scale_states( static OPUS_INLINE void silk_nsq_del_dec_scale_states(
const silk_encoder_state *psEncC, /* I Encoder State */ const silk_encoder_state *psEncC, /* I Encoder State */
silk_nsq_state *NSQ, /* I/O NSQ state */ silk_nsq_state *NSQ, /* I/O NSQ state */
NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */ NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */
@ -77,7 +77,7 @@ static inline void silk_nsq_del_dec_scale_states(
/******************************************/ /******************************************/
/* Noise shape quantizer for one subframe */ /* Noise shape quantizer for one subframe */
/******************************************/ /******************************************/
static inline void silk_noise_shape_quantizer_del_dec( static OPUS_INLINE void silk_noise_shape_quantizer_del_dec(
silk_nsq_state *NSQ, /* I/O NSQ state */ silk_nsq_state *NSQ, /* I/O NSQ state */
NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */ NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */
opus_int signalType, /* I Signal type */ opus_int signalType, /* I Signal type */
@ -303,7 +303,7 @@ void silk_NSQ_del_dec(
/******************************************/ /******************************************/
/* Noise shape quantizer for one subframe */ /* Noise shape quantizer for one subframe */
/******************************************/ /******************************************/
static inline void silk_noise_shape_quantizer_del_dec( static OPUS_INLINE void silk_noise_shape_quantizer_del_dec(
silk_nsq_state *NSQ, /* I/O NSQ state */ silk_nsq_state *NSQ, /* I/O NSQ state */
NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */ NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */
opus_int signalType, /* I Signal type */ opus_int signalType, /* I Signal type */
@ -630,7 +630,7 @@ static inline void silk_noise_shape_quantizer_del_dec(
RESTORE_STACK; RESTORE_STACK;
} }
static inline void silk_nsq_del_dec_scale_states( static OPUS_INLINE void silk_nsq_del_dec_scale_states(
const silk_encoder_state *psEncC, /* I Encoder State */ const silk_encoder_state *psEncC, /* I Encoder State */
silk_nsq_state *NSQ, /* I/O NSQ state */ silk_nsq_state *NSQ, /* I/O NSQ state */
NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */ NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */

View file

@ -38,12 +38,12 @@ static const opus_int16 HARM_ATT_Q15[NB_ATT] = { 32440, 31130 }; /*
static const opus_int16 PLC_RAND_ATTENUATE_V_Q15[NB_ATT] = { 31130, 26214 }; /* 0.95, 0.8 */ static const opus_int16 PLC_RAND_ATTENUATE_V_Q15[NB_ATT] = { 31130, 26214 }; /* 0.95, 0.8 */
static const opus_int16 PLC_RAND_ATTENUATE_UV_Q15[NB_ATT] = { 32440, 29491 }; /* 0.99, 0.9 */ static const opus_int16 PLC_RAND_ATTENUATE_UV_Q15[NB_ATT] = { 32440, 29491 }; /* 0.99, 0.9 */
static inline void silk_PLC_update( static OPUS_INLINE void silk_PLC_update(
silk_decoder_state *psDec, /* I/O Decoder state */ silk_decoder_state *psDec, /* I/O Decoder state */
silk_decoder_control *psDecCtrl /* I/O Decoder control */ silk_decoder_control *psDecCtrl /* I/O Decoder control */
); );
static inline void silk_PLC_conceal( static OPUS_INLINE void silk_PLC_conceal(
silk_decoder_state *psDec, /* I/O Decoder state */ silk_decoder_state *psDec, /* I/O Decoder state */
silk_decoder_control *psDecCtrl, /* I/O Decoder control */ silk_decoder_control *psDecCtrl, /* I/O Decoder control */
opus_int16 frame[] /* O LPC residual signal */ opus_int16 frame[] /* O LPC residual signal */
@ -92,7 +92,7 @@ void silk_PLC(
/**************************************************/ /**************************************************/
/* Update state of PLC */ /* Update state of PLC */
/**************************************************/ /**************************************************/
static inline void silk_PLC_update( static OPUS_INLINE void silk_PLC_update(
silk_decoder_state *psDec, /* I/O Decoder state */ silk_decoder_state *psDec, /* I/O Decoder state */
silk_decoder_control *psDecCtrl /* I/O Decoder control */ silk_decoder_control *psDecCtrl /* I/O Decoder control */
) )
@ -165,7 +165,7 @@ static inline void silk_PLC_update(
psPLC->nb_subfr = psDec->nb_subfr; psPLC->nb_subfr = psDec->nb_subfr;
} }
static inline void silk_PLC_conceal( static OPUS_INLINE void silk_PLC_conceal(
silk_decoder_state *psDec, /* I/O Decoder state */ silk_decoder_state *psDec, /* I/O Decoder state */
silk_decoder_control *psDecCtrl, /* I/O Decoder control */ silk_decoder_control *psDecCtrl, /* I/O Decoder control */
opus_int16 frame[] /* O LPC residual signal */ opus_int16 frame[] /* O LPC residual signal */

View file

@ -358,8 +358,8 @@ opus_int64 silk_inner_prod16_aligned_64(
/* Rotate a32 right by 'rot' bits. Negative rot values result in rotating /* Rotate a32 right by 'rot' bits. Negative rot values result in rotating
left. Output is 32bit int. left. Output is 32bit int.
Note: contemporary compilers recognize the C expression below and Note: contemporary compilers recognize the C expression below and
compile it into a 'ror' instruction if available. No need for inline ASM! */ compile it into a 'ror' instruction if available. No need for OPUS_INLINE ASM! */
static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot ) static OPUS_INLINE opus_int32 silk_ROR32( opus_int32 a32, opus_int rot )
{ {
opus_uint32 x = (opus_uint32) a32; opus_uint32 x = (opus_uint32) a32;
opus_uint32 r = (opus_uint32) rot; opus_uint32 r = (opus_uint32) rot;
@ -508,37 +508,37 @@ static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot )
#define SILK_FIX_CONST( C, Q ) ((opus_int32)((C) * ((opus_int64)1 << (Q)) + 0.5)) #define SILK_FIX_CONST( C, Q ) ((opus_int32)((C) * ((opus_int64)1 << (Q)) + 0.5))
/* silk_min() versions with typecast in the function call */ /* silk_min() versions with typecast in the function call */
static inline opus_int silk_min_int(opus_int a, opus_int b) static OPUS_INLINE opus_int silk_min_int(opus_int a, opus_int b)
{ {
return (((a) < (b)) ? (a) : (b)); return (((a) < (b)) ? (a) : (b));
} }
static inline opus_int16 silk_min_16(opus_int16 a, opus_int16 b) static OPUS_INLINE opus_int16 silk_min_16(opus_int16 a, opus_int16 b)
{ {
return (((a) < (b)) ? (a) : (b)); return (((a) < (b)) ? (a) : (b));
} }
static inline opus_int32 silk_min_32(opus_int32 a, opus_int32 b) static OPUS_INLINE opus_int32 silk_min_32(opus_int32 a, opus_int32 b)
{ {
return (((a) < (b)) ? (a) : (b)); return (((a) < (b)) ? (a) : (b));
} }
static inline opus_int64 silk_min_64(opus_int64 a, opus_int64 b) static OPUS_INLINE opus_int64 silk_min_64(opus_int64 a, opus_int64 b)
{ {
return (((a) < (b)) ? (a) : (b)); return (((a) < (b)) ? (a) : (b));
} }
/* silk_min() versions with typecast in the function call */ /* silk_min() versions with typecast in the function call */
static inline opus_int silk_max_int(opus_int a, opus_int b) static OPUS_INLINE opus_int silk_max_int(opus_int a, opus_int b)
{ {
return (((a) > (b)) ? (a) : (b)); return (((a) > (b)) ? (a) : (b));
} }
static inline opus_int16 silk_max_16(opus_int16 a, opus_int16 b) static OPUS_INLINE opus_int16 silk_max_16(opus_int16 a, opus_int16 b)
{ {
return (((a) > (b)) ? (a) : (b)); return (((a) > (b)) ? (a) : (b));
} }
static inline opus_int32 silk_max_32(opus_int32 a, opus_int32 b) static OPUS_INLINE opus_int32 silk_max_32(opus_int32 a, opus_int32 b)
{ {
return (((a) > (b)) ? (a) : (b)); return (((a) > (b)) ? (a) : (b));
} }
static inline opus_int64 silk_max_64(opus_int64 a, opus_int64 b) static OPUS_INLINE opus_int64 silk_max_64(opus_int64 a, opus_int64 b)
{ {
return (((a) > (b)) ? (a) : (b)); return (((a) > (b)) ? (a) : (b));
} }

View file

@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "stack_alloc.h" #include "stack_alloc.h"
/* Silk VAD noise level estimation */ /* Silk VAD noise level estimation */
static inline void silk_VAD_GetNoiseLevels( static OPUS_INLINE void silk_VAD_GetNoiseLevels(
const opus_int32 pX[ VAD_N_BANDS ], /* I subband energies */ const opus_int32 pX[ VAD_N_BANDS ], /* I subband energies */
silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk VAD state */ silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk VAD state */
); );
@ -296,7 +296,7 @@ opus_int silk_VAD_GetSA_Q8( /* O Return v
/**************************/ /**************************/
/* Noise level estimation */ /* Noise level estimation */
/**************************/ /**************************/
static inline void silk_VAD_GetNoiseLevels( static OPUS_INLINE void silk_VAD_GetNoiseLevels(
const opus_int32 pX[ VAD_N_BANDS ], /* I subband energies */ const opus_int32 pX[ VAD_N_BANDS ], /* I subband energies */
silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk VAD state */ silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk VAD state */
) )

View file

@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define SILK_SIGPROC_FIX_ARMv4_H #define SILK_SIGPROC_FIX_ARMv4_H
#undef silk_MLA #undef silk_MLA
static inline opus_int32 silk_MLA_armv4(opus_int32 a, opus_int32 b, static OPUS_INLINE opus_int32 silk_MLA_armv4(opus_int32 a, opus_int32 b,
opus_int32 c) opus_int32 c)
{ {
opus_int32 res; opus_int32 res;

View file

@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define SILK_SIGPROC_FIX_ARMv5E_H #define SILK_SIGPROC_FIX_ARMv5E_H
#undef silk_SMULTT #undef silk_SMULTT
static inline opus_int32 silk_SMULTT_armv5e(opus_int32 a, opus_int32 b) static OPUS_INLINE opus_int32 silk_SMULTT_armv5e(opus_int32 a, opus_int32 b)
{ {
opus_int32 res; opus_int32 res;
__asm__( __asm__(
@ -44,7 +44,7 @@ static inline opus_int32 silk_SMULTT_armv5e(opus_int32 a, opus_int32 b)
#define silk_SMULTT(a, b) (silk_SMULTT_armv5e(a, b)) #define silk_SMULTT(a, b) (silk_SMULTT_armv5e(a, b))
#undef silk_SMLATT #undef silk_SMLATT
static inline opus_int32 silk_SMLATT_armv5e(opus_int32 a, opus_int32 b, static OPUS_INLINE opus_int32 silk_SMLATT_armv5e(opus_int32 a, opus_int32 b,
opus_int32 c) opus_int32 c)
{ {
opus_int32 res; opus_int32 res;

View file

@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE.
/* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */ /* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */
#undef silk_SMULWB #undef silk_SMULWB
static inline opus_int32 silk_SMULWB_armv4(opus_int32 a, opus_int16 b) static OPUS_INLINE opus_int32 silk_SMULWB_armv4(opus_int32 a, opus_int16 b)
{ {
unsigned rd_lo; unsigned rd_lo;
int rd_hi; int rd_hi;
@ -50,7 +50,7 @@ static inline opus_int32 silk_SMULWB_armv4(opus_int32 a, opus_int16 b)
/* (a32 * (b32 >> 16)) >> 16 */ /* (a32 * (b32 >> 16)) >> 16 */
#undef silk_SMULWT #undef silk_SMULWT
static inline opus_int32 silk_SMULWT_armv4(opus_int32 a, opus_int32 b) static OPUS_INLINE opus_int32 silk_SMULWT_armv4(opus_int32 a, opus_int32 b)
{ {
unsigned rd_lo; unsigned rd_lo;
int rd_hi; int rd_hi;
@ -70,7 +70,7 @@ static inline opus_int32 silk_SMULWT_armv4(opus_int32 a, opus_int32 b)
/* (a32 * b32) >> 16 */ /* (a32 * b32) >> 16 */
#undef silk_SMULWW #undef silk_SMULWW
static inline opus_int32 silk_SMULWW_armv4(opus_int32 a, opus_int32 b) static OPUS_INLINE opus_int32 silk_SMULWW_armv4(opus_int32 a, opus_int32 b)
{ {
unsigned rd_lo; unsigned rd_lo;
int rd_hi; int rd_hi;
@ -85,7 +85,7 @@ static inline opus_int32 silk_SMULWW_armv4(opus_int32 a, opus_int32 b)
#define silk_SMULWW(a, b) (silk_SMULWW_armv4(a, b)) #define silk_SMULWW(a, b) (silk_SMULWW_armv4(a, b))
#undef silk_SMLAWW #undef silk_SMLAWW
static inline opus_int32 silk_SMLAWW_armv4(opus_int32 a, opus_int32 b, static OPUS_INLINE opus_int32 silk_SMLAWW_armv4(opus_int32 a, opus_int32 b,
opus_int32 c) opus_int32 c)
{ {
unsigned rd_lo; unsigned rd_lo;

View file

@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
/* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */ /* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */
#undef silk_SMULWB #undef silk_SMULWB
static inline opus_int32 silk_SMULWB_armv5e(opus_int32 a, opus_int16 b) static OPUS_INLINE opus_int32 silk_SMULWB_armv5e(opus_int32 a, opus_int16 b)
{ {
int res; int res;
__asm__( __asm__(
@ -46,7 +46,7 @@ static inline opus_int32 silk_SMULWB_armv5e(opus_int32 a, opus_int16 b)
/* a32 + (b32 * (opus_int32)((opus_int16)(c32))) >> 16 output have to be 32bit int */ /* a32 + (b32 * (opus_int32)((opus_int16)(c32))) >> 16 output have to be 32bit int */
#undef silk_SMLAWB #undef silk_SMLAWB
static inline opus_int32 silk_SMLAWB_armv5e(opus_int32 a, opus_int32 b, static OPUS_INLINE opus_int32 silk_SMLAWB_armv5e(opus_int32 a, opus_int32 b,
opus_int16 c) opus_int16 c)
{ {
int res; int res;
@ -62,7 +62,7 @@ static inline opus_int32 silk_SMLAWB_armv5e(opus_int32 a, opus_int32 b,
/* (a32 * (b32 >> 16)) >> 16 */ /* (a32 * (b32 >> 16)) >> 16 */
#undef silk_SMULWT #undef silk_SMULWT
static inline opus_int32 silk_SMULWT_armv5e(opus_int32 a, opus_int32 b) static OPUS_INLINE opus_int32 silk_SMULWT_armv5e(opus_int32 a, opus_int32 b)
{ {
int res; int res;
__asm__( __asm__(
@ -77,7 +77,7 @@ static inline opus_int32 silk_SMULWT_armv5e(opus_int32 a, opus_int32 b)
/* a32 + (b32 * (c32 >> 16)) >> 16 */ /* a32 + (b32 * (c32 >> 16)) >> 16 */
#undef silk_SMLAWT #undef silk_SMLAWT
static inline opus_int32 silk_SMLAWT_armv5e(opus_int32 a, opus_int32 b, static OPUS_INLINE opus_int32 silk_SMLAWT_armv5e(opus_int32 a, opus_int32 b,
opus_int32 c) opus_int32 c)
{ {
int res; int res;
@ -93,7 +93,7 @@ static inline opus_int32 silk_SMLAWT_armv5e(opus_int32 a, opus_int32 b,
/* (opus_int32)((opus_int16)(a3))) * (opus_int32)((opus_int16)(b32)) output have to be 32bit int */ /* (opus_int32)((opus_int16)(a3))) * (opus_int32)((opus_int16)(b32)) output have to be 32bit int */
#undef silk_SMULBB #undef silk_SMULBB
static inline opus_int32 silk_SMULBB_armv5e(opus_int32 a, opus_int32 b) static OPUS_INLINE opus_int32 silk_SMULBB_armv5e(opus_int32 a, opus_int32 b)
{ {
int res; int res;
__asm__( __asm__(
@ -108,7 +108,7 @@ static inline opus_int32 silk_SMULBB_armv5e(opus_int32 a, opus_int32 b)
/* a32 + (opus_int32)((opus_int16)(b32)) * (opus_int32)((opus_int16)(c32)) output have to be 32bit int */ /* a32 + (opus_int32)((opus_int16)(b32)) * (opus_int32)((opus_int16)(c32)) output have to be 32bit int */
#undef silk_SMLABB #undef silk_SMLABB
static inline opus_int32 silk_SMLABB_armv5e(opus_int32 a, opus_int32 b, static OPUS_INLINE opus_int32 silk_SMLABB_armv5e(opus_int32 a, opus_int32 b,
opus_int32 c) opus_int32 c)
{ {
int res; int res;
@ -124,7 +124,7 @@ static inline opus_int32 silk_SMLABB_armv5e(opus_int32 a, opus_int32 b,
/* (opus_int32)((opus_int16)(a32)) * (b32 >> 16) */ /* (opus_int32)((opus_int16)(a32)) * (b32 >> 16) */
#undef silk_SMULBT #undef silk_SMULBT
static inline opus_int32 silk_SMULBT_armv5e(opus_int32 a, opus_int32 b) static OPUS_INLINE opus_int32 silk_SMULBT_armv5e(opus_int32 a, opus_int32 b)
{ {
int res; int res;
__asm__( __asm__(
@ -139,7 +139,7 @@ static inline opus_int32 silk_SMULBT_armv5e(opus_int32 a, opus_int32 b)
/* a32 + (opus_int32)((opus_int16)(b32)) * (c32 >> 16) */ /* a32 + (opus_int32)((opus_int16)(b32)) * (c32 >> 16) */
#undef silk_SMLABT #undef silk_SMLABT
static inline opus_int32 silk_SMLABT_armv5e(opus_int32 a, opus_int32 b, static OPUS_INLINE opus_int32 silk_SMLABT_armv5e(opus_int32 a, opus_int32 b,
opus_int32 c) opus_int32 c)
{ {
int res; int res;
@ -155,7 +155,7 @@ static inline opus_int32 silk_SMLABT_armv5e(opus_int32 a, opus_int32 b,
/* add/subtract with output saturated */ /* add/subtract with output saturated */
#undef silk_ADD_SAT32 #undef silk_ADD_SAT32
static inline opus_int32 silk_ADD_SAT32_armv5e(opus_int32 a, opus_int32 b) static OPUS_INLINE opus_int32 silk_ADD_SAT32_armv5e(opus_int32 a, opus_int32 b)
{ {
int res; int res;
__asm__( __asm__(
@ -169,7 +169,7 @@ static inline opus_int32 silk_ADD_SAT32_armv5e(opus_int32 a, opus_int32 b)
#define silk_ADD_SAT32(a, b) (silk_ADD_SAT32_armv5e(a, b)) #define silk_ADD_SAT32(a, b) (silk_ADD_SAT32_armv5e(a, b))
#undef silk_SUB_SAT32 #undef silk_SUB_SAT32
static inline opus_int32 silk_SUB_SAT32_armv5e(opus_int32 a, opus_int32 b) static OPUS_INLINE opus_int32 silk_SUB_SAT32_armv5e(opus_int32 a, opus_int32 b)
{ {
int res; int res;
__asm__( __asm__(
@ -183,7 +183,7 @@ static inline opus_int32 silk_SUB_SAT32_armv5e(opus_int32 a, opus_int32 b)
#define silk_SUB_SAT32(a, b) (silk_SUB_SAT32_armv5e(a, b)) #define silk_SUB_SAT32(a, b) (silk_SUB_SAT32_armv5e(a, b))
#undef silk_CLZ16 #undef silk_CLZ16
static inline opus_int32 silk_CLZ16_armv5(opus_int16 in16) static OPUS_INLINE opus_int32 silk_CLZ16_armv5(opus_int16 in16)
{ {
int res; int res;
__asm__( __asm__(
@ -197,7 +197,7 @@ static inline opus_int32 silk_CLZ16_armv5(opus_int16 in16)
#define silk_CLZ16(in16) (silk_CLZ16_armv5(in16)) #define silk_CLZ16(in16) (silk_CLZ16_armv5(in16))
#undef silk_CLZ32 #undef silk_CLZ32
static inline opus_int32 silk_CLZ32_armv5(opus_int32 in32) static OPUS_INLINE opus_int32 silk_CLZ32_armv5(opus_int32 in32)
{ {
int res; int res;
__asm__( __asm__(

View file

@ -55,7 +55,7 @@ static opus_int silk_setup_complexity(
opus_int Complexity /* I */ opus_int Complexity /* I */
); );
static inline opus_int silk_setup_LBRR( static OPUS_INLINE opus_int silk_setup_LBRR(
silk_encoder_state *psEncC, /* I/O */ silk_encoder_state *psEncC, /* I/O */
const opus_int32 TargetRate_bps /* I */ const opus_int32 TargetRate_bps /* I */
); );
@ -392,7 +392,7 @@ static opus_int silk_setup_complexity(
return ret; return ret;
} }
static inline opus_int silk_setup_LBRR( static OPUS_INLINE opus_int silk_setup_LBRR(
silk_encoder_state *psEncC, /* I/O */ silk_encoder_state *psEncC, /* I/O */
const opus_int32 TargetRate_bps /* I */ const opus_int32 TargetRate_bps /* I */
) )

View file

@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
/* Encode quantization indices of excitation */ /* Encode quantization indices of excitation */
/*********************************************/ /*********************************************/
static inline opus_int combine_and_check( /* return ok */ static OPUS_INLINE opus_int combine_and_check( /* return ok */
opus_int *pulses_comb, /* O */ opus_int *pulses_comb, /* O */
const opus_int *pulses_in, /* I */ const opus_int *pulses_in, /* I */
opus_int max_pulses, /* I max value for sum of pulses */ opus_int max_pulses, /* I max value for sum of pulses */

View file

@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "tuning_parameters.h" #include "tuning_parameters.h"
/* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate */ /* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate */
static inline void silk_LBRR_encode_FIX( static OPUS_INLINE void silk_LBRR_encode_FIX(
silk_encoder_state_FIX *psEnc, /* I/O Pointer to Silk FIX encoder state */ silk_encoder_state_FIX *psEnc, /* I/O Pointer to Silk FIX encoder state */
silk_encoder_control_FIX *psEncCtrl, /* I/O Pointer to Silk FIX encoder control struct */ silk_encoder_control_FIX *psEncCtrl, /* I/O Pointer to Silk FIX encoder control struct */
const opus_int32 xfw_Q3[], /* I Input signal */ const opus_int32 xfw_Q3[], /* I Input signal */
@ -326,7 +326,7 @@ opus_int silk_encode_frame_FIX(
} }
/* Low-Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode excitation at lower bitrate */ /* Low-Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode excitation at lower bitrate */
static inline void silk_LBRR_encode_FIX( static OPUS_INLINE void silk_LBRR_encode_FIX(
silk_encoder_state_FIX *psEnc, /* I/O Pointer to Silk FIX encoder state */ silk_encoder_state_FIX *psEnc, /* I/O Pointer to Silk FIX encoder state */
silk_encoder_control_FIX *psEncCtrl, /* I/O Pointer to Silk FIX encoder control struct */ silk_encoder_control_FIX *psEncCtrl, /* I/O Pointer to Silk FIX encoder control struct */
const opus_int32 xfw_Q3[], /* I Input signal */ const opus_int32 xfw_Q3[], /* I Input signal */

View file

@ -37,7 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
/* non-warped frequency scale. (So that it can be implemented with a minimum-phase monic filter.) */ /* non-warped frequency scale. (So that it can be implemented with a minimum-phase monic filter.) */
/* Note: A monic filter is one with the first coefficient equal to 1.0. In Silk we omit the first */ /* Note: A monic filter is one with the first coefficient equal to 1.0. In Silk we omit the first */
/* coefficient in an array of coefficients, for monic filters. */ /* coefficient in an array of coefficients, for monic filters. */
static inline opus_int32 warped_gain( /* gain in Q16*/ static OPUS_INLINE opus_int32 warped_gain( /* gain in Q16*/
const opus_int32 *coefs_Q24, const opus_int32 *coefs_Q24,
opus_int lambda_Q16, opus_int lambda_Q16,
opus_int order opus_int order
@ -56,7 +56,7 @@ static inline opus_int32 warped_gain( /* gain in Q16*/
/* Convert warped filter coefficients to monic pseudo-warped coefficients and limit maximum */ /* Convert warped filter coefficients to monic pseudo-warped coefficients and limit maximum */
/* amplitude of monic warped coefficients by using bandwidth expansion on the true coefficients */ /* amplitude of monic warped coefficients by using bandwidth expansion on the true coefficients */
static inline void limit_warped_coefs( static OPUS_INLINE void limit_warped_coefs(
opus_int32 *coefs_syn_Q24, opus_int32 *coefs_syn_Q24,
opus_int32 *coefs_ana_Q24, opus_int32 *coefs_ana_Q24,
opus_int lambda_Q16, opus_int lambda_Q16,

View file

@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "tuning_parameters.h" #include "tuning_parameters.h"
/* Prefilter for finding Quantizer input signal */ /* Prefilter for finding Quantizer input signal */
static inline void silk_prefilt_FIX( static OPUS_INLINE void silk_prefilt_FIX(
silk_prefilter_state_FIX *P, /* I/O state */ silk_prefilter_state_FIX *P, /* I/O state */
opus_int32 st_res_Q12[], /* I short term residual signal */ opus_int32 st_res_Q12[], /* I short term residual signal */
opus_int32 xw_Q3[], /* O prefiltered signal */ opus_int32 xw_Q3[], /* O prefiltered signal */
@ -156,7 +156,7 @@ void silk_prefilter_FIX(
} }
/* Prefilter for finding Quantizer input signal */ /* Prefilter for finding Quantizer input signal */
static inline void silk_prefilt_FIX( static OPUS_INLINE void silk_prefilt_FIX(
silk_prefilter_state_FIX *P, /* I/O state */ silk_prefilter_state_FIX *P, /* I/O state */
opus_int32 st_res_Q12[], /* I short term residual signal */ opus_int32 st_res_Q12[], /* I short term residual signal */
opus_int32 xw_Q3[], /* O prefiltered signal */ opus_int32 xw_Q3[], /* O prefiltered signal */

View file

@ -43,7 +43,7 @@ typedef struct {
} inv_D_t; } inv_D_t;
/* Factorize square matrix A into LDL form */ /* Factorize square matrix A into LDL form */
static inline void silk_LDL_factorize_FIX( static OPUS_INLINE void silk_LDL_factorize_FIX(
opus_int32 *A, /* I/O Pointer to Symetric Square Matrix */ opus_int32 *A, /* I/O Pointer to Symetric Square Matrix */
opus_int M, /* I Size of Matrix */ opus_int M, /* I Size of Matrix */
opus_int32 *L_Q16, /* I/O Pointer to Square Upper triangular Matrix */ opus_int32 *L_Q16, /* I/O Pointer to Square Upper triangular Matrix */
@ -51,7 +51,7 @@ static inline void silk_LDL_factorize_FIX(
); );
/* Solve Lx = b, when L is lower triangular and has ones on the diagonal */ /* Solve Lx = b, when L is lower triangular and has ones on the diagonal */
static inline void silk_LS_SolveFirst_FIX( static OPUS_INLINE void silk_LS_SolveFirst_FIX(
const opus_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */ const opus_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */
opus_int M, /* I Dim of Matrix equation */ opus_int M, /* I Dim of Matrix equation */
const opus_int32 *b, /* I b Vector */ const opus_int32 *b, /* I b Vector */
@ -59,14 +59,14 @@ static inline void silk_LS_SolveFirst_FIX(
); );
/* Solve L^t*x = b, where L is lower triangular with ones on the diagonal */ /* Solve L^t*x = b, where L is lower triangular with ones on the diagonal */
static inline void silk_LS_SolveLast_FIX( static OPUS_INLINE void silk_LS_SolveLast_FIX(
const opus_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */ const opus_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */
const opus_int M, /* I Dim of Matrix equation */ const opus_int M, /* I Dim of Matrix equation */
const opus_int32 *b, /* I b Vector */ const opus_int32 *b, /* I b Vector */
opus_int32 *x_Q16 /* O x Vector */ opus_int32 *x_Q16 /* O x Vector */
); );
static inline void silk_LS_divide_Q16_FIX( static OPUS_INLINE void silk_LS_divide_Q16_FIX(
opus_int32 T[], /* I/O Numenator vector */ opus_int32 T[], /* I/O Numenator vector */
inv_D_t *inv_D, /* I 1 / D vector */ inv_D_t *inv_D, /* I 1 / D vector */
opus_int M /* I dimension */ opus_int M /* I dimension */
@ -113,7 +113,7 @@ void silk_solve_LDL_FIX(
RESTORE_STACK; RESTORE_STACK;
} }
static inline void silk_LDL_factorize_FIX( static OPUS_INLINE void silk_LDL_factorize_FIX(
opus_int32 *A, /* I/O Pointer to Symetric Square Matrix */ opus_int32 *A, /* I/O Pointer to Symetric Square Matrix */
opus_int M, /* I Size of Matrix */ opus_int M, /* I Size of Matrix */
opus_int32 *L_Q16, /* I/O Pointer to Square Upper triangular Matrix */ opus_int32 *L_Q16, /* I/O Pointer to Square Upper triangular Matrix */
@ -185,7 +185,7 @@ static inline void silk_LDL_factorize_FIX(
silk_assert( status == 0 ); silk_assert( status == 0 );
} }
static inline void silk_LS_divide_Q16_FIX( static OPUS_INLINE void silk_LS_divide_Q16_FIX(
opus_int32 T[], /* I/O Numenator vector */ opus_int32 T[], /* I/O Numenator vector */
inv_D_t *inv_D, /* I 1 / D vector */ inv_D_t *inv_D, /* I 1 / D vector */
opus_int M /* I dimension */ opus_int M /* I dimension */
@ -205,7 +205,7 @@ static inline void silk_LS_divide_Q16_FIX(
} }
/* Solve Lx = b, when L is lower triangular and has ones on the diagonal */ /* Solve Lx = b, when L is lower triangular and has ones on the diagonal */
static inline void silk_LS_SolveFirst_FIX( static OPUS_INLINE void silk_LS_SolveFirst_FIX(
const opus_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */ const opus_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */
opus_int M, /* I Dim of Matrix equation */ opus_int M, /* I Dim of Matrix equation */
const opus_int32 *b, /* I b Vector */ const opus_int32 *b, /* I b Vector */
@ -227,7 +227,7 @@ static inline void silk_LS_SolveFirst_FIX(
} }
/* Solve L^t*x = b, where L is lower triangular with ones on the diagonal */ /* Solve L^t*x = b, where L is lower triangular with ones on the diagonal */
static inline void silk_LS_SolveLast_FIX( static OPUS_INLINE void silk_LS_SolveLast_FIX(
const opus_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */ const opus_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */
const opus_int M, /* I Dim of Matrix equation */ const opus_int M, /* I Dim of Matrix equation */
const opus_int32 *b, /* I b Vector */ const opus_int32 *b, /* I b Vector */

View file

@ -40,7 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
/************************************************/ /************************************************/
/* 16th order LPC analysis filter, does not write first 16 samples */ /* 16th order LPC analysis filter, does not write first 16 samples */
static inline void silk_LPC_analysis_filter16_FLP( static OPUS_INLINE void silk_LPC_analysis_filter16_FLP(
silk_float r_LPC[], /* O LPC residual signal */ silk_float r_LPC[], /* O LPC residual signal */
const silk_float PredCoef[], /* I LPC coefficients */ const silk_float PredCoef[], /* I LPC coefficients */
const silk_float s[], /* I Input signal */ const silk_float s[], /* I Input signal */
@ -78,7 +78,7 @@ static inline void silk_LPC_analysis_filter16_FLP(
} }
/* 12th order LPC analysis filter, does not write first 12 samples */ /* 12th order LPC analysis filter, does not write first 12 samples */
static inline void silk_LPC_analysis_filter12_FLP( static OPUS_INLINE void silk_LPC_analysis_filter12_FLP(
silk_float r_LPC[], /* O LPC residual signal */ silk_float r_LPC[], /* O LPC residual signal */
const silk_float PredCoef[], /* I LPC coefficients */ const silk_float PredCoef[], /* I LPC coefficients */
const silk_float s[], /* I Input signal */ const silk_float s[], /* I Input signal */
@ -112,7 +112,7 @@ static inline void silk_LPC_analysis_filter12_FLP(
} }
/* 10th order LPC analysis filter, does not write first 10 samples */ /* 10th order LPC analysis filter, does not write first 10 samples */
static inline void silk_LPC_analysis_filter10_FLP( static OPUS_INLINE void silk_LPC_analysis_filter10_FLP(
silk_float r_LPC[], /* O LPC residual signal */ silk_float r_LPC[], /* O LPC residual signal */
const silk_float PredCoef[], /* I LPC coefficients */ const silk_float PredCoef[], /* I LPC coefficients */
const silk_float s[], /* I Input signal */ const silk_float s[], /* I Input signal */
@ -144,7 +144,7 @@ static inline void silk_LPC_analysis_filter10_FLP(
} }
/* 8th order LPC analysis filter, does not write first 8 samples */ /* 8th order LPC analysis filter, does not write first 8 samples */
static inline void silk_LPC_analysis_filter8_FLP( static OPUS_INLINE void silk_LPC_analysis_filter8_FLP(
silk_float r_LPC[], /* O LPC residual signal */ silk_float r_LPC[], /* O LPC residual signal */
const silk_float PredCoef[], /* I LPC coefficients */ const silk_float PredCoef[], /* I LPC coefficients */
const silk_float s[], /* I Input signal */ const silk_float s[], /* I Input signal */
@ -174,7 +174,7 @@ static inline void silk_LPC_analysis_filter8_FLP(
} }
/* 6th order LPC analysis filter, does not write first 6 samples */ /* 6th order LPC analysis filter, does not write first 6 samples */
static inline void silk_LPC_analysis_filter6_FLP( static OPUS_INLINE void silk_LPC_analysis_filter6_FLP(
silk_float r_LPC[], /* O LPC residual signal */ silk_float r_LPC[], /* O LPC residual signal */
const silk_float PredCoef[], /* I LPC coefficients */ const silk_float PredCoef[], /* I LPC coefficients */
const silk_float s[], /* I Input signal */ const silk_float s[], /* I Input signal */

View file

@ -153,19 +153,19 @@ double silk_energy_FLP(
#define silk_abs_float( a ) ((silk_float)fabs(a)) #define silk_abs_float( a ) ((silk_float)fabs(a))
/* sigmoid function */ /* sigmoid function */
static inline silk_float silk_sigmoid( silk_float x ) static OPUS_INLINE silk_float silk_sigmoid( silk_float x )
{ {
return (silk_float)(1.0 / (1.0 + exp(-x))); return (silk_float)(1.0 / (1.0 + exp(-x)));
} }
/* floating-point to integer conversion (rounding) */ /* floating-point to integer conversion (rounding) */
static inline opus_int32 silk_float2int( silk_float x ) static OPUS_INLINE opus_int32 silk_float2int( silk_float x )
{ {
return (opus_int32)float2int( x ); return (opus_int32)float2int( x );
} }
/* floating-point to integer conversion (rounding) */ /* floating-point to integer conversion (rounding) */
static inline void silk_float2short_array( static OPUS_INLINE void silk_float2short_array(
opus_int16 *out, opus_int16 *out,
const silk_float *in, const silk_float *in,
opus_int32 length opus_int32 length
@ -178,7 +178,7 @@ static inline void silk_float2short_array(
} }
/* integer to floating-point conversion */ /* integer to floating-point conversion */
static inline void silk_short2float_array( static OPUS_INLINE void silk_short2float_array(
silk_float *out, silk_float *out,
const opus_int16 *in, const opus_int16 *in,
opus_int32 length opus_int32 length
@ -191,7 +191,7 @@ static inline void silk_short2float_array(
} }
/* using log2() helps the fixed-point conversion */ /* using log2() helps the fixed-point conversion */
static inline silk_float silk_log2( double x ) static OPUS_INLINE silk_float silk_log2( double x )
{ {
return ( silk_float )( 3.32192809488736 * log10( x ) ); return ( silk_float )( 3.32192809488736 * log10( x ) );
} }

View file

@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "tuning_parameters.h" #include "tuning_parameters.h"
/* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate */ /* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate */
static inline void silk_LBRR_encode_FLP( static OPUS_INLINE void silk_LBRR_encode_FLP(
silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */
silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */ silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */
const silk_float xfw[], /* I Input signal */ const silk_float xfw[], /* I Input signal */
@ -316,7 +316,7 @@ opus_int silk_encode_frame_FLP(
} }
/* Low-Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode excitation at lower bitrate */ /* Low-Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode excitation at lower bitrate */
static inline void silk_LBRR_encode_FLP( static OPUS_INLINE void silk_LBRR_encode_FLP(
silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */
silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */ silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */
const silk_float xfw[], /* I Input signal */ const silk_float xfw[], /* I Input signal */

View file

@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
/* non-warped frequency scale. (So that it can be implemented with a minimum-phase monic filter.) */ /* non-warped frequency scale. (So that it can be implemented with a minimum-phase monic filter.) */
/* Note: A monic filter is one with the first coefficient equal to 1.0. In Silk we omit the first */ /* Note: A monic filter is one with the first coefficient equal to 1.0. In Silk we omit the first */
/* coefficient in an array of coefficients, for monic filters. */ /* coefficient in an array of coefficients, for monic filters. */
static inline silk_float warped_gain( static OPUS_INLINE silk_float warped_gain(
const silk_float *coefs, const silk_float *coefs,
silk_float lambda, silk_float lambda,
opus_int order opus_int order
@ -54,7 +54,7 @@ static inline silk_float warped_gain(
/* Convert warped filter coefficients to monic pseudo-warped coefficients and limit maximum */ /* Convert warped filter coefficients to monic pseudo-warped coefficients and limit maximum */
/* amplitude of monic warped coefficients by using bandwidth expansion on the true coefficients */ /* amplitude of monic warped coefficients by using bandwidth expansion on the true coefficients */
static inline void warped_true2monic_coefs( static OPUS_INLINE void warped_true2monic_coefs(
silk_float *coefs_syn, silk_float *coefs_syn,
silk_float *coefs_ana, silk_float *coefs_ana,
silk_float lambda, silk_float lambda,

View file

@ -35,7 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
/* /*
* Prefilter for finding Quantizer input signal * Prefilter for finding Quantizer input signal
*/ */
static inline void silk_prefilt_FLP( static OPUS_INLINE void silk_prefilt_FLP(
silk_prefilter_state_FLP *P, /* I/O state */ silk_prefilter_state_FLP *P, /* I/O state */
silk_float st_res[], /* I */ silk_float st_res[], /* I */
silk_float xw[], /* O */ silk_float xw[], /* O */
@ -153,7 +153,7 @@ void silk_prefilter_FLP(
/* /*
* Prefilter for finding Quantizer input signal * Prefilter for finding Quantizer input signal
*/ */
static inline void silk_prefilt_FLP( static OPUS_INLINE void silk_prefilt_FLP(
silk_prefilter_state_FLP *P, /* I/O state */ silk_prefilter_state_FLP *P, /* I/O state */
silk_float st_res[], /* I */ silk_float st_res[], /* I */
silk_float xw[], /* O */ silk_float xw[], /* O */

View file

@ -37,7 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
* Matrix D (only the diagonal elements returned in a vector)such that * Matrix D (only the diagonal elements returned in a vector)such that
* the symmetric matric A is given by A = L*D*L'. * the symmetric matric A is given by A = L*D*L'.
**********************************************************************/ **********************************************************************/
static inline void silk_LDL_FLP( static OPUS_INLINE void silk_LDL_FLP(
silk_float *A, /* I/O Pointer to Symetric Square Matrix */ silk_float *A, /* I/O Pointer to Symetric Square Matrix */
opus_int M, /* I Size of Matrix */ opus_int M, /* I Size of Matrix */
silk_float *L, /* I/O Pointer to Square Upper triangular Matrix */ silk_float *L, /* I/O Pointer to Square Upper triangular Matrix */
@ -48,7 +48,7 @@ static inline void silk_LDL_FLP(
* Function to solve linear equation Ax = b, when A is a MxM lower * Function to solve linear equation Ax = b, when A is a MxM lower
* triangular matrix, with ones on the diagonal. * triangular matrix, with ones on the diagonal.
**********************************************************************/ **********************************************************************/
static inline void silk_SolveWithLowerTriangularWdiagOnes_FLP( static OPUS_INLINE void silk_SolveWithLowerTriangularWdiagOnes_FLP(
const silk_float *L, /* I Pointer to Lower Triangular Matrix */ const silk_float *L, /* I Pointer to Lower Triangular Matrix */
opus_int M, /* I Dim of Matrix equation */ opus_int M, /* I Dim of Matrix equation */
const silk_float *b, /* I b Vector */ const silk_float *b, /* I b Vector */
@ -59,7 +59,7 @@ static inline void silk_SolveWithLowerTriangularWdiagOnes_FLP(
* Function to solve linear equation (A^T)x = b, when A is a MxM lower * Function to solve linear equation (A^T)x = b, when A is a MxM lower
* triangular, with ones on the diagonal. (ie then A^T is upper triangular) * triangular, with ones on the diagonal. (ie then A^T is upper triangular)
**********************************************************************/ **********************************************************************/
static inline void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP( static OPUS_INLINE void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP(
const silk_float *L, /* I Pointer to Lower Triangular Matrix */ const silk_float *L, /* I Pointer to Lower Triangular Matrix */
opus_int M, /* I Dim of Matrix equation */ opus_int M, /* I Dim of Matrix equation */
const silk_float *b, /* I b Vector */ const silk_float *b, /* I b Vector */
@ -109,7 +109,7 @@ void silk_solve_LDL_FLP(
silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP( &L[ 0 ][ 0 ], M, T, x ); silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP( &L[ 0 ][ 0 ], M, T, x );
} }
static inline void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP( static OPUS_INLINE void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP(
const silk_float *L, /* I Pointer to Lower Triangular Matrix */ const silk_float *L, /* I Pointer to Lower Triangular Matrix */
opus_int M, /* I Dim of Matrix equation */ opus_int M, /* I Dim of Matrix equation */
const silk_float *b, /* I b Vector */ const silk_float *b, /* I b Vector */
@ -131,7 +131,7 @@ static inline void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP(
} }
} }
static inline void silk_SolveWithLowerTriangularWdiagOnes_FLP( static OPUS_INLINE void silk_SolveWithLowerTriangularWdiagOnes_FLP(
const silk_float *L, /* I Pointer to Lower Triangular Matrix */ const silk_float *L, /* I Pointer to Lower Triangular Matrix */
opus_int M, /* I Dim of Matrix equation */ opus_int M, /* I Dim of Matrix equation */
const silk_float *b, /* I b Vector */ const silk_float *b, /* I b Vector */
@ -153,7 +153,7 @@ static inline void silk_SolveWithLowerTriangularWdiagOnes_FLP(
} }
} }
static inline void silk_LDL_FLP( static OPUS_INLINE void silk_LDL_FLP(
silk_float *A, /* I/O Pointer to Symetric Square Matrix */ silk_float *A, /* I/O Pointer to Symetric Square Matrix */
opus_int M, /* I Size of Matrix */ opus_int M, /* I Size of Matrix */
silk_float *L, /* I/O Pointer to Square Upper triangular Matrix */ silk_float *L, /* I/O Pointer to Square Upper triangular Matrix */

View file

@ -32,7 +32,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include "config.h" #include "config.h"
#endif #endif
/* This is an inline header file for general platform. */ #include "opus_types.h"
#include "opus_defines.h"
/* This is an OPUS_INLINE header file for general platform. */
/* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */ /* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */
#define silk_SMULWB(a32, b32) ((((a32) >> 16) * (opus_int32)((opus_int16)(b32))) + ((((a32) & 0x0000FFFF) * (opus_int32)((opus_int16)(b32))) >> 16)) #define silk_SMULWB(a32, b32) ((((a32) >> 16) * (opus_int32)((opus_int16)(b32))) + ((((a32) & 0x0000FFFF) * (opus_int32)((opus_int16)(b32))) >> 16))
@ -78,12 +81,12 @@ POSSIBILITY OF SUCH DAMAGE.
#include "ecintrin.h" #include "ecintrin.h"
static inline opus_int32 silk_CLZ16(opus_int16 in16) static OPUS_INLINE opus_int32 silk_CLZ16(opus_int16 in16)
{ {
return 32 - EC_ILOG(in16<<16|0x8000); return 32 - EC_ILOG(in16<<16|0x8000);
} }
static inline opus_int32 silk_CLZ32(opus_int32 in32) static OPUS_INLINE opus_int32 silk_CLZ32(opus_int32 in32)
{ {
return in32 ? 32 - EC_ILOG(in32) : 32; return in32 ? 32 - EC_ILOG(in32) : 32;
} }

View file

@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "resampler_private.h" #include "resampler_private.h"
#include "stack_alloc.h" #include "stack_alloc.h"
static inline opus_int16 *silk_resampler_private_IIR_FIR_INTERPOL( static OPUS_INLINE opus_int16 *silk_resampler_private_IIR_FIR_INTERPOL(
opus_int16 *out, opus_int16 *out,
opus_int16 *buf, opus_int16 *buf,
opus_int32 max_index_Q16, opus_int32 max_index_Q16,

View file

@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "resampler_private.h" #include "resampler_private.h"
#include "stack_alloc.h" #include "stack_alloc.h"
static inline opus_int16 *silk_resampler_private_down_FIR_INTERPOL( static OPUS_INLINE opus_int16 *silk_resampler_private_down_FIR_INTERPOL(
opus_int16 *out, opus_int16 *out,
opus_int32 *buf, opus_int32 *buf,
const opus_int16 *FIR_Coefs, const opus_int16 *FIR_Coefs,

View file

@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
/* shell coder; pulse-subframe length is hardcoded */ /* shell coder; pulse-subframe length is hardcoded */
static inline void combine_pulses( static OPUS_INLINE void combine_pulses(
opus_int *out, /* O combined pulses vector [len] */ opus_int *out, /* O combined pulses vector [len] */
const opus_int *in, /* I input vector [2 * len] */ const opus_int *in, /* I input vector [2 * len] */
const opus_int len /* I number of OUTPUT samples */ const opus_int len /* I number of OUTPUT samples */
@ -45,7 +45,7 @@ static inline void combine_pulses(
} }
} }
static inline void encode_split( static OPUS_INLINE void encode_split(
ec_enc *psRangeEnc, /* I/O compressor data structure */ ec_enc *psRangeEnc, /* I/O compressor data structure */
const opus_int p_child1, /* I pulse amplitude of first child subframe */ const opus_int p_child1, /* I pulse amplitude of first child subframe */
const opus_int p, /* I pulse amplitude of current subframe */ const opus_int p, /* I pulse amplitude of current subframe */
@ -57,7 +57,7 @@ static inline void encode_split(
} }
} }
static inline void decode_split( static OPUS_INLINE void decode_split(
opus_int *p_child1, /* O pulse amplitude of first child subframe */ opus_int *p_child1, /* O pulse amplitude of first child subframe */
opus_int *p_child2, /* O pulse amplitude of second child subframe */ opus_int *p_child2, /* O pulse amplitude of second child subframe */
ec_dec *psRangeDec, /* I/O Compressor data structure */ ec_dec *psRangeDec, /* I/O Compressor data structure */

View file

@ -29,6 +29,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define SILK_TYPEDEF_H #define SILK_TYPEDEF_H
#include "opus_types.h" #include "opus_types.h"
#include "opus_defines.h"
#ifndef FIXED_POINT #ifndef FIXED_POINT
# include <float.h> # include <float.h>
@ -63,7 +64,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifdef __GNUC__ #ifdef __GNUC__
__attribute__((noreturn)) __attribute__((noreturn))
#endif #endif
static inline void _silk_fatal(const char *str, const char *file, int line) static OPUS_INLINE void _silk_fatal(const char *str, const char *file, int line)
{ {
fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str); fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str);
abort(); abort();

View file

@ -115,7 +115,7 @@ static const int extra_bands[NB_TOT_BANDS+1] = {
#define cB 0.67848403f #define cB 0.67848403f
#define cC 0.08595542f #define cC 0.08595542f
#define cE ((float)M_PI/2) #define cE ((float)M_PI/2)
static inline float fast_atan2f(float y, float x) { static OPUS_INLINE float fast_atan2f(float y, float x) {
float x2, y2; float x2, y2;
/* Should avoid underflow on the values we'll get */ /* Should avoid underflow on the values we'll get */
if (ABS16(x)+ABS16(y)<1e-9f) if (ABS16(x)+ABS16(y)<1e-9f)

View file

@ -29,6 +29,9 @@
#include "config.h" #include "config.h"
#endif #endif
#include "opus_types.h"
#include "opus_defines.h"
#include <math.h> #include <math.h>
#include "mlp.h" #include "mlp.h"
#include "arch.h" #include "arch.h"
@ -36,7 +39,7 @@
#define MAX_NEURONS 100 #define MAX_NEURONS 100
#if 0 #if 0
static inline opus_val16 tansig_approx(opus_val32 _x) /* Q19 */ static OPUS_INLINE opus_val16 tansig_approx(opus_val32 _x) /* Q19 */
{ {
int i; int i;
opus_val16 xx; /* Q11 */ opus_val16 xx; /* Q11 */
@ -62,7 +65,7 @@ static inline opus_val16 tansig_approx(opus_val32 _x) /* Q19 */
} }
#else #else
/*extern const float tansig_table[501];*/ /*extern const float tansig_table[501];*/
static inline float tansig_approx(float x) static OPUS_INLINE float tansig_approx(float x)
{ {
int i; int i;
float y, dy; float y, dy;

View file

@ -75,7 +75,7 @@ struct OpusDecoder {
}; };
#ifdef FIXED_POINT #ifdef FIXED_POINT
static inline opus_int16 SAT16(opus_int32 x) { static OPUS_INLINE opus_int16 SAT16(opus_int32 x) {
return x > 32767 ? 32767 : x < -32768 ? -32768 : (opus_int16)x; return x > 32767 ? 32767 : x < -32768 ? -32768 : (opus_int16)x;
} }
#endif #endif

View file

@ -107,7 +107,7 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data, opus_int32 le
opus_int32 *packet_offset, int soft_clip); opus_int32 *packet_offset, int soft_clip);
/* Make sure everything's aligned to sizeof(void *) bytes */ /* Make sure everything's aligned to sizeof(void *) bytes */
static inline int align(int i) static OPUS_INLINE int align(int i)
{ {
return (i+(int)sizeof(void *)-1)&-(int)sizeof(void *); return (i+(int)sizeof(void *)-1)&-(int)sizeof(void *);
} }

View file

@ -25,7 +25,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
static inline void deb2_impl(unsigned char *_t,unsigned char **_p,int _k,int _x,int _y) static OPUS_INLINE void deb2_impl(unsigned char *_t,unsigned char **_p,int _k,int _x,int _y)
{ {
int i; int i;
if(_x>2){ if(_x>2){
@ -41,7 +41,7 @@ static inline void deb2_impl(unsigned char *_t,unsigned char **_p,int _k,int _x,
} }
/*Generates a De Bruijn sequence (k,2) with length k^2*/ /*Generates a De Bruijn sequence (k,2) with length k^2*/
static inline void debruijn2(int _k, unsigned char *_res) static OPUS_INLINE void debruijn2(int _k, unsigned char *_res)
{ {
unsigned char *p; unsigned char *p;
unsigned char *t; unsigned char *t;
@ -54,7 +54,7 @@ static inline void debruijn2(int _k, unsigned char *_res)
/*MWC RNG of George Marsaglia*/ /*MWC RNG of George Marsaglia*/
static opus_uint32 Rz, Rw; static opus_uint32 Rz, Rw;
static inline opus_uint32 fast_rand(void) static OPUS_INLINE opus_uint32 fast_rand(void)
{ {
Rz=36969*(Rz&65535)+(Rz>>16); Rz=36969*(Rz&65535)+(Rz>>16);
Rw=18000*(Rw&65535)+(Rw>>16); Rw=18000*(Rw&65535)+(Rw>>16);
@ -65,7 +65,7 @@ static opus_uint32 iseed;
#ifdef __GNUC__ #ifdef __GNUC__
__attribute__((noreturn)) __attribute__((noreturn))
#endif #endif
static inline void _test_failed(const char *file, int line) static OPUS_INLINE void _test_failed(const char *file, int line)
{ {
fprintf(stderr,"\n ***************************************************\n"); fprintf(stderr,"\n ***************************************************\n");
fprintf(stderr," *** A fatal error was detected. ***\n"); fprintf(stderr," *** A fatal error was detected. ***\n");

View file

@ -93,7 +93,7 @@ static void int_to_char(opus_uint32 i, unsigned char ch[4])
ch[3] = i&0xFF; ch[3] = i&0xFF;
} }
static inline void save_packet(unsigned char* p, int len, opus_uint32 rng) static OPUS_INLINE void save_packet(unsigned char* p, int len, opus_uint32 rng)
{ {
FILE *fout; FILE *fout;
unsigned char int_field[4]; unsigned char int_field[4];

View file

@ -28,8 +28,6 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef CONFIG_H #ifndef CONFIG_H
#define CONFIG_H #define CONFIG_H
#define inline __inline
#define USE_ALLOCA 1 #define USE_ALLOCA 1
/* Comment out the next line for floating-point code */ /* Comment out the next line for floating-point code */