forked from len0rd/rockbox
Sync libopus to upstream release 1.1
Change-Id: I9fea7460fc33f60faff961b3389dd97b5191463c
This commit is contained in:
parent
d0918b98fa
commit
e3c2ed7a71
97 changed files with 977 additions and 578 deletions
|
@ -63,6 +63,7 @@ silk/tables_pitch_lag.c
|
||||||
silk/tables_pulses_per_block.c
|
silk/tables_pulses_per_block.c
|
||||||
|
|
||||||
/* OPUS sources */
|
/* OPUS sources */
|
||||||
|
opus.c
|
||||||
opus_decoder.c
|
opus_decoder.c
|
||||||
opus_header.c
|
opus_header.c
|
||||||
|
|
||||||
|
|
|
@ -94,15 +94,15 @@
|
||||||
do {(res).r = ADD32((res).r,(a).r); (res).i = SUB32((res).i,(a).i); \
|
do {(res).r = ADD32((res).r,(a).r); (res).i = SUB32((res).i,(a).i); \
|
||||||
}while(0)
|
}while(0)
|
||||||
|
|
||||||
#if defined(ARMv4_ASM)
|
#if defined(OPUS_ARM_INLINE_ASM)
|
||||||
#include "arm/kiss_fft_armv4.h"
|
#include "arm/kiss_fft_armv4.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ARMv5E_ASM)
|
#if defined(OPUS_ARM_INLINE_EDSP)
|
||||||
#include "arm/kiss_fft_armv5e.h"
|
#include "arm/kiss_fft_armv5e.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CF_ASM)
|
#if defined(OPUS_CF_INLINE_ASM)
|
||||||
#include "cf/kiss_fft_cf.h"
|
#include "cf/kiss_fft_cf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
@ -113,9 +114,9 @@ typedef opus_val32 celt_ener;
|
||||||
|
|
||||||
#include "fixed_generic.h"
|
#include "fixed_generic.h"
|
||||||
|
|
||||||
#ifdef ARMv5E_ASM
|
#ifdef OPUS_ARM_INLINE_EDSP
|
||||||
#include "arm/fixed_armv5e.h"
|
#include "arm/fixed_armv5e.h"
|
||||||
#elif defined (ARMv4_ASM)
|
#elif defined (OPUS_ARM_INLINE_ASM)
|
||||||
#include "arm/fixed_armv4.h"
|
#include "arm/fixed_armv4.h"
|
||||||
#elif defined (BFIN_ASM)
|
#elif defined (BFIN_ASM)
|
||||||
#include "fixed_bfin.h"
|
#include "fixed_bfin.h"
|
||||||
|
@ -123,7 +124,7 @@ typedef opus_val32 celt_ener;
|
||||||
#include "fixed_c5x.h"
|
#include "fixed_c5x.h"
|
||||||
#elif defined (TI_C6X_ASM)
|
#elif defined (TI_C6X_ASM)
|
||||||
#include "fixed_c6x.h"
|
#include "fixed_c6x.h"
|
||||||
#elif defined (CF_ASM)
|
#elif defined (OPUS_CF_INLINE_ASM)
|
||||||
#include "cf/fixed_cf.h"
|
#include "cf/fixed_cf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -187,6 +188,7 @@ typedef float celt_ener;
|
||||||
#define MAC16_32_Q15(c,a,b) ((c)+(a)*(b))
|
#define MAC16_32_Q15(c,a,b) ((c)+(a)*(b))
|
||||||
|
|
||||||
#define MULT16_16_Q11_32(a,b) ((a)*(b))
|
#define MULT16_16_Q11_32(a,b) ((a)*(b))
|
||||||
|
#define MULT16_16_Q11(a,b) ((a)*(b))
|
||||||
#define MULT16_16_Q13(a,b) ((a)*(b))
|
#define MULT16_16_Q13(a,b) ((a)*(b))
|
||||||
#define MULT16_16_Q14(a,b) ((a)*(b))
|
#define MULT16_16_Q14(a,b) ((a)*(b))
|
||||||
#define MULT16_16_Q15(a,b) ((a)*(b))
|
#define MULT16_16_Q15(a,b) ((a)*(b))
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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__(
|
||||||
|
|
|
@ -216,7 +216,9 @@ void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X,
|
||||||
j=M*eBands[i];
|
j=M*eBands[i];
|
||||||
band_end = M*eBands[i+1];
|
band_end = M*eBands[i+1];
|
||||||
lg = ADD16(bandLogE[i+c*m->nbEBands], SHL16((opus_val16)eMeans[i],6));
|
lg = ADD16(bandLogE[i+c*m->nbEBands], SHL16((opus_val16)eMeans[i],6));
|
||||||
#ifdef FIXED_POINT
|
#ifndef FIXED_POINT
|
||||||
|
g = celt_exp2(lg);
|
||||||
|
#else
|
||||||
/* Handle the integer part of the log energy */
|
/* Handle the integer part of the log energy */
|
||||||
shift = 16-(lg>>DB_SHIFT);
|
shift = 16-(lg>>DB_SHIFT);
|
||||||
if (shift>31)
|
if (shift>31)
|
||||||
|
@ -227,9 +229,23 @@ void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X,
|
||||||
/* Handle the fractional part. */
|
/* Handle the fractional part. */
|
||||||
g = celt_exp2_frac(lg&((1<<DB_SHIFT)-1));
|
g = celt_exp2_frac(lg&((1<<DB_SHIFT)-1));
|
||||||
}
|
}
|
||||||
#else
|
/* Handle extreme gains with negative shift. */
|
||||||
g = celt_exp2(lg);
|
if (shift<0)
|
||||||
|
{
|
||||||
|
/* For shift < -2 we'd be likely to overflow, so we're capping
|
||||||
|
the gain here. This shouldn't happen unless the bitstream is
|
||||||
|
already corrupted. */
|
||||||
|
if (shift < -2)
|
||||||
|
{
|
||||||
|
g = 32767;
|
||||||
|
shift = -2;
|
||||||
|
}
|
||||||
|
do {
|
||||||
|
*f++ = SHL32(MULT16_16(*x++, g), -shift);
|
||||||
|
} while (++j<band_end);
|
||||||
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
/* Be careful of the fixed-point "else" just above when changing this code */
|
||||||
do {
|
do {
|
||||||
*f++ = SHR32(MULT16_16(*x++, g), shift);
|
*f++ = SHR32(MULT16_16(*x++, g), shift);
|
||||||
} while (++j<band_end);
|
} while (++j<band_end);
|
||||||
|
@ -495,7 +511,7 @@ int spreading_decision(const CELTMode *m, celt_norm *X, int *average,
|
||||||
*tapset_decision=0;
|
*tapset_decision=0;
|
||||||
}
|
}
|
||||||
/*printf("%d %d %d\n", hf_sum, *hf_average, *tapset_decision);*/
|
/*printf("%d %d %d\n", hf_sum, *hf_average, *tapset_decision);*/
|
||||||
celt_assert(nbBands>0); /*M*(eBands[end]-eBands[end-1]) <= 8 assures this*/
|
celt_assert(nbBands>0); /* end has to be non-zero */
|
||||||
sum /= nbBands;
|
sum /= nbBands;
|
||||||
/* Recursive averaging */
|
/* Recursive averaging */
|
||||||
sum = (sum+*average)>>1;
|
sum = (sum+*average)>>1;
|
||||||
|
@ -873,7 +889,6 @@ static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X,
|
||||||
int q;
|
int q;
|
||||||
int curr_bits;
|
int curr_bits;
|
||||||
int imid=0, iside=0;
|
int imid=0, iside=0;
|
||||||
int N_B=N;
|
|
||||||
int B0=B;
|
int B0=B;
|
||||||
opus_val16 mid=0, side=0;
|
opus_val16 mid=0, side=0;
|
||||||
unsigned cm=0;
|
unsigned cm=0;
|
||||||
|
@ -895,8 +910,6 @@ static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X,
|
||||||
spread = ctx->spread;
|
spread = ctx->spread;
|
||||||
ec = ctx->ec;
|
ec = ctx->ec;
|
||||||
|
|
||||||
N_B /= B;
|
|
||||||
|
|
||||||
/* If we need 1.5 more bit than we can produce, split the band in two. */
|
/* If we need 1.5 more bit than we can produce, split the band in two. */
|
||||||
cache = m->cache.bits + m->cache.index[(LM+1)*m->nbEBands+i];
|
cache = m->cache.bits + m->cache.index[(LM+1)*m->nbEBands+i];
|
||||||
if (LM != -1 && b > cache[cache[0]]+12 && N>2)
|
if (LM != -1 && b > cache[cache[0]]+12 && N>2)
|
||||||
|
@ -1076,7 +1089,6 @@ static unsigned quant_band(struct band_ctx *ctx, celt_norm *X,
|
||||||
longBlocks = B0==1;
|
longBlocks = B0==1;
|
||||||
|
|
||||||
N_B /= B;
|
N_B /= B;
|
||||||
N_B0 = N_B;
|
|
||||||
|
|
||||||
/* Special case for one sample */
|
/* Special case for one sample */
|
||||||
if (N==1)
|
if (N==1)
|
||||||
|
|
|
@ -52,11 +52,11 @@ extern "C" {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int valid;
|
int valid;
|
||||||
opus_val16 tonality;
|
float tonality;
|
||||||
opus_val16 tonality_slope;
|
float tonality_slope;
|
||||||
opus_val16 noisiness;
|
float noisiness;
|
||||||
opus_val16 activity;
|
float activity;
|
||||||
opus_val16 music_prob;
|
float music_prob;
|
||||||
int bandwidth;
|
int bandwidth;
|
||||||
}AnalysisInfo;
|
}AnalysisInfo;
|
||||||
|
|
||||||
|
@ -66,6 +66,10 @@ typedef struct {
|
||||||
|
|
||||||
/* Encoder/decoder Requests */
|
/* Encoder/decoder Requests */
|
||||||
|
|
||||||
|
/* Expose this option again when variable framesize actually works */
|
||||||
|
#define OPUS_FRAMESIZE_VARIABLE 5010 /**< Optimize the frame size dynamically */
|
||||||
|
|
||||||
|
|
||||||
#define CELT_SET_PREDICTION_REQUEST 10002
|
#define CELT_SET_PREDICTION_REQUEST 10002
|
||||||
/** Controls the use of interframe prediction.
|
/** Controls the use of interframe prediction.
|
||||||
0=Independent frames
|
0=Independent frames
|
||||||
|
@ -109,10 +113,7 @@ typedef struct {
|
||||||
#define OPUS_SET_LFE_REQUEST 10024
|
#define OPUS_SET_LFE_REQUEST 10024
|
||||||
#define OPUS_SET_LFE(x) OPUS_SET_LFE_REQUEST, __opus_check_int(x)
|
#define OPUS_SET_LFE(x) OPUS_SET_LFE_REQUEST, __opus_check_int(x)
|
||||||
|
|
||||||
#define OPUS_SET_ENERGY_SAVE_REQUEST 10026
|
#define OPUS_SET_ENERGY_MASK_REQUEST 10026
|
||||||
#define OPUS_SET_ENERGY_SAVE(x) OPUS_SET_ENERGY_SAVE_REQUEST, __opus_check_val16_ptr(x)
|
|
||||||
|
|
||||||
#define OPUS_SET_ENERGY_MASK_REQUEST 10028
|
|
||||||
#define OPUS_SET_ENERGY_MASK(x) OPUS_SET_ENERGY_MASK_REQUEST, __opus_check_val16_ptr(x)
|
#define OPUS_SET_ENERGY_MASK(x) OPUS_SET_ENERGY_MASK_REQUEST, __opus_check_val16_ptr(x)
|
||||||
|
|
||||||
/* Encoder stuff */
|
/* Encoder stuff */
|
||||||
|
@ -121,7 +122,8 @@ int celt_encoder_get_size(int channels);
|
||||||
|
|
||||||
int celt_encode_with_ec(OpusCustomEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc);
|
int celt_encode_with_ec(OpusCustomEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc);
|
||||||
|
|
||||||
int celt_encoder_init(CELTEncoder *st, opus_int32 sampling_rate, int channels);
|
int celt_encoder_init(CELTEncoder *st, opus_int32 sampling_rate, int channels,
|
||||||
|
int arch);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,7 +143,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};
|
||||||
|
@ -166,7 +168,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)
|
||||||
|
@ -177,7 +179,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;
|
||||||
|
@ -193,6 +195,9 @@ extern const signed char tf_select_table[4][8];
|
||||||
|
|
||||||
int resampling_factor(opus_int32 rate);
|
int resampling_factor(opus_int32 rate);
|
||||||
|
|
||||||
|
void celt_preemphasis(const opus_val16 * OPUS_RESTRICT pcmp, celt_sig * OPUS_RESTRICT inp,
|
||||||
|
int N, int CC, int upsample, const opus_val16 *coef, celt_sig *mem, int clip);
|
||||||
|
|
||||||
void comb_filter(opus_val32 *y, opus_val32 *x, int T0, int T1, int N,
|
void comb_filter(opus_val32 *y, opus_val32 *x, int T0, int T1, int N,
|
||||||
opus_val16 g0, opus_val16 g1, int tapset0, int tapset1,
|
opus_val16 g0, opus_val16 g1, int tapset0, int tapset1,
|
||||||
const opus_val16 *window, int overlap);
|
const opus_val16 *window, int overlap);
|
||||||
|
|
|
@ -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);
|
||||||
|
@ -213,7 +213,7 @@ void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, c
|
||||||
opus_val16 coef3 = coef[3];
|
opus_val16 coef3 = coef[3];
|
||||||
for (j=0;j<N;j++)
|
for (j=0;j<N;j++)
|
||||||
{
|
{
|
||||||
celt_sig tmp = x[j] + m;
|
celt_sig tmp = x[j] + m + VERY_SMALL;
|
||||||
m = MULT16_32_Q15(coef0, tmp)
|
m = MULT16_32_Q15(coef0, tmp)
|
||||||
- MULT16_32_Q15(coef1, x[j]);
|
- MULT16_32_Q15(coef1, x[j]);
|
||||||
tmp = SHL32(MULT16_32_Q15(coef3, tmp), 2);
|
tmp = SHL32(MULT16_32_Q15(coef3, tmp), 2);
|
||||||
|
@ -227,7 +227,7 @@ void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, c
|
||||||
/* Shortcut for the standard (non-custom modes) case */
|
/* Shortcut for the standard (non-custom modes) case */
|
||||||
for (j=0;j<N;j++)
|
for (j=0;j<N;j++)
|
||||||
{
|
{
|
||||||
celt_sig tmp = x[j] + m;
|
celt_sig tmp = x[j] + m + VERY_SMALL;
|
||||||
m = MULT16_32_Q15(coef0, tmp);
|
m = MULT16_32_Q15(coef0, tmp);
|
||||||
scratch[j] = tmp;
|
scratch[j] = tmp;
|
||||||
}
|
}
|
||||||
|
@ -447,10 +447,11 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, opus_val16 * OPUS_R
|
||||||
{
|
{
|
||||||
VARDECL( opus_val16, lp_pitch_buf );
|
VARDECL( opus_val16, lp_pitch_buf );
|
||||||
ALLOC( lp_pitch_buf, DECODE_BUFFER_SIZE>>1, opus_val16 );
|
ALLOC( lp_pitch_buf, DECODE_BUFFER_SIZE>>1, opus_val16 );
|
||||||
pitch_downsample(decode_mem, lp_pitch_buf, DECODE_BUFFER_SIZE, C);
|
pitch_downsample(decode_mem, lp_pitch_buf,
|
||||||
|
DECODE_BUFFER_SIZE, C, st->arch);
|
||||||
pitch_search(lp_pitch_buf+(PLC_PITCH_LAG_MAX>>1), lp_pitch_buf,
|
pitch_search(lp_pitch_buf+(PLC_PITCH_LAG_MAX>>1), lp_pitch_buf,
|
||||||
DECODE_BUFFER_SIZE-PLC_PITCH_LAG_MAX,
|
DECODE_BUFFER_SIZE-PLC_PITCH_LAG_MAX,
|
||||||
PLC_PITCH_LAG_MAX-PLC_PITCH_LAG_MIN, &pitch_index);
|
PLC_PITCH_LAG_MAX-PLC_PITCH_LAG_MIN, &pitch_index, st->arch);
|
||||||
pitch_index = PLC_PITCH_LAG_MAX-pitch_index;
|
pitch_index = PLC_PITCH_LAG_MAX-pitch_index;
|
||||||
st->last_pitch_index = pitch_index;
|
st->last_pitch_index = pitch_index;
|
||||||
} else {
|
} else {
|
||||||
|
@ -481,7 +482,8 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, opus_val16 * OPUS_R
|
||||||
opus_val32 ac[LPC_ORDER+1];
|
opus_val32 ac[LPC_ORDER+1];
|
||||||
/* Compute LPC coefficients for the last MAX_PERIOD samples before
|
/* Compute LPC coefficients for the last MAX_PERIOD samples before
|
||||||
the first loss so we can work in the excitation-filter domain. */
|
the first loss so we can work in the excitation-filter domain. */
|
||||||
_celt_autocorr(exc, ac, window, overlap, LPC_ORDER, MAX_PERIOD);
|
_celt_autocorr(exc, ac, window, overlap,
|
||||||
|
LPC_ORDER, MAX_PERIOD, st->arch);
|
||||||
/* Add a noise floor of -40 dB. */
|
/* Add a noise floor of -40 dB. */
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
ac[0] += SHR32(ac[0],13);
|
ac[0] += SHR32(ac[0],13);
|
||||||
|
@ -668,7 +670,6 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat
|
||||||
VARDECL(int, fine_priority);
|
VARDECL(int, fine_priority);
|
||||||
VARDECL(int, tf_res);
|
VARDECL(int, tf_res);
|
||||||
VARDECL(unsigned char, collapse_masks);
|
VARDECL(unsigned char, collapse_masks);
|
||||||
celt_sig *out_mem[2] = {NULL, NULL};
|
|
||||||
celt_sig *decode_mem[2];
|
celt_sig *decode_mem[2];
|
||||||
celt_sig *out_syn[2];
|
celt_sig *out_syn[2];
|
||||||
opus_val16 *lpc;
|
opus_val16 *lpc;
|
||||||
|
@ -709,7 +710,6 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat
|
||||||
|
|
||||||
c=0; do {
|
c=0; do {
|
||||||
decode_mem[c] = st->_decode_mem + c*(DECODE_BUFFER_SIZE+overlap);
|
decode_mem[c] = st->_decode_mem + c*(DECODE_BUFFER_SIZE+overlap);
|
||||||
out_mem[c] = decode_mem[c]+DECODE_BUFFER_SIZE-MAX_PERIOD;
|
|
||||||
} while (++c<CC);
|
} while (++c<CC);
|
||||||
lpc = (opus_val16*)(st->_decode_mem+(DECODE_BUFFER_SIZE+overlap)*CC);
|
lpc = (opus_val16*)(st->_decode_mem+(DECODE_BUFFER_SIZE+overlap)*CC);
|
||||||
oldBandE = lpc+CC*LPC_ORDER;
|
oldBandE = lpc+CC*LPC_ORDER;
|
||||||
|
@ -934,7 +934,6 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat
|
||||||
/* Synthesis */
|
/* Synthesis */
|
||||||
denormalise_bands(mode, X, freq, oldBandE, st->start, effEnd, C, M);
|
denormalise_bands(mode, X, freq, oldBandE, st->start, effEnd, C, M);
|
||||||
}
|
}
|
||||||
|
|
||||||
c=0; do {
|
c=0; do {
|
||||||
OPUS_MOVE(decode_mem[c], decode_mem[c]+N, DECODE_BUFFER_SIZE-N+overlap/2);
|
OPUS_MOVE(decode_mem[c], decode_mem[c]+N, DECODE_BUFFER_SIZE-N+overlap/2);
|
||||||
} while (++c<CC);
|
} while (++c<CC);
|
||||||
|
@ -948,7 +947,7 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat
|
||||||
} while (++c<C);
|
} while (++c<C);
|
||||||
|
|
||||||
c=0; do {
|
c=0; do {
|
||||||
out_syn[c] = out_mem[c]+MAX_PERIOD-N;
|
out_syn[c] = decode_mem[c]+DECODE_BUFFER_SIZE-N;
|
||||||
} while (++c<CC);
|
} while (++c<CC);
|
||||||
|
|
||||||
if (CC==2&&C==1)
|
if (CC==2&&C==1)
|
||||||
|
|
|
@ -226,7 +226,8 @@ int _celt_autocorr(
|
||||||
const opus_val16 *window,
|
const opus_val16 *window,
|
||||||
int overlap,
|
int overlap,
|
||||||
int lag,
|
int lag,
|
||||||
int n
|
int n,
|
||||||
|
int arch
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
opus_val32 d;
|
opus_val32 d;
|
||||||
|
@ -275,7 +276,7 @@ int _celt_autocorr(
|
||||||
shift = 0;
|
shift = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
celt_pitch_xcorr(xptr, xptr, ac, fastN, lag+1);
|
celt_pitch_xcorr(xptr, xptr, ac, fastN, lag+1, arch);
|
||||||
for (k=0;k<=lag;k++)
|
for (k=0;k<=lag;k++)
|
||||||
{
|
{
|
||||||
for (i = k+fastN, d = 0; i < n; i++)
|
for (i = k+fastN, d = 0; i < n; i++)
|
||||||
|
|
|
@ -48,6 +48,7 @@ void celt_iir(const opus_val32 *x,
|
||||||
int ord,
|
int ord,
|
||||||
opus_val16 *mem);
|
opus_val16 *mem);
|
||||||
|
|
||||||
int _celt_autocorr(const opus_val16 *x, opus_val32 *ac, const opus_val16 *window, int overlap, int lag, int n);
|
int _celt_autocorr(const opus_val16 *x, opus_val32 *ac,
|
||||||
|
const opus_val16 *window, int overlap, int lag, int n, int arch);
|
||||||
|
|
||||||
#endif /* PLC_H */
|
#endif /* PLC_H */
|
||||||
|
|
|
@ -28,7 +28,10 @@
|
||||||
#ifndef CPU_SUPPORT_H
|
#ifndef CPU_SUPPORT_H
|
||||||
#define CPU_SUPPORT_H
|
#define CPU_SUPPORT_H
|
||||||
|
|
||||||
#if defined(OPUS_HAVE_RTCD) && defined(ARMv4_ASM)
|
#include "opus_types.h"
|
||||||
|
#include "opus_defines.h"
|
||||||
|
|
||||||
|
#if defined(OPUS_HAVE_RTCD) && defined(OPUS_ARM_ASM)
|
||||||
#include "arm/armcpu.h"
|
#include "arm/armcpu.h"
|
||||||
|
|
||||||
/* We currently support 4 ARM variants:
|
/* We currently support 4 ARM variants:
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,7 +410,7 @@ static const opus_uint32 CELT_PVQ_U_DATA[1272] ICONST_ATTR ={
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(CUSTOM_MODES)
|
#if defined(CUSTOM_MODES)
|
||||||
const opus_uint32 *const CELT_PVQ_U_ROW[15]={
|
static const opus_uint32 *const CELT_PVQ_U_ROW[15]={
|
||||||
CELT_PVQ_U_DATA+ 0,CELT_PVQ_U_DATA+ 208,CELT_PVQ_U_DATA+ 415,
|
CELT_PVQ_U_DATA+ 0,CELT_PVQ_U_DATA+ 208,CELT_PVQ_U_DATA+ 415,
|
||||||
CELT_PVQ_U_DATA+ 621,CELT_PVQ_U_DATA+ 826,CELT_PVQ_U_DATA+1030,
|
CELT_PVQ_U_DATA+ 621,CELT_PVQ_U_DATA+ 826,CELT_PVQ_U_DATA+1030,
|
||||||
CELT_PVQ_U_DATA+1233,CELT_PVQ_U_DATA+1336,CELT_PVQ_U_DATA+1389,
|
CELT_PVQ_U_DATA+1233,CELT_PVQ_U_DATA+1336,CELT_PVQ_U_DATA+1389,
|
||||||
|
@ -418,7 +418,7 @@ const opus_uint32 *const CELT_PVQ_U_ROW[15]={
|
||||||
CELT_PVQ_U_DATA+1464,CELT_PVQ_U_DATA+1470,CELT_PVQ_U_DATA+1473
|
CELT_PVQ_U_DATA+1464,CELT_PVQ_U_DATA+1470,CELT_PVQ_U_DATA+1473
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
const opus_uint32 *const CELT_PVQ_U_ROW[15]={
|
static const opus_uint32 *const CELT_PVQ_U_ROW[15]={
|
||||||
CELT_PVQ_U_DATA+ 0,CELT_PVQ_U_DATA+ 176,CELT_PVQ_U_DATA+ 351,
|
CELT_PVQ_U_DATA+ 0,CELT_PVQ_U_DATA+ 176,CELT_PVQ_U_DATA+ 351,
|
||||||
CELT_PVQ_U_DATA+ 525,CELT_PVQ_U_DATA+ 698,CELT_PVQ_U_DATA+ 870,
|
CELT_PVQ_U_DATA+ 525,CELT_PVQ_U_DATA+ 698,CELT_PVQ_U_DATA+ 870,
|
||||||
CELT_PVQ_U_DATA+1041,CELT_PVQ_U_DATA+1131,CELT_PVQ_U_DATA+1178,
|
CELT_PVQ_U_DATA+1041,CELT_PVQ_U_DATA+1131,CELT_PVQ_U_DATA+1178,
|
||||||
|
@ -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;
|
||||||
|
|
|
@ -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.*/
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#define MULT16_32_Q16(a,b) ADD32(MULT16_16((a),SHR((b),16)), SHR(MULT16_16SU((a),((b)&0x0000ffff)),16))
|
#define MULT16_32_Q16(a,b) ADD32(MULT16_16((a),SHR((b),16)), SHR(MULT16_16SU((a),((b)&0x0000ffff)),16))
|
||||||
|
|
||||||
/** 16x32 multiplication, followed by a 16-bit shift right (round-to-nearest). Results fits in 32 bits */
|
/** 16x32 multiplication, followed by a 16-bit shift right (round-to-nearest). Results fits in 32 bits */
|
||||||
#define MULT16_32_P16(a,b) ADD32(MULT16_16((a),SHR((b),16)), PSHR(MULT16_16((a),((b)&0x0000ffff)),16))
|
#define MULT16_32_P16(a,b) ADD32(MULT16_16((a),SHR((b),16)), PSHR(MULT16_16SU((a),((b)&0x0000ffff)),16))
|
||||||
|
|
||||||
/** 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 */
|
||||||
#define MULT16_32_Q15(a,b) ADD32(SHL(MULT16_16((a),SHR((b),16)),1), SHR(MULT16_16SU((a),((b)&0x0000ffff)),15))
|
#define MULT16_32_Q15(a,b) ADD32(SHL(MULT16_16((a),SHR((b),16)),1), SHR(MULT16_16SU((a),((b)&0x0000ffff)),15))
|
||||||
|
@ -116,6 +116,7 @@
|
||||||
#define MAC16_32_Q15(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15)))
|
#define MAC16_32_Q15(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15)))
|
||||||
|
|
||||||
#define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11))
|
#define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11))
|
||||||
|
#define MULT16_16_Q11(a,b) (SHR(MULT16_16((a),(b)),11))
|
||||||
#define MULT16_16_Q13(a,b) (SHR(MULT16_16((a),(b)),13))
|
#define MULT16_16_Q13(a,b) (SHR(MULT16_16((a),(b)),13))
|
||||||
#define MULT16_16_Q14(a,b) (SHR(MULT16_16((a),(b)),14))
|
#define MULT16_16_Q14(a,b) (SHR(MULT16_16((a),(b)),14))
|
||||||
#define MULT16_16_Q15(a,b) (SHR(MULT16_16((a),(b)),15))
|
#define MULT16_16_Q15(a,b) (SHR(MULT16_16((a),(b)),15))
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,8 @@ opus_val32 celt_sqrt(opus_val32 x);
|
||||||
|
|
||||||
opus_val16 celt_cos_norm(opus_val32 x);
|
opus_val16 celt_cos_norm(opus_val32 x);
|
||||||
|
|
||||||
static inline opus_val16 celt_log2(opus_val32 x)
|
/** Base-2 logarithm approximation (log2(x)). (Q14 input, Q10 output) */
|
||||||
|
static OPUS_INLINE opus_val16 celt_log2(opus_val32 x)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
opus_val16 n, frac;
|
opus_val16 n, frac;
|
||||||
|
@ -191,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;
|
||||||
|
@ -224,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)))))));
|
||||||
}
|
}
|
||||||
|
@ -235,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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ static void celt_fir5(const opus_val16 *x,
|
||||||
|
|
||||||
|
|
||||||
void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x_lp,
|
void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x_lp,
|
||||||
int len, int C)
|
int len, int C, int arch)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
opus_val32 ac[5];
|
opus_val32 ac[5];
|
||||||
|
@ -180,7 +180,7 @@ void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x
|
||||||
}
|
}
|
||||||
|
|
||||||
_celt_autocorr(x_lp, ac, NULL, 0,
|
_celt_autocorr(x_lp, ac, NULL, 0,
|
||||||
4, len>>1);
|
4, len>>1, arch);
|
||||||
|
|
||||||
/* Noise floor -40 dB */
|
/* Noise floor -40 dB */
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
|
@ -250,9 +250,14 @@ opus_val32
|
||||||
#else
|
#else
|
||||||
void
|
void
|
||||||
#endif
|
#endif
|
||||||
celt_pitch_xcorr(const opus_val16 *_x, const opus_val16 *_y, opus_val32 *xcorr, int len, int max_pitch)
|
celt_pitch_xcorr_c(const opus_val16 *_x, const opus_val16 *_y, opus_val32 *xcorr, int len, int max_pitch)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
|
/*The EDSP version requires that max_pitch is at least 1, and that _x is
|
||||||
|
32-bit aligned.
|
||||||
|
Since it's hard to put asserts in assembly, put them here.*/
|
||||||
|
celt_assert(max_pitch>0);
|
||||||
|
celt_assert((((unsigned char *)_x-(unsigned char *)NULL)&3)==0);
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
opus_val32 maxcorr=1;
|
opus_val32 maxcorr=1;
|
||||||
#endif
|
#endif
|
||||||
|
@ -289,7 +294,7 @@ celt_pitch_xcorr(const opus_val16 *_x, const opus_val16 *_y, opus_val32 *xcorr,
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTRICT y,
|
void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTRICT y,
|
||||||
int len, int max_pitch, int *pitch)
|
int len, int max_pitch, int *pitch, int arch)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int lag;
|
int lag;
|
||||||
|
@ -342,7 +347,7 @@ void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTR
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
maxcorr =
|
maxcorr =
|
||||||
#endif
|
#endif
|
||||||
celt_pitch_xcorr(x_lp4, y_lp4, xcorr, len>>2, max_pitch>>2);
|
celt_pitch_xcorr(x_lp4, y_lp4, xcorr, len>>2, max_pitch>>2, arch);
|
||||||
|
|
||||||
find_best_pitch(xcorr, y_lp4, len>>2, max_pitch>>2, best_pitch
|
find_best_pitch(xcorr, y_lp4, len>>2, max_pitch>>2, best_pitch
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
|
|
|
@ -35,16 +35,21 @@
|
||||||
#define PITCH_H
|
#define PITCH_H
|
||||||
|
|
||||||
#include "modes.h"
|
#include "modes.h"
|
||||||
|
#include "cpu_support.h"
|
||||||
|
|
||||||
#if defined(__SSE__) && !defined(FIXED_POINT)
|
#if defined(__SSE__) && !defined(FIXED_POINT)
|
||||||
#include "x86/pitch_sse.h"
|
#include "x86/pitch_sse.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(OPUS_ARM_ASM) && defined(FIXED_POINT)
|
||||||
|
# include "arm/pitch_arm.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x_lp,
|
void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x_lp,
|
||||||
int len, int C);
|
int len, int C, int arch);
|
||||||
|
|
||||||
void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTRICT y,
|
void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTRICT y,
|
||||||
int len, int max_pitch, int *pitch);
|
int len, int max_pitch, int *pitch, int arch);
|
||||||
|
|
||||||
opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod,
|
opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod,
|
||||||
int N, int *T0, int prev_period, opus_val16 prev_gain);
|
int N, int *T0, int prev_period, opus_val16 prev_gain);
|
||||||
|
@ -52,10 +57,11 @@ 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;
|
||||||
|
celt_assert(len>=3);
|
||||||
y_3=0; /* gcc doesn't realize that y_3 can't be used uninitialized */
|
y_3=0; /* gcc doesn't realize that y_3 can't be used uninitialized */
|
||||||
y_0=*y++;
|
y_0=*y++;
|
||||||
y_1=*y++;
|
y_1=*y++;
|
||||||
|
@ -119,7 +125,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;
|
||||||
|
@ -140,6 +146,28 @@ opus_val32
|
||||||
#else
|
#else
|
||||||
void
|
void
|
||||||
#endif
|
#endif
|
||||||
celt_pitch_xcorr(const opus_val16 *_x, const opus_val16 *_y, opus_val32 *xcorr, int len, int max_pitch);
|
celt_pitch_xcorr_c(const opus_val16 *_x, const opus_val16 *_y,
|
||||||
|
opus_val32 *xcorr, int len, int max_pitch);
|
||||||
|
|
||||||
|
#if !defined(OVERRIDE_PITCH_XCORR)
|
||||||
|
/*Is run-time CPU detection enabled on this platform?*/
|
||||||
|
# if defined(OPUS_HAVE_RTCD)
|
||||||
|
extern
|
||||||
|
# if defined(FIXED_POINT)
|
||||||
|
opus_val32
|
||||||
|
# else
|
||||||
|
void
|
||||||
|
# endif
|
||||||
|
(*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
|
||||||
|
const opus_val16 *, opus_val32 *, int, int);
|
||||||
|
|
||||||
|
# define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
|
||||||
|
((*CELT_PITCH_XCORR_IMPL[(arch)&OPUS_ARCHMASK])(_x, _y, \
|
||||||
|
xcorr, len, max_pitch))
|
||||||
|
# else
|
||||||
|
# define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
|
||||||
|
((void)(arch),celt_pitch_xcorr_c(_x, _y, xcorr, len, max_pitch))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -312,6 +312,7 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
|
||||||
opus_int32 tell_intra;
|
opus_int32 tell_intra;
|
||||||
opus_uint32 nstart_bytes;
|
opus_uint32 nstart_bytes;
|
||||||
opus_uint32 nintra_bytes;
|
opus_uint32 nintra_bytes;
|
||||||
|
opus_uint32 save_bytes;
|
||||||
int badness2;
|
int badness2;
|
||||||
VARDECL(unsigned char, intra_bits);
|
VARDECL(unsigned char, intra_bits);
|
||||||
|
|
||||||
|
@ -322,7 +323,10 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
|
||||||
nstart_bytes = ec_range_bytes(&enc_start_state);
|
nstart_bytes = ec_range_bytes(&enc_start_state);
|
||||||
nintra_bytes = ec_range_bytes(&enc_intra_state);
|
nintra_bytes = ec_range_bytes(&enc_intra_state);
|
||||||
intra_buf = ec_get_buffer(&enc_intra_state) + nstart_bytes;
|
intra_buf = ec_get_buffer(&enc_intra_state) + nstart_bytes;
|
||||||
ALLOC(intra_bits, nintra_bytes-nstart_bytes, unsigned char);
|
save_bytes = nintra_bytes-nstart_bytes;
|
||||||
|
if (save_bytes == 0)
|
||||||
|
save_bytes = ALLOC_NONE;
|
||||||
|
ALLOC(intra_bits, save_bytes, unsigned char);
|
||||||
/* Copy bits from intra bit-stream */
|
/* Copy bits from intra bit-stream */
|
||||||
OPUS_COPY(intra_bits, intra_buf, nintra_bytes - nstart_bytes);
|
OPUS_COPY(intra_bits, intra_buf, nintra_bytes - nstart_bytes);
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
@ -92,6 +95,8 @@
|
||||||
#define SAVE_STACK
|
#define SAVE_STACK
|
||||||
#define RESTORE_STACK
|
#define RESTORE_STACK
|
||||||
#define ALLOC_STACK
|
#define ALLOC_STACK
|
||||||
|
/* C99 does not allow VLAs of size zero */
|
||||||
|
#define ALLOC_NONE 1
|
||||||
|
|
||||||
#elif defined(USE_ALLOCA)
|
#elif defined(USE_ALLOCA)
|
||||||
|
|
||||||
|
@ -106,6 +111,7 @@
|
||||||
#define SAVE_STACK
|
#define SAVE_STACK
|
||||||
#define RESTORE_STACK
|
#define RESTORE_STACK
|
||||||
#define ALLOC_STACK
|
#define ALLOC_STACK
|
||||||
|
#define ALLOC_NONE 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -143,6 +149,7 @@ extern char *global_stack_top;
|
||||||
#define VARDECL(type, var) type *var
|
#define VARDECL(type, var) type *var
|
||||||
#define ALLOC(var, size, type) var = PUSH(global_stack, size, type)
|
#define ALLOC(var, size, type) var = PUSH(global_stack, size, type)
|
||||||
#define SAVE_STACK char *_saved_stack = global_stack;
|
#define SAVE_STACK char *_saved_stack = global_stack;
|
||||||
|
#define ALLOC_NONE 0
|
||||||
|
|
||||||
#endif /* VAR_ARRAYS */
|
#endif /* VAR_ARRAYS */
|
||||||
|
|
||||||
|
@ -159,7 +166,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)
|
||||||
|
|
|
@ -41,14 +41,14 @@
|
||||||
|
|
||||||
#if defined(CPU_ARM)
|
#if defined(CPU_ARM)
|
||||||
#if ARM_ARCH == 4
|
#if ARM_ARCH == 4
|
||||||
#define ARMv4_ASM
|
#define OPUS_ARM_INLINE_ASM
|
||||||
#elif ARM_ARCH > 4
|
#elif ARM_ARCH > 4
|
||||||
#define ARMv5E_ASM
|
#define OPUS_ARM_INLINE_EDSP
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CPU_COLDFIRE)
|
#if defined(CPU_COLDFIRE)
|
||||||
#define CF_ASM
|
#define OPUS_CF_INLINE_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* CONFIG_H */
|
#endif /* CONFIG_H */
|
||||||
|
|
333
lib/rbcodec/codecs/libopus/opus.c
Normal file
333
lib/rbcodec/codecs/libopus/opus.c
Normal file
|
@ -0,0 +1,333 @@
|
||||||
|
/* Copyright (c) 2011 Xiph.Org Foundation, Skype Limited
|
||||||
|
Written by Jean-Marc Valin and Koen Vos */
|
||||||
|
/*
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
- Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||||
|
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "opus.h"
|
||||||
|
#include "opus_private.h"
|
||||||
|
|
||||||
|
#ifndef DISABLE_FLOAT_API
|
||||||
|
OPUS_EXPORT void opus_pcm_soft_clip(float *_x, int N, int C, float *declip_mem)
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
int i;
|
||||||
|
float *x;
|
||||||
|
|
||||||
|
if (C<1 || N<1 || !_x || !declip_mem) return;
|
||||||
|
|
||||||
|
/* First thing: saturate everything to +/- 2 which is the highest level our
|
||||||
|
non-linearity can handle. At the point where the signal reaches +/-2,
|
||||||
|
the derivative will be zero anyway, so this doesn't introduce any
|
||||||
|
discontinuity in the derivative. */
|
||||||
|
for (i=0;i<N*C;i++)
|
||||||
|
_x[i] = MAX16(-2.f, MIN16(2.f, _x[i]));
|
||||||
|
for (c=0;c<C;c++)
|
||||||
|
{
|
||||||
|
float a;
|
||||||
|
float x0;
|
||||||
|
int curr;
|
||||||
|
|
||||||
|
x = _x+c;
|
||||||
|
a = declip_mem[c];
|
||||||
|
/* Continue applying the non-linearity from the previous frame to avoid
|
||||||
|
any discontinuity. */
|
||||||
|
for (i=0;i<N;i++)
|
||||||
|
{
|
||||||
|
if (x[i*C]*a>=0)
|
||||||
|
break;
|
||||||
|
x[i*C] = x[i*C]+a*x[i*C]*x[i*C];
|
||||||
|
}
|
||||||
|
|
||||||
|
curr=0;
|
||||||
|
x0 = x[0];
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
int start, end;
|
||||||
|
float maxval;
|
||||||
|
int special=0;
|
||||||
|
int peak_pos;
|
||||||
|
for (i=curr;i<N;i++)
|
||||||
|
{
|
||||||
|
if (x[i*C]>1 || x[i*C]<-1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i==N)
|
||||||
|
{
|
||||||
|
a=0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
peak_pos = i;
|
||||||
|
start=end=i;
|
||||||
|
maxval=ABS16(x[i*C]);
|
||||||
|
/* Look for first zero crossing before clipping */
|
||||||
|
while (start>0 && x[i*C]*x[(start-1)*C]>=0)
|
||||||
|
start--;
|
||||||
|
/* Look for first zero crossing after clipping */
|
||||||
|
while (end<N && x[i*C]*x[end*C]>=0)
|
||||||
|
{
|
||||||
|
/* Look for other peaks until the next zero-crossing. */
|
||||||
|
if (ABS16(x[end*C])>maxval)
|
||||||
|
{
|
||||||
|
maxval = ABS16(x[end*C]);
|
||||||
|
peak_pos = end;
|
||||||
|
}
|
||||||
|
end++;
|
||||||
|
}
|
||||||
|
/* Detect the special case where we clip before the first zero crossing */
|
||||||
|
special = (start==0 && x[i*C]*x[0]>=0);
|
||||||
|
|
||||||
|
/* Compute a such that maxval + a*maxval^2 = 1 */
|
||||||
|
a=(maxval-1)/(maxval*maxval);
|
||||||
|
if (x[i*C]>0)
|
||||||
|
a = -a;
|
||||||
|
/* Apply soft clipping */
|
||||||
|
for (i=start;i<end;i++)
|
||||||
|
x[i*C] = x[i*C]+a*x[i*C]*x[i*C];
|
||||||
|
|
||||||
|
if (special && peak_pos>=2)
|
||||||
|
{
|
||||||
|
/* Add a linear ramp from the first sample to the signal peak.
|
||||||
|
This avoids a discontinuity at the beginning of the frame. */
|
||||||
|
float delta;
|
||||||
|
float offset = x0-x[0];
|
||||||
|
delta = offset / peak_pos;
|
||||||
|
for (i=curr;i<peak_pos;i++)
|
||||||
|
{
|
||||||
|
offset -= delta;
|
||||||
|
x[i*C] += offset;
|
||||||
|
x[i*C] = MAX16(-1.f, MIN16(1.f, x[i*C]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
curr = end;
|
||||||
|
if (curr==N)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
declip_mem[c] = a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
int encode_size(int size, unsigned char *data)
|
||||||
|
{
|
||||||
|
if (size < 252)
|
||||||
|
{
|
||||||
|
data[0] = size;
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
data[0] = 252+(size&0x3);
|
||||||
|
data[1] = (size-(int)data[0])>>2;
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int parse_size(const unsigned char *data, opus_int32 len, opus_int16 *size)
|
||||||
|
{
|
||||||
|
if (len<1)
|
||||||
|
{
|
||||||
|
*size = -1;
|
||||||
|
return -1;
|
||||||
|
} else if (data[0]<252)
|
||||||
|
{
|
||||||
|
*size = data[0];
|
||||||
|
return 1;
|
||||||
|
} else if (len<2)
|
||||||
|
{
|
||||||
|
*size = -1;
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
*size = 4*data[1] + data[0];
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int opus_packet_parse_impl(const unsigned char *data, opus_int32 len,
|
||||||
|
int self_delimited, unsigned char *out_toc,
|
||||||
|
const unsigned char *frames[48], opus_int16 size[48],
|
||||||
|
int *payload_offset, opus_int32 *packet_offset)
|
||||||
|
{
|
||||||
|
int i, bytes;
|
||||||
|
int count;
|
||||||
|
int cbr;
|
||||||
|
unsigned char ch, toc;
|
||||||
|
int framesize;
|
||||||
|
opus_int32 last_size;
|
||||||
|
opus_int32 pad = 0;
|
||||||
|
const unsigned char *data0 = data;
|
||||||
|
|
||||||
|
if (size==NULL)
|
||||||
|
return OPUS_BAD_ARG;
|
||||||
|
|
||||||
|
framesize = opus_packet_get_samples_per_frame(data, 48000);
|
||||||
|
|
||||||
|
cbr = 0;
|
||||||
|
toc = *data++;
|
||||||
|
len--;
|
||||||
|
last_size = len;
|
||||||
|
switch (toc&0x3)
|
||||||
|
{
|
||||||
|
/* One frame */
|
||||||
|
case 0:
|
||||||
|
count=1;
|
||||||
|
break;
|
||||||
|
/* Two CBR frames */
|
||||||
|
case 1:
|
||||||
|
count=2;
|
||||||
|
cbr = 1;
|
||||||
|
if (!self_delimited)
|
||||||
|
{
|
||||||
|
if (len&0x1)
|
||||||
|
return OPUS_INVALID_PACKET;
|
||||||
|
last_size = len/2;
|
||||||
|
/* If last_size doesn't fit in size[0], we'll catch it later */
|
||||||
|
size[0] = (opus_int16)last_size;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
/* Two VBR frames */
|
||||||
|
case 2:
|
||||||
|
count = 2;
|
||||||
|
bytes = parse_size(data, len, size);
|
||||||
|
len -= bytes;
|
||||||
|
if (size[0]<0 || size[0] > len)
|
||||||
|
return OPUS_INVALID_PACKET;
|
||||||
|
data += bytes;
|
||||||
|
last_size = len-size[0];
|
||||||
|
break;
|
||||||
|
/* Multiple CBR/VBR frames (from 0 to 120 ms) */
|
||||||
|
default: /*case 3:*/
|
||||||
|
if (len<1)
|
||||||
|
return OPUS_INVALID_PACKET;
|
||||||
|
/* Number of frames encoded in bits 0 to 5 */
|
||||||
|
ch = *data++;
|
||||||
|
count = ch&0x3F;
|
||||||
|
if (count <= 0 || framesize*count > 5760)
|
||||||
|
return OPUS_INVALID_PACKET;
|
||||||
|
len--;
|
||||||
|
/* Padding flag is bit 6 */
|
||||||
|
if (ch&0x40)
|
||||||
|
{
|
||||||
|
int p;
|
||||||
|
do {
|
||||||
|
int tmp;
|
||||||
|
if (len<=0)
|
||||||
|
return OPUS_INVALID_PACKET;
|
||||||
|
p = *data++;
|
||||||
|
len--;
|
||||||
|
tmp = p==255 ? 254: p;
|
||||||
|
len -= tmp;
|
||||||
|
pad += tmp;
|
||||||
|
} while (p==255);
|
||||||
|
}
|
||||||
|
if (len<0)
|
||||||
|
return OPUS_INVALID_PACKET;
|
||||||
|
/* VBR flag is bit 7 */
|
||||||
|
cbr = !(ch&0x80);
|
||||||
|
if (!cbr)
|
||||||
|
{
|
||||||
|
/* VBR case */
|
||||||
|
last_size = len;
|
||||||
|
for (i=0;i<count-1;i++)
|
||||||
|
{
|
||||||
|
bytes = parse_size(data, len, size+i);
|
||||||
|
len -= bytes;
|
||||||
|
if (size[i]<0 || size[i] > len)
|
||||||
|
return OPUS_INVALID_PACKET;
|
||||||
|
data += bytes;
|
||||||
|
last_size -= bytes+size[i];
|
||||||
|
}
|
||||||
|
if (last_size<0)
|
||||||
|
return OPUS_INVALID_PACKET;
|
||||||
|
} else if (!self_delimited)
|
||||||
|
{
|
||||||
|
/* CBR case */
|
||||||
|
last_size = len/count;
|
||||||
|
if (last_size*count!=len)
|
||||||
|
return OPUS_INVALID_PACKET;
|
||||||
|
for (i=0;i<count-1;i++)
|
||||||
|
size[i] = (opus_int16)last_size;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* Self-delimited framing has an extra size for the last frame. */
|
||||||
|
if (self_delimited)
|
||||||
|
{
|
||||||
|
bytes = parse_size(data, len, size+count-1);
|
||||||
|
len -= bytes;
|
||||||
|
if (size[count-1]<0 || size[count-1] > len)
|
||||||
|
return OPUS_INVALID_PACKET;
|
||||||
|
data += bytes;
|
||||||
|
/* For CBR packets, apply the size to all the frames. */
|
||||||
|
if (cbr)
|
||||||
|
{
|
||||||
|
if (size[count-1]*count > len)
|
||||||
|
return OPUS_INVALID_PACKET;
|
||||||
|
for (i=0;i<count-1;i++)
|
||||||
|
size[i] = size[count-1];
|
||||||
|
} else if (bytes+size[count-1] > last_size)
|
||||||
|
return OPUS_INVALID_PACKET;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
/* Because it's not encoded explicitly, it's possible the size of the
|
||||||
|
last packet (or all the packets, for the CBR case) is larger than
|
||||||
|
1275. Reject them here.*/
|
||||||
|
if (last_size > 1275)
|
||||||
|
return OPUS_INVALID_PACKET;
|
||||||
|
size[count-1] = (opus_int16)last_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (payload_offset)
|
||||||
|
*payload_offset = (int)(data-data0);
|
||||||
|
|
||||||
|
for (i=0;i<count;i++)
|
||||||
|
{
|
||||||
|
if (frames)
|
||||||
|
frames[i] = data;
|
||||||
|
data += size[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packet_offset)
|
||||||
|
*packet_offset = pad+(opus_int32)(data-data0);
|
||||||
|
|
||||||
|
if (out_toc)
|
||||||
|
*out_toc = toc;
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
int opus_packet_parse(const unsigned char *data, opus_int32 len,
|
||||||
|
unsigned char *out_toc, const unsigned char *frames[48],
|
||||||
|
opus_int16 size[48], int *payload_offset)
|
||||||
|
{
|
||||||
|
return opus_packet_parse_impl(data, len, 0, out_toc,
|
||||||
|
frames, size, payload_offset, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -911,6 +911,64 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_repacketizer_get_nb_frames(OpusRepa
|
||||||
*/
|
*/
|
||||||
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_repacketizer_out(OpusRepacketizer *rp, unsigned char *data, opus_int32 maxlen) OPUS_ARG_NONNULL(1);
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_repacketizer_out(OpusRepacketizer *rp, unsigned char *data, opus_int32 maxlen) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/** Pads a given Opus packet to a larger size (possibly changing the TOC sequence).
|
||||||
|
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the
|
||||||
|
* packet to pad.
|
||||||
|
* @param len <tt>opus_int32</tt>: The size of the packet.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @param new_len <tt>opus_int32</tt>: The desired size of the packet after padding.
|
||||||
|
* This must be at least as large as len.
|
||||||
|
* @returns an error code
|
||||||
|
* @retval #OPUS_OK \a on success.
|
||||||
|
* @retval #OPUS_BAD_ARG \a len was less than 1 or new_len was less than len.
|
||||||
|
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT int opus_packet_pad(unsigned char *data, opus_int32 len, opus_int32 new_len);
|
||||||
|
|
||||||
|
/** Remove all padding from a given Opus packet and rewrite the TOC sequence to
|
||||||
|
* minimize space usage.
|
||||||
|
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the
|
||||||
|
* packet to strip.
|
||||||
|
* @param len <tt>opus_int32</tt>: The size of the packet.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @returns The new size of the output packet on success, or an error code
|
||||||
|
* on failure.
|
||||||
|
* @retval #OPUS_BAD_ARG \a len was less than 1.
|
||||||
|
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_packet_unpad(unsigned char *data, opus_int32 len);
|
||||||
|
|
||||||
|
/** Pads a given Opus multi-stream packet to a larger size (possibly changing the TOC sequence).
|
||||||
|
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the
|
||||||
|
* packet to pad.
|
||||||
|
* @param len <tt>opus_int32</tt>: The size of the packet.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @param new_len <tt>opus_int32</tt>: The desired size of the packet after padding.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @param nb_streams <tt>opus_int32</tt>: The number of streams (not channels) in the packet.
|
||||||
|
* This must be at least as large as len.
|
||||||
|
* @returns an error code
|
||||||
|
* @retval #OPUS_OK \a on success.
|
||||||
|
* @retval #OPUS_BAD_ARG \a len was less than 1.
|
||||||
|
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT int opus_multistream_packet_pad(unsigned char *data, opus_int32 len, opus_int32 new_len, int nb_streams);
|
||||||
|
|
||||||
|
/** Remove all padding from a given Opus multi-stream packet and rewrite the TOC sequence to
|
||||||
|
* minimize space usage.
|
||||||
|
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the
|
||||||
|
* packet to strip.
|
||||||
|
* @param len <tt>opus_int32</tt>: The size of the packet.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @param nb_streams <tt>opus_int32</tt>: The number of streams (not channels) in the packet.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @returns The new size of the output packet on success, or an error code
|
||||||
|
* on failure.
|
||||||
|
* @retval #OPUS_BAD_ARG \a len was less than 1 or new_len was less than len.
|
||||||
|
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_packet_unpad(unsigned char *data, opus_int32 len, int nb_streams);
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -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
|
||||||
|
@ -140,6 +140,7 @@ OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_si
|
||||||
int channels
|
int channels
|
||||||
) OPUS_ARG_NONNULL(1);
|
) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
# ifdef CUSTOM_MODES
|
||||||
/** Initializes a previously allocated encoder state
|
/** Initializes a previously allocated encoder state
|
||||||
* The memory pointed to by st must be the size returned by opus_custom_encoder_get_size.
|
* The memory pointed to by st must be the size returned by opus_custom_encoder_get_size.
|
||||||
* This is intended for applications which use their own allocator instead of malloc.
|
* This is intended for applications which use their own allocator instead of malloc.
|
||||||
|
@ -152,12 +153,12 @@ OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_si
|
||||||
* @param [in] channels <tt>int</tt>: Number of channels
|
* @param [in] channels <tt>int</tt>: Number of channels
|
||||||
* @return OPUS_OK Success or @ref opus_errorcodes
|
* @return OPUS_OK Success or @ref opus_errorcodes
|
||||||
*/
|
*/
|
||||||
OPUS_CUSTOM_EXPORT_STATIC int opus_custom_encoder_init(
|
OPUS_CUSTOM_EXPORT int opus_custom_encoder_init(
|
||||||
OpusCustomEncoder *st,
|
OpusCustomEncoder *st,
|
||||||
const OpusCustomMode *mode,
|
const OpusCustomMode *mode,
|
||||||
int channels
|
int channels
|
||||||
) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
|
) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPUS_BUILD
|
#ifndef OPUS_BUILD
|
||||||
#error "OPUS_BUILD _MUST_ be defined to build Opus. This probably means you need other defines as well, as in a config.h. See the included build files for details."
|
# error "OPUS_BUILD _MUST_ be defined to build Opus. This probably means you need other defines as well, as in a config.h. See the included build files for details."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && (__GNUC__ >= 2) && !defined(__OPTIMIZE__)
|
||||||
|
# pragma message "You appear to be compiling without optimization, if so opus will be very slow."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -71,11 +75,10 @@ struct OpusDecoder {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
opus_uint32 rangeFinal;
|
opus_uint32 rangeFinal;
|
||||||
int arch;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#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
|
||||||
|
@ -121,7 +124,6 @@ int opus_decoder_init(OpusDecoder *st, opus_int32 Fs, int channels)
|
||||||
st->Fs = Fs;
|
st->Fs = Fs;
|
||||||
st->DecControl.API_sampleRate = st->Fs;
|
st->DecControl.API_sampleRate = st->Fs;
|
||||||
st->DecControl.nChannelsAPI = st->channels;
|
st->DecControl.nChannelsAPI = st->channels;
|
||||||
st->arch = opus_select_arch();
|
|
||||||
|
|
||||||
/* Reset decoder */
|
/* Reset decoder */
|
||||||
ret = silk_InitDecoder( silk_dec );
|
ret = silk_InitDecoder( silk_dec );
|
||||||
|
@ -152,7 +154,6 @@ OpusDecoder *opus_decoder_create(opus_int32 Fs, int channels, int *error)
|
||||||
*error = OPUS_BAD_ARG;
|
*error = OPUS_BAD_ARG;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (STATIC_DECODER_SIZE >= opus_decoder_get_size(channels))
|
if (STATIC_DECODER_SIZE >= opus_decoder_get_size(channels))
|
||||||
st = (OpusDecoder *)s_dec;
|
st = (OpusDecoder *)s_dec;
|
||||||
else
|
else
|
||||||
|
@ -265,26 +266,44 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
|
||||||
ec_dec_init(&dec,(unsigned char*)data,len);
|
ec_dec_init(&dec,(unsigned char*)data,len);
|
||||||
} else {
|
} else {
|
||||||
audiosize = frame_size;
|
audiosize = frame_size;
|
||||||
|
mode = st->prev_mode;
|
||||||
|
|
||||||
if (st->prev_mode == 0)
|
if (mode == 0)
|
||||||
{
|
{
|
||||||
/* If we haven't got any packet yet, all we can do is return zeros */
|
/* If we haven't got any packet yet, all we can do is return zeros */
|
||||||
for (i=0;i<audiosize*st->channels;i++)
|
for (i=0;i<audiosize*st->channels;i++)
|
||||||
pcm[i] = 0;
|
pcm[i] = 0;
|
||||||
RESTORE_STACK;
|
RESTORE_STACK;
|
||||||
return audiosize;
|
return audiosize;
|
||||||
} else {
|
}
|
||||||
mode = st->prev_mode;
|
|
||||||
|
/* Avoids trying to run the PLC on sizes other than 2.5 (CELT), 5 (CELT),
|
||||||
|
10, or 20 (e.g. 12.5 or 30 ms). */
|
||||||
|
if (audiosize > F20)
|
||||||
|
{
|
||||||
|
do {
|
||||||
|
int ret = opus_decode_frame(st, NULL, 0, pcm, IMIN(audiosize, F20), 0);
|
||||||
|
if (ret<0)
|
||||||
|
{
|
||||||
|
RESTORE_STACK;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
pcm += ret*st->channels;
|
||||||
|
audiosize -= ret;
|
||||||
|
} while (audiosize > 0);
|
||||||
|
RESTORE_STACK;
|
||||||
|
return frame_size;
|
||||||
|
} else if (audiosize < F20)
|
||||||
|
{
|
||||||
|
if (audiosize > F10)
|
||||||
|
audiosize = F10;
|
||||||
|
else if (mode != MODE_SILK_ONLY && audiosize > F5 && audiosize < F10)
|
||||||
|
audiosize = F5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For CELT/hybrid PLC of more than 20 ms, opus_decode_native() will do
|
pcm_transition_silk_size = ALLOC_NONE;
|
||||||
multiple calls */
|
pcm_transition_celt_size = ALLOC_NONE;
|
||||||
if (data==NULL && mode != MODE_SILK_ONLY)
|
|
||||||
frame_size = IMIN(frame_size, F20);
|
|
||||||
|
|
||||||
pcm_transition_silk_size = 0;
|
|
||||||
pcm_transition_celt_size = 0;
|
|
||||||
if (data!=NULL && st->prev_mode > 0 && (
|
if (data!=NULL && st->prev_mode > 0 && (
|
||||||
(mode == MODE_CELT_ONLY && st->prev_mode != MODE_CELT_ONLY && !st->prev_redundancy)
|
(mode == MODE_CELT_ONLY && st->prev_mode != MODE_CELT_ONLY && !st->prev_redundancy)
|
||||||
|| (mode != MODE_CELT_ONLY && st->prev_mode == MODE_CELT_ONLY) )
|
|| (mode != MODE_CELT_ONLY && st->prev_mode == MODE_CELT_ONLY) )
|
||||||
|
@ -313,7 +332,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't allocate any memory when in CELT-only mode */
|
/* Don't allocate any memory when in CELT-only mode */
|
||||||
pcm_silk_size = (mode != MODE_CELT_ONLY) ? IMAX(F10, frame_size)*st->channels : 0;
|
pcm_silk_size = (mode != MODE_CELT_ONLY) ? IMAX(F10, frame_size)*st->channels : ALLOC_NONE;
|
||||||
ALLOC(pcm_silk, pcm_silk_size, opus_int16);
|
ALLOC(pcm_silk, pcm_silk_size, opus_int16);
|
||||||
|
|
||||||
/* SILK processing */
|
/* SILK processing */
|
||||||
|
@ -363,7 +382,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
|
||||||
pcm_ptr[i] = 0;
|
pcm_ptr[i] = 0;
|
||||||
} else {
|
} else {
|
||||||
RESTORE_STACK;
|
RESTORE_STACK;
|
||||||
return OPUS_INVALID_PACKET;
|
return OPUS_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pcm_ptr += silk_frame_size * st->channels;
|
pcm_ptr += silk_frame_size * st->channels;
|
||||||
|
@ -430,7 +449,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
|
||||||
if (redundancy)
|
if (redundancy)
|
||||||
{
|
{
|
||||||
transition = 0;
|
transition = 0;
|
||||||
pcm_transition_silk_size=0;
|
pcm_transition_silk_size=ALLOC_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALLOC(pcm_transition_silk, pcm_transition_silk_size, opus_val16);
|
ALLOC(pcm_transition_silk, pcm_transition_silk_size, opus_val16);
|
||||||
|
@ -442,7 +461,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only allocation memory for redundancy if/when needed */
|
/* Only allocation memory for redundancy if/when needed */
|
||||||
redundant_audio_size = redundancy ? F5*st->channels : 0;
|
redundant_audio_size = redundancy ? F5*st->channels : ALLOC_NONE;
|
||||||
ALLOC(redundant_audio, redundant_audio_size, opus_val16);
|
ALLOC(redundant_audio, redundant_audio_size, opus_val16);
|
||||||
|
|
||||||
/* 5 ms redundant frame for CELT->SILK*/
|
/* 5 ms redundant frame for CELT->SILK*/
|
||||||
|
@ -569,189 +588,13 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_size(const unsigned char *data, opus_int32 len, opus_int16 *size)
|
|
||||||
{
|
|
||||||
if (len<1)
|
|
||||||
{
|
|
||||||
*size = -1;
|
|
||||||
return -1;
|
|
||||||
} else if (data[0]<252)
|
|
||||||
{
|
|
||||||
*size = data[0];
|
|
||||||
return 1;
|
|
||||||
} else if (len<2)
|
|
||||||
{
|
|
||||||
*size = -1;
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
*size = 4*data[1] + data[0];
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int opus_packet_parse_impl(const unsigned char *data, opus_int32 len,
|
|
||||||
int self_delimited, unsigned char *out_toc,
|
|
||||||
const unsigned char *frames[48], opus_int16 size[48], int *payload_offset)
|
|
||||||
{
|
|
||||||
int i, bytes;
|
|
||||||
int count;
|
|
||||||
int cbr;
|
|
||||||
unsigned char ch, toc;
|
|
||||||
int framesize;
|
|
||||||
opus_int32 last_size;
|
|
||||||
const unsigned char *data0 = data;
|
|
||||||
|
|
||||||
if (size==NULL)
|
|
||||||
return OPUS_BAD_ARG;
|
|
||||||
|
|
||||||
framesize = opus_packet_get_samples_per_frame(data, 48000);
|
|
||||||
|
|
||||||
cbr = 0;
|
|
||||||
toc = *data++;
|
|
||||||
len--;
|
|
||||||
last_size = len;
|
|
||||||
switch (toc&0x3)
|
|
||||||
{
|
|
||||||
/* One frame */
|
|
||||||
case 0:
|
|
||||||
count=1;
|
|
||||||
break;
|
|
||||||
/* Two CBR frames */
|
|
||||||
case 1:
|
|
||||||
count=2;
|
|
||||||
cbr = 1;
|
|
||||||
if (!self_delimited)
|
|
||||||
{
|
|
||||||
if (len&0x1)
|
|
||||||
return OPUS_INVALID_PACKET;
|
|
||||||
last_size = len/2;
|
|
||||||
/* If last_size doesn't fit in size[0], we'll catch it later */
|
|
||||||
size[0] = (opus_int16)last_size;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
/* Two VBR frames */
|
|
||||||
case 2:
|
|
||||||
count = 2;
|
|
||||||
bytes = parse_size(data, len, size);
|
|
||||||
len -= bytes;
|
|
||||||
if (size[0]<0 || size[0] > len)
|
|
||||||
return OPUS_INVALID_PACKET;
|
|
||||||
data += bytes;
|
|
||||||
last_size = len-size[0];
|
|
||||||
break;
|
|
||||||
/* Multiple CBR/VBR frames (from 0 to 120 ms) */
|
|
||||||
default: /*case 3:*/
|
|
||||||
if (len<1)
|
|
||||||
return OPUS_INVALID_PACKET;
|
|
||||||
/* Number of frames encoded in bits 0 to 5 */
|
|
||||||
ch = *data++;
|
|
||||||
count = ch&0x3F;
|
|
||||||
if (count <= 0 || framesize*count > 5760)
|
|
||||||
return OPUS_INVALID_PACKET;
|
|
||||||
len--;
|
|
||||||
/* Padding flag is bit 6 */
|
|
||||||
if (ch&0x40)
|
|
||||||
{
|
|
||||||
int p;
|
|
||||||
do {
|
|
||||||
if (len<=0)
|
|
||||||
return OPUS_INVALID_PACKET;
|
|
||||||
p = *data++;
|
|
||||||
len--;
|
|
||||||
len -= p==255 ? 254: p;
|
|
||||||
} while (p==255);
|
|
||||||
}
|
|
||||||
if (len<0)
|
|
||||||
return OPUS_INVALID_PACKET;
|
|
||||||
/* VBR flag is bit 7 */
|
|
||||||
cbr = !(ch&0x80);
|
|
||||||
if (!cbr)
|
|
||||||
{
|
|
||||||
/* VBR case */
|
|
||||||
last_size = len;
|
|
||||||
for (i=0;i<count-1;i++)
|
|
||||||
{
|
|
||||||
bytes = parse_size(data, len, size+i);
|
|
||||||
len -= bytes;
|
|
||||||
if (size[i]<0 || size[i] > len)
|
|
||||||
return OPUS_INVALID_PACKET;
|
|
||||||
data += bytes;
|
|
||||||
last_size -= bytes+size[i];
|
|
||||||
}
|
|
||||||
if (last_size<0)
|
|
||||||
return OPUS_INVALID_PACKET;
|
|
||||||
} else if (!self_delimited)
|
|
||||||
{
|
|
||||||
/* CBR case */
|
|
||||||
last_size = len/count;
|
|
||||||
if (last_size*count!=len)
|
|
||||||
return OPUS_INVALID_PACKET;
|
|
||||||
for (i=0;i<count-1;i++)
|
|
||||||
size[i] = (opus_int16)last_size;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* Self-delimited framing has an extra size for the last frame. */
|
|
||||||
if (self_delimited)
|
|
||||||
{
|
|
||||||
bytes = parse_size(data, len, size+count-1);
|
|
||||||
len -= bytes;
|
|
||||||
if (size[count-1]<0 || size[count-1] > len)
|
|
||||||
return OPUS_INVALID_PACKET;
|
|
||||||
data += bytes;
|
|
||||||
/* For CBR packets, apply the size to all the frames. */
|
|
||||||
if (cbr)
|
|
||||||
{
|
|
||||||
if (size[count-1]*count > len)
|
|
||||||
return OPUS_INVALID_PACKET;
|
|
||||||
for (i=0;i<count-1;i++)
|
|
||||||
size[i] = size[count-1];
|
|
||||||
} else if(size[count-1] > last_size)
|
|
||||||
return OPUS_INVALID_PACKET;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
/* Because it's not encoded explicitly, it's possible the size of the
|
|
||||||
last packet (or all the packets, for the CBR case) is larger than
|
|
||||||
1275. Reject them here.*/
|
|
||||||
if (last_size > 1275)
|
|
||||||
return OPUS_INVALID_PACKET;
|
|
||||||
size[count-1] = (opus_int16)last_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frames)
|
|
||||||
{
|
|
||||||
for (i=0;i<count;i++)
|
|
||||||
{
|
|
||||||
frames[i] = data;
|
|
||||||
data += size[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (out_toc)
|
|
||||||
*out_toc = toc;
|
|
||||||
|
|
||||||
if (payload_offset)
|
|
||||||
*payload_offset = (int)(data-data0);
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
int opus_packet_parse(const unsigned char *data, opus_int32 len,
|
|
||||||
unsigned char *out_toc, const unsigned char *frames[48],
|
|
||||||
opus_int16 size[48], int *payload_offset)
|
|
||||||
{
|
|
||||||
return opus_packet_parse_impl(data, len, 0, out_toc,
|
|
||||||
frames, size, payload_offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
int opus_decode_native(OpusDecoder *st, const unsigned char *data,
|
int opus_decode_native(OpusDecoder *st, const unsigned char *data,
|
||||||
opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec,
|
opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec,
|
||||||
int self_delimited, int *packet_offset, int soft_clip)
|
int self_delimited, opus_int32 *packet_offset, int soft_clip)
|
||||||
{
|
{
|
||||||
int i, nb_samples;
|
int i, nb_samples;
|
||||||
int count, offset;
|
int count, offset;
|
||||||
unsigned char toc;
|
unsigned char toc;
|
||||||
int tot_offset;
|
|
||||||
int packet_frame_size, packet_bandwidth, packet_mode, packet_stream_channels;
|
int packet_frame_size, packet_bandwidth, packet_mode, packet_stream_channels;
|
||||||
/* 48 x 2.5 ms = 120 ms */
|
/* 48 x 2.5 ms = 120 ms */
|
||||||
opus_int16 size[48];
|
opus_int16 size[48];
|
||||||
|
@ -783,7 +626,10 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data,
|
||||||
packet_frame_size = opus_packet_get_samples_per_frame(data, st->Fs);
|
packet_frame_size = opus_packet_get_samples_per_frame(data, st->Fs);
|
||||||
packet_stream_channels = opus_packet_get_nb_channels(data);
|
packet_stream_channels = opus_packet_get_nb_channels(data);
|
||||||
|
|
||||||
count = opus_packet_parse_impl(data, len, self_delimited, &toc, NULL, size, &offset);
|
count = opus_packet_parse_impl(data, len, self_delimited, &toc, NULL,
|
||||||
|
size, &offset, packet_offset);
|
||||||
|
if (count<0)
|
||||||
|
return count;
|
||||||
|
|
||||||
data += offset;
|
data += offset;
|
||||||
|
|
||||||
|
@ -822,11 +668,6 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data,
|
||||||
return frame_size;
|
return frame_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tot_offset = 0;
|
|
||||||
if (count < 0)
|
|
||||||
return count;
|
|
||||||
|
|
||||||
tot_offset += offset;
|
|
||||||
|
|
||||||
if (count*packet_frame_size > frame_size)
|
if (count*packet_frame_size > frame_size)
|
||||||
return OPUS_BUFFER_TOO_SMALL;
|
return OPUS_BUFFER_TOO_SMALL;
|
||||||
|
@ -846,11 +687,8 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data,
|
||||||
return ret;
|
return ret;
|
||||||
celt_assert(ret==packet_frame_size);
|
celt_assert(ret==packet_frame_size);
|
||||||
data += size[i];
|
data += size[i];
|
||||||
tot_offset += size[i];
|
|
||||||
nb_samples += ret;
|
nb_samples += ret;
|
||||||
}
|
}
|
||||||
if (packet_offset != NULL)
|
|
||||||
*packet_offset = tot_offset;
|
|
||||||
st->last_packet_duration = nb_samples;
|
st->last_packet_duration = nb_samples;
|
||||||
if (OPUS_CHECK_ARRAY(pcm, nb_samples*st->channels))
|
if (OPUS_CHECK_ARRAY(pcm, nb_samples*st->channels))
|
||||||
OPUS_PRINT_INT(nb_samples);
|
OPUS_PRINT_INT(nb_samples);
|
||||||
|
@ -868,6 +706,8 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data,
|
||||||
int opus_decode(OpusDecoder *st, const unsigned char *data,
|
int opus_decode(OpusDecoder *st, const unsigned char *data,
|
||||||
opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec)
|
opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec)
|
||||||
{
|
{
|
||||||
|
if(frame_size<=0)
|
||||||
|
return OPUS_BAD_ARG;
|
||||||
return opus_decode_native(st, data, len, pcm, frame_size, decode_fec, 0, NULL, 0);
|
return opus_decode_native(st, data, len, pcm, frame_size, decode_fec, 0, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,6 +719,11 @@ int opus_decode_float(OpusDecoder *st, const unsigned char *data,
|
||||||
int ret, i;
|
int ret, i;
|
||||||
ALLOC_STACK;
|
ALLOC_STACK;
|
||||||
|
|
||||||
|
if(frame_size<=0)
|
||||||
|
{
|
||||||
|
RESTORE_STACK;
|
||||||
|
return OPUS_BAD_ARG;
|
||||||
|
}
|
||||||
ALLOC(out, frame_size*st->channels, opus_int16);
|
ALLOC(out, frame_size*st->channels, opus_int16);
|
||||||
|
|
||||||
ret = opus_decode_native(st, data, len, out, frame_size, decode_fec, 0, NULL, 0);
|
ret = opus_decode_native(st, data, len, out, frame_size, decode_fec, 0, NULL, 0);
|
||||||
|
@ -901,7 +746,7 @@ int opus_decode(OpusDecoder *st, const unsigned char *data,
|
||||||
int ret, i;
|
int ret, i;
|
||||||
ALLOC_STACK;
|
ALLOC_STACK;
|
||||||
|
|
||||||
if(frame_size<0)
|
if(frame_size<=0)
|
||||||
{
|
{
|
||||||
RESTORE_STACK;
|
RESTORE_STACK;
|
||||||
return OPUS_BAD_ARG;
|
return OPUS_BAD_ARG;
|
||||||
|
@ -922,6 +767,8 @@ int opus_decode(OpusDecoder *st, const unsigned char *data,
|
||||||
int opus_decode_float(OpusDecoder *st, const unsigned char *data,
|
int opus_decode_float(OpusDecoder *st, const unsigned char *data,
|
||||||
opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec)
|
opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec)
|
||||||
{
|
{
|
||||||
|
if(frame_size<=0)
|
||||||
|
return OPUS_BAD_ARG;
|
||||||
return opus_decode_native(st, data, len, pcm, frame_size, decode_fec, 0, NULL, 0);
|
return opus_decode_native(st, data, len, pcm, frame_size, decode_fec, 0, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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. */
|
||||||
|
@ -151,6 +163,8 @@ extern "C" {
|
||||||
#define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039
|
#define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039
|
||||||
#define OPUS_SET_EXPERT_FRAME_DURATION_REQUEST 4040
|
#define OPUS_SET_EXPERT_FRAME_DURATION_REQUEST 4040
|
||||||
#define OPUS_GET_EXPERT_FRAME_DURATION_REQUEST 4041
|
#define OPUS_GET_EXPERT_FRAME_DURATION_REQUEST 4041
|
||||||
|
#define OPUS_SET_PREDICTION_DISABLED_REQUEST 4042
|
||||||
|
#define OPUS_GET_PREDICTION_DISABLED_REQUEST 4043
|
||||||
|
|
||||||
/* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */
|
/* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */
|
||||||
|
|
||||||
|
@ -194,7 +208,6 @@ extern "C" {
|
||||||
#define OPUS_FRAMESIZE_20_MS 5004 /**< Use 20 ms frames */
|
#define OPUS_FRAMESIZE_20_MS 5004 /**< Use 20 ms frames */
|
||||||
#define OPUS_FRAMESIZE_40_MS 5005 /**< Use 40 ms frames */
|
#define OPUS_FRAMESIZE_40_MS 5005 /**< Use 40 ms frames */
|
||||||
#define OPUS_FRAMESIZE_60_MS 5006 /**< Use 60 ms frames */
|
#define OPUS_FRAMESIZE_60_MS 5006 /**< Use 60 ms frames */
|
||||||
#define OPUS_FRAMESIZE_VARIABLE 5010 /**< Optimize the frame size dynamically */
|
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
|
@ -575,6 +588,14 @@ extern "C" {
|
||||||
* @hideinitializer */
|
* @hideinitializer */
|
||||||
#define OPUS_GET_EXPERT_FRAME_DURATION(x) OPUS_GET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int_ptr(x)
|
#define OPUS_GET_EXPERT_FRAME_DURATION(x) OPUS_GET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int_ptr(x)
|
||||||
|
|
||||||
|
/** If set to 1, disables almost all use of prediction, making frames almost
|
||||||
|
completely independent. This reduces quality. (default : 0)
|
||||||
|
* @hideinitializer */
|
||||||
|
#define OPUS_SET_PREDICTION_DISABLED(x) OPUS_SET_PREDICTION_DISABLED_REQUEST, __opus_check_int(x)
|
||||||
|
/** Gets the encoder's configured prediction status.
|
||||||
|
* @hideinitializer */
|
||||||
|
#define OPUS_GET_PREDICTION_DISABLED(x) OPUS_GET_PREDICTION_DISABLED_REQUEST, __opus_check_int_ptr(x)
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
/** @defgroup opus_genericctls Generic CTLs
|
/** @defgroup opus_genericctls Generic CTLs
|
||||||
|
|
|
@ -82,35 +82,48 @@ int get_mono_channel(const ChannelLayout *layout, int stream_id, int prev);
|
||||||
#define OPUS_SET_FORCE_MODE_REQUEST 11002
|
#define OPUS_SET_FORCE_MODE_REQUEST 11002
|
||||||
#define OPUS_SET_FORCE_MODE(x) OPUS_SET_FORCE_MODE_REQUEST, __opus_check_int(x)
|
#define OPUS_SET_FORCE_MODE(x) OPUS_SET_FORCE_MODE_REQUEST, __opus_check_int(x)
|
||||||
|
|
||||||
typedef void (*downmix_func)(const void *, float *, int, int, int);
|
typedef void (*downmix_func)(const void *, opus_val32 *, int, int, int, int, int);
|
||||||
void downmix_float(const void *_x, float *sub, int subframe, int offset, int C);
|
void downmix_float(const void *_x, opus_val32 *sub, int subframe, int offset, int c1, int c2, int C);
|
||||||
void downmix_int(const void *_x, float *sub, int subframe, int offset, int C);
|
void downmix_int(const void *_x, opus_val32 *sub, int subframe, int offset, int c1, int c2, int C);
|
||||||
|
|
||||||
int optimize_framesize(const opus_val16 *x, int len, int C, opus_int32 Fs,
|
int optimize_framesize(const opus_val16 *x, int len, int C, opus_int32 Fs,
|
||||||
int bitrate, opus_val16 tonality, opus_val32 *mem, int buffering,
|
int bitrate, opus_val16 tonality, float *mem, int buffering,
|
||||||
downmix_func downmix);
|
downmix_func downmix);
|
||||||
|
|
||||||
int encode_size(int size, unsigned char *data);
|
int encode_size(int size, unsigned char *data);
|
||||||
|
|
||||||
opus_int32 frame_size_select(opus_int32 frame_size, int variable_duration, opus_int32 Fs);
|
opus_int32 frame_size_select(opus_int32 frame_size, int variable_duration, opus_int32 Fs);
|
||||||
|
|
||||||
opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
|
opus_int32 compute_frame_size(const void *analysis_pcm, int frame_size,
|
||||||
unsigned char *data, opus_int32 out_data_bytes, int lsb_depth
|
int variable_duration, int C, opus_int32 Fs, int bitrate_bps,
|
||||||
#ifndef FIXED_POINT
|
int delay_compensation, downmix_func downmix
|
||||||
, AnalysisInfo *analysis_info
|
#ifndef DISABLE_FLOAT_API
|
||||||
|
, float *subframe_mem
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
|
opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
|
||||||
|
unsigned char *data, opus_int32 out_data_bytes, int lsb_depth,
|
||||||
|
const void *analysis_pcm, opus_int32 analysis_size, int c1, int c2, int analysis_channels, downmix_func downmix);
|
||||||
|
|
||||||
int opus_decode_native(OpusDecoder *st, const unsigned char *data, opus_int32 len,
|
int opus_decode_native(OpusDecoder *st, const unsigned char *data, opus_int32 len,
|
||||||
opus_val16 *pcm, int frame_size, int decode_fec, int self_delimited,
|
opus_val16 *pcm, int frame_size, int decode_fec, int self_delimited,
|
||||||
int *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 *);
|
||||||
}
|
}
|
||||||
|
|
||||||
opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int end, unsigned char *data, opus_int32 maxlen, int self_delimited);
|
int opus_packet_parse_impl(const unsigned char *data, opus_int32 len,
|
||||||
|
int self_delimited, unsigned char *out_toc,
|
||||||
|
const unsigned char *frames[48], opus_int16 size[48],
|
||||||
|
int *payload_offset, opus_int32 *packet_offset);
|
||||||
|
|
||||||
|
opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int end,
|
||||||
|
unsigned char *data, opus_int32 maxlen, int self_delimited, int pad);
|
||||||
|
|
||||||
|
int pad_frame(unsigned char *data, opus_int32 len, opus_int32 new_len);
|
||||||
|
|
||||||
#endif /* OPUS_PRIVATE_H */
|
#endif /* OPUS_PRIVATE_H */
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -64,6 +64,7 @@ opus_int silk_Get_Encoder_Size( /* O Returns error co
|
||||||
/*************************/
|
/*************************/
|
||||||
opus_int silk_InitEncoder( /* O Returns error code */
|
opus_int silk_InitEncoder( /* O Returns error code */
|
||||||
void *encState, /* I/O State */
|
void *encState, /* I/O State */
|
||||||
|
int arch, /* I Run-time architecture */
|
||||||
silk_EncControlStruct *encStatus /* O Encoder Status */
|
silk_EncControlStruct *encStatus /* O Encoder Status */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -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 */
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -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) */
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -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;
|
||||||
|
|
|
@ -9,7 +9,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -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 )
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -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) */
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -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 ] */
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -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 */
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -227,7 +227,8 @@ void silk_autocorr(
|
||||||
opus_int *scale, /* O Scaling of the correlation vector */
|
opus_int *scale, /* O Scaling of the correlation vector */
|
||||||
const opus_int16 *inputData, /* I Input data to correlate */
|
const opus_int16 *inputData, /* I Input data to correlate */
|
||||||
const opus_int inputDataSize, /* I Length of input */
|
const opus_int inputDataSize, /* I Length of input */
|
||||||
const opus_int correlationCount /* I Number of correlation taps to compute */
|
const opus_int correlationCount, /* I Number of correlation taps to compute */
|
||||||
|
int arch /* I Run-time architecture */
|
||||||
);
|
);
|
||||||
|
|
||||||
void silk_decode_pitch(
|
void silk_decode_pitch(
|
||||||
|
@ -249,7 +250,8 @@ opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0
|
||||||
const opus_int search_thres2_Q13, /* I Final threshold for lag candidates 0 - 1 */
|
const opus_int search_thres2_Q13, /* I Final threshold for lag candidates 0 - 1 */
|
||||||
const opus_int Fs_kHz, /* I Sample frequency (kHz) */
|
const opus_int Fs_kHz, /* I Sample frequency (kHz) */
|
||||||
const opus_int complexity, /* I Complexity setting, 0-2, where 2 is highest */
|
const opus_int complexity, /* I Complexity setting, 0-2, where 2 is highest */
|
||||||
const opus_int nb_subfr /* I number of 5 ms subframes */
|
const opus_int nb_subfr, /* I number of 5 ms subframes */
|
||||||
|
int arch /* I Run-time architecture */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filter coefficients */
|
/* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filter coefficients */
|
||||||
|
@ -309,7 +311,8 @@ void silk_burg_modified(
|
||||||
const opus_int32 minInvGain_Q30, /* I Inverse of max prediction gain */
|
const opus_int32 minInvGain_Q30, /* I Inverse of max prediction gain */
|
||||||
const opus_int subfr_length, /* I Input signal subframe length (incl. D preceding samples) */
|
const opus_int subfr_length, /* I Input signal subframe length (incl. D preceding samples) */
|
||||||
const opus_int nb_subfr, /* I Number of subframes stacked in x */
|
const opus_int nb_subfr, /* I Number of subframes stacked in x */
|
||||||
const opus_int D /* I Order */
|
const opus_int D, /* I Order */
|
||||||
|
int arch /* I Run-time architecture */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Copy and multiply a vector by a constant */
|
/* Copy and multiply a vector by a constant */
|
||||||
|
@ -358,8 +361,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 +511,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));
|
||||||
}
|
}
|
||||||
|
@ -576,11 +579,11 @@ static inline opus_int64 silk_max_64(opus_int64 a, opus_int64 b)
|
||||||
#include "MacroCount.h"
|
#include "MacroCount.h"
|
||||||
#include "MacroDebug.h"
|
#include "MacroDebug.h"
|
||||||
|
|
||||||
#ifdef ARMv4_ASM
|
#ifdef OPUS_ARM_INLINE_ASM
|
||||||
#include "arm/SigProc_FIX_armv4.h"
|
#include "arm/SigProc_FIX_armv4.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ARMv5E_ASM
|
#ifdef OPUS_ARM_INLINE_EDSP
|
||||||
#include "arm/SigProc_FIX_armv5e.h"
|
#include "arm/SigProc_FIX_armv5e.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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__(
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -92,6 +92,9 @@ typedef struct {
|
||||||
/* I: Opus encoder is allowing us to switch bandwidth */
|
/* I: Opus encoder is allowing us to switch bandwidth */
|
||||||
opus_int opusCanSwitch;
|
opus_int opusCanSwitch;
|
||||||
|
|
||||||
|
/* I: Make frames as independent as possible (but still use LPC) */
|
||||||
|
opus_int reducedDependency;
|
||||||
|
|
||||||
/* O: Internal sampling rate used, in Hertz; 8000/12000/16000 */
|
/* O: Internal sampling rate used, in Hertz; 8000/12000/16000 */
|
||||||
opus_int32 internalSampleRate;
|
opus_int32 internalSampleRate;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -305,7 +305,7 @@ opus_int silk_Decode( /* O Returns error co
|
||||||
|
|
||||||
/* Set up pointers to temp buffers */
|
/* Set up pointers to temp buffers */
|
||||||
ALLOC( samplesOut2_tmp,
|
ALLOC( samplesOut2_tmp,
|
||||||
decControl->nChannelsAPI == 2 ? *nSamplesOut : 0, opus_int16 );
|
decControl->nChannelsAPI == 2 ? *nSamplesOut : ALLOC_NONE, opus_int16 );
|
||||||
if( decControl->nChannelsAPI == 2 ) {
|
if( decControl->nChannelsAPI == 2 ) {
|
||||||
resample_out_ptr = samplesOut2_tmp;
|
resample_out_ptr = samplesOut2_tmp;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -41,7 +41,9 @@ opus_int32 silk_log2lin(
|
||||||
|
|
||||||
if( inLog_Q7 < 0 ) {
|
if( inLog_Q7 < 0 ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if ( inLog_Q7 >= 3967 ) {
|
||||||
|
return silk_int32_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
out = silk_LSHIFT( 1, silk_RSHIFT( inLog_Q7, 7 ) );
|
out = silk_LSHIFT( 1, silk_RSHIFT( inLog_Q7, 7 ) );
|
||||||
frac_Q7 = inLog_Q7 & 0x7F;
|
frac_Q7 = inLog_Q7 & 0x7F;
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -100,15 +103,15 @@ static inline opus_int32 silk_CLZ32(opus_int32 in32)
|
||||||
(*((Matrix_base_adr) + ((row)+(M)*(column))))
|
(*((Matrix_base_adr) + ((row)+(M)*(column))))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ARMv4_ASM
|
#ifdef OPUS_ARM_INLINE_ASM
|
||||||
#include "arm/macros_armv4.h"
|
#include "arm/macros_armv4.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ARMv5E_ASM
|
#ifdef OPUS_ARM_INLINE_EDSP
|
||||||
#include "arm/macros_armv5e.h"
|
#include "arm/macros_armv5e.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CF_ASM
|
#ifdef OPUS_CF_INLINE_ASM
|
||||||
#include "cf/macros_cf.h"
|
#include "cf/macros_cf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -204,6 +204,7 @@ void silk_quant_LTP_gains(
|
||||||
opus_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (un)quantized LTP gains */
|
opus_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (un)quantized LTP gains */
|
||||||
opus_int8 cbk_index[ MAX_NB_SUBFR ], /* O Codebook Index */
|
opus_int8 cbk_index[ MAX_NB_SUBFR ], /* O Codebook Index */
|
||||||
opus_int8 *periodicity_index, /* O Periodicity Index */
|
opus_int8 *periodicity_index, /* O Periodicity Index */
|
||||||
|
opus_int32 *sum_gain_dB_Q7, /* I/O Cumulative max prediction gain */
|
||||||
const opus_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ], /* I Error Weights in Q18 */
|
const opus_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ], /* I Error Weights in Q18 */
|
||||||
opus_int mu_Q9, /* I Mu value (R/D tradeoff) */
|
opus_int mu_Q9, /* I Mu value (R/D tradeoff) */
|
||||||
opus_int lowComplexity, /* I Flag for low complexity */
|
opus_int lowComplexity, /* I Flag for low complexity */
|
||||||
|
@ -214,11 +215,14 @@ void silk_quant_LTP_gains(
|
||||||
void silk_VQ_WMat_EC(
|
void silk_VQ_WMat_EC(
|
||||||
opus_int8 *ind, /* O index of best codebook vector */
|
opus_int8 *ind, /* O index of best codebook vector */
|
||||||
opus_int32 *rate_dist_Q14, /* O best weighted quant error + mu * rate */
|
opus_int32 *rate_dist_Q14, /* O best weighted quant error + mu * rate */
|
||||||
|
opus_int *gain_Q7, /* O sum of absolute LTP coefficients */
|
||||||
const opus_int16 *in_Q14, /* I input vector to be quantized */
|
const opus_int16 *in_Q14, /* I input vector to be quantized */
|
||||||
const opus_int32 *W_Q18, /* I weighting matrix */
|
const opus_int32 *W_Q18, /* I weighting matrix */
|
||||||
const opus_int8 *cb_Q7, /* I codebook */
|
const opus_int8 *cb_Q7, /* I codebook */
|
||||||
|
const opus_uint8 *cb_gain_Q7, /* I codebook effective gain */
|
||||||
const opus_uint8 *cl_Q5, /* I code length for each codebook vector */
|
const opus_uint8 *cl_Q5, /* I code length for each codebook vector */
|
||||||
const opus_int mu_Q9, /* I tradeoff betw. weighted error and rate */
|
const opus_int mu_Q9, /* I tradeoff betw. weighted error and rate */
|
||||||
|
const opus_int32 max_gain_Q7, /* I maximum sum of absolute LTP coefficients */
|
||||||
opus_int L /* I number of vectors in codebook */
|
opus_int L /* I number of vectors in codebook */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -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,
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -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,
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -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 */
|
||||||
|
@ -46,7 +46,7 @@ static inline void combine_pulses(
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
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 */
|
||||||
|
@ -59,7 +59,7 @@ static inline void encode_split(
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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 */
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -83,6 +83,7 @@ void silk_insertion_sort_increasing(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
/* This function is only used by the fixed-point build */
|
/* This function is only used by the fixed-point build */
|
||||||
|
@ -132,7 +133,6 @@ void silk_insertion_sort_decreasing_int16(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
void silk_insertion_sort_increasing_all_values_int16(
|
void silk_insertion_sort_increasing_all_values_int16(
|
||||||
opus_int16 *a, /* I/O Unsorted / Sorted vector */
|
opus_int16 *a, /* I/O Unsorted / Sorted vector */
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -171,6 +171,7 @@ typedef struct {
|
||||||
opus_int32 pitchEstimationThreshold_Q16; /* Threshold for pitch estimator */
|
opus_int32 pitchEstimationThreshold_Q16; /* Threshold for pitch estimator */
|
||||||
opus_int LTPQuantLowComplexity; /* Flag for low complexity LTP quantization */
|
opus_int LTPQuantLowComplexity; /* Flag for low complexity LTP quantization */
|
||||||
opus_int mu_LTP_Q9; /* Rate-distortion tradeoff in LTP quantization */
|
opus_int mu_LTP_Q9; /* Rate-distortion tradeoff in LTP quantization */
|
||||||
|
opus_int32 sum_log_gain_Q7; /* Cumulative max prediction gain */
|
||||||
opus_int NLSF_MSVQ_Survivors; /* Number of survivors in NLSF MSVQ */
|
opus_int NLSF_MSVQ_Survivors; /* Number of survivors in NLSF MSVQ */
|
||||||
opus_int first_frame_after_reset; /* Flag for deactivating NLSF interpolation, pitch prediction */
|
opus_int first_frame_after_reset; /* Flag for deactivating NLSF interpolation, pitch prediction */
|
||||||
opus_int controlled_since_last_payload; /* Flag for ensuring codec_control only runs once per packet */
|
opus_int controlled_since_last_payload; /* Flag for ensuring codec_control only runs once per packet */
|
||||||
|
@ -191,6 +192,8 @@ typedef struct {
|
||||||
SideInfoIndices indices;
|
SideInfoIndices indices;
|
||||||
opus_int8 pulses[ MAX_FRAME_LENGTH ];
|
opus_int8 pulses[ MAX_FRAME_LENGTH ];
|
||||||
|
|
||||||
|
int arch;
|
||||||
|
|
||||||
/* Input/output buffering */
|
/* Input/output buffering */
|
||||||
opus_int16 inputBuf[ MAX_FRAME_LENGTH + 2 ]; /* Buffer containing input signal */
|
opus_int16 inputBuf[ MAX_FRAME_LENGTH + 2 ]; /* Buffer containing input signal */
|
||||||
opus_int inputBufIx;
|
opus_int inputBufIx;
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -78,6 +78,8 @@ extern const opus_uint8 * const silk_LTP_gain_iCDF_ptrs[ NB_LTP_CBKS ];
|
||||||
extern const opus_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[ NB_LTP_CBKS ]; /* 3 */
|
extern const opus_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[ NB_LTP_CBKS ]; /* 3 */
|
||||||
extern const opus_int16 silk_LTP_gain_middle_avg_RD_Q14;
|
extern const opus_int16 silk_LTP_gain_middle_avg_RD_Q14;
|
||||||
extern const opus_int8 * const silk_LTP_vq_ptrs_Q7[ NB_LTP_CBKS ]; /* 168 */
|
extern const opus_int8 * const silk_LTP_vq_ptrs_Q7[ NB_LTP_CBKS ]; /* 168 */
|
||||||
|
extern const opus_uint8 * const silk_LTP_vq_gain_ptrs_Q7[NB_LTP_CBKS];
|
||||||
|
|
||||||
extern const opus_int8 silk_LTP_vq_sizes[ NB_LTP_CBKS ]; /* 3 */
|
extern const opus_int8 silk_LTP_vq_sizes[ NB_LTP_CBKS ]; /* 3 */
|
||||||
|
|
||||||
extern const opus_uint8 silk_LTPscale_iCDF[ 3 ]; /* 4 */
|
extern const opus_uint8 silk_LTPscale_iCDF[ 3 ]; /* 4 */
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -51,6 +51,7 @@ static const opus_uint8 silk_LTP_gain_iCDF_2[32] = {
|
||||||
24, 20, 16, 12, 9, 5, 2, 0
|
24, 20, 16, 12, 9, 5, 2, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
const opus_int16 silk_LTP_gain_middle_avg_RD_Q14 = 12304;
|
const opus_int16 silk_LTP_gain_middle_avg_RD_Q14 = 12304;
|
||||||
|
|
||||||
static const opus_uint8 silk_LTP_gain_BITS_Q5_0[8] = {
|
static const opus_uint8 silk_LTP_gain_BITS_Q5_0[8] = {
|
||||||
|
@ -68,6 +69,7 @@ static const opus_uint8 silk_LTP_gain_BITS_Q5_2[32] = {
|
||||||
160, 160, 166, 166, 173, 173, 182, 192,
|
160, 160, 166, 166, 173, 173, 182, 192,
|
||||||
182, 192, 192, 192, 205, 192, 205, 224
|
182, 192, 192, 192, 205, 192, 205, 224
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
const opus_uint8 * const silk_LTP_gain_iCDF_ptrs[NB_LTP_CBKS] = {
|
const opus_uint8 * const silk_LTP_gain_iCDF_ptrs[NB_LTP_CBKS] = {
|
||||||
silk_LTP_gain_iCDF_0,
|
silk_LTP_gain_iCDF_0,
|
||||||
|
@ -75,11 +77,13 @@ const opus_uint8 * const silk_LTP_gain_iCDF_ptrs[NB_LTP_CBKS] = {
|
||||||
silk_LTP_gain_iCDF_2
|
silk_LTP_gain_iCDF_2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
const opus_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[NB_LTP_CBKS] = {
|
const opus_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[NB_LTP_CBKS] = {
|
||||||
silk_LTP_gain_BITS_Q5_0,
|
silk_LTP_gain_BITS_Q5_0,
|
||||||
silk_LTP_gain_BITS_Q5_1,
|
silk_LTP_gain_BITS_Q5_1,
|
||||||
silk_LTP_gain_BITS_Q5_2
|
silk_LTP_gain_BITS_Q5_2
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static const opus_int8 silk_LTP_gain_vq_0[8][5] =
|
static const opus_int8 silk_LTP_gain_vq_0[8][5] =
|
||||||
{
|
{
|
||||||
|
@ -267,6 +271,32 @@ const opus_int8 * const silk_LTP_vq_ptrs_Q7[NB_LTP_CBKS] = {
|
||||||
(opus_int8 *)&silk_LTP_gain_vq_2[0][0]
|
(opus_int8 *)&silk_LTP_gain_vq_2[0][0]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* Maximum frequency-dependent response of the pitch taps above,
|
||||||
|
computed as max(abs(freqz(taps))) */
|
||||||
|
static const opus_uint8 silk_LTP_gain_vq_0_gain[8] = {
|
||||||
|
46, 2, 90, 87, 93, 91, 82, 98
|
||||||
|
};
|
||||||
|
|
||||||
|
static const opus_uint8 silk_LTP_gain_vq_1_gain[16] = {
|
||||||
|
109, 120, 118, 12, 113, 115, 117, 119,
|
||||||
|
99, 59, 87, 111, 63, 111, 112, 80
|
||||||
|
};
|
||||||
|
|
||||||
|
static const opus_uint8 silk_LTP_gain_vq_2_gain[32] = {
|
||||||
|
126, 124, 125, 124, 129, 121, 126, 23,
|
||||||
|
132, 127, 127, 127, 126, 127, 122, 133,
|
||||||
|
130, 134, 101, 118, 119, 145, 126, 86,
|
||||||
|
124, 120, 123, 119, 170, 173, 107, 109
|
||||||
|
};
|
||||||
|
|
||||||
|
const opus_uint8 * const silk_LTP_vq_gain_ptrs_Q7[NB_LTP_CBKS] = {
|
||||||
|
&silk_LTP_gain_vq_0_gain[0],
|
||||||
|
&silk_LTP_gain_vq_1_gain[0],
|
||||||
|
&silk_LTP_gain_vq_2_gain[0]
|
||||||
|
};
|
||||||
|
|
||||||
const opus_int8 silk_LTP_vq_sizes[NB_LTP_CBKS] = {
|
const opus_int8 silk_LTP_vq_sizes[NB_LTP_CBKS] = {
|
||||||
8, 16, 32
|
8, 16, 32
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
|
@ -8,7 +8,7 @@ this list of conditions and the following disclaimer.
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
names of specific contributors, may be used to endorse or promote
|
names of specific contributors, may be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
@ -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();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue