Convert all CRLF in the SILK code, tabs to spaces, and trailing

whitespace.
This commit is contained in:
Gregory Maxwell 2011-07-30 08:18:48 -04:00 committed by Jean-Marc Valin
parent 71d39ad841
commit ae2311455b
165 changed files with 25431 additions and 25432 deletions

View file

@ -61,7 +61,7 @@ void silk_LTP_analysis_filter_FIX(
LTP_est = SKP_SMULBB( x_lag_ptr[ LTP_ORDER / 2 ], Btmp_Q14[ 0 ] );
for( j = 1; j < LTP_ORDER; j++ ) {
LTP_est = SKP_SMLABB_ovflw( LTP_est, x_lag_ptr[ LTP_ORDER / 2 - j ], Btmp_Q14[ j ] );
}
}
LTP_est = SKP_RSHIFT_ROUND( LTP_est, 14 ); // round and -> Q0
/* Subtract long-term prediction */

View file

@ -128,7 +128,7 @@ SKP_INLINE void limit_warped_coefs(
coefs_ana_Q24[ i ] = SKP_SMULWW( gain_ana_Q16, coefs_ana_Q24[ i ] );
}
}
SKP_assert( 0 );
SKP_assert( 0 );
}
/**************************************************************/

View file

@ -43,15 +43,15 @@ extern "C"
/* Chirp (bw expand) LP AR filter */
void silk_bwexpander_FLP(
SKP_float *ar, /* io AR filter to be expanded (without leading 1) */
const opus_int d, /* i length of ar */
const SKP_float chirp /* i chirp factor (typically in range (0..1) ) */
const opus_int d, /* i length of ar */
const SKP_float chirp /* i chirp factor (typically in range (0..1) ) */
);
/* compute inverse of LPC prediction gain, and */
/* test if LPC coefficients are stable (all poles within unit circle) */
/* this code is based on silk_FLP_a2k() */
/* compute inverse of LPC prediction gain, and */
/* test if LPC coefficients are stable (all poles within unit circle) */
/* this code is based on silk_FLP_a2k() */
opus_int silk_LPC_inverse_pred_gain_FLP( /* O: returns 1 if unstable, otherwise 0 */
SKP_float *invGain, /* O: inverse prediction gain, energy domain */
SKP_float *invGain, /* O: inverse prediction gain, energy domain */
const SKP_float *A, /* I: prediction coefficients [order] */
opus_int32 order /* I: prediction order */
);
@ -63,16 +63,16 @@ SKP_float silk_schur_FLP( /* O returns residual energy
);
void silk_k2a_FLP(
SKP_float *A, /* O: prediction coefficients [order] */
const SKP_float *rc, /* I: reflection coefficients [order] */
opus_int32 order /* I: prediction order */
SKP_float *A, /* O: prediction coefficients [order] */
const SKP_float *rc, /* I: reflection coefficients [order] */
opus_int32 order /* I: prediction order */
);
/* Solve the normal equations using the Levinson-Durbin recursion */
SKP_float silk_levinsondurbin_FLP( /* O prediction error energy */
SKP_float A[], /* O prediction coefficients [order] */
const SKP_float corr[], /* I input auto-correlations [order + 1] */
const opus_int order /* I prediction order */
SKP_float silk_levinsondurbin_FLP( /* O prediction error energy */
SKP_float A[], /* O prediction coefficients [order] */
const SKP_float corr[], /* I input auto-correlations [order + 1] */
const opus_int order /* I prediction order */
);
/* compute autocorrelation */
@ -153,12 +153,12 @@ double silk_energy_FLP(
/* MACROS */
/********************************************************************/
#define SKP_min_float(a, b) (((a) < (b)) ? (a) : (b))
#define SKP_max_float(a, b) (((a) > (b)) ? (a) : (b))
#define SKP_abs_float(a) ((SKP_float)fabs(a))
#define SKP_min_float(a, b) (((a) < (b)) ? (a) : (b))
#define SKP_max_float(a, b) (((a) > (b)) ? (a) : (b))
#define SKP_abs_float(a) ((SKP_float)fabs(a))
#define SKP_LIMIT_float( a, limit1, limit2) ((limit1) > (limit2) ? ((a) > (limit1) ? (limit1) : ((a) < (limit2) ? (limit2) : (a))) \
: ((a) > (limit2) ? (limit2) : ((a) < (limit1) ? (limit1) : (a))))
#define SKP_LIMIT_float( a, limit1, limit2) ((limit1) > (limit2) ? ((a) > (limit1) ? (limit1) : ((a) < (limit2) ? (limit2) : (a))) \
: ((a) > (limit2) ? (limit2) : ((a) < (limit1) ? (limit1) : (a))))
/* sigmoid function */
SKP_INLINE SKP_float SKP_sigmoid(SKP_float x)
@ -170,10 +170,10 @@ SKP_INLINE SKP_float SKP_sigmoid(SKP_float x)
SKP_INLINE opus_int32 SKP_float2int(double x)
{
#ifdef _WIN32
double t = x + 6755399441055744.0;
return *((opus_int32 *)( &t ));
double t = x + 6755399441055744.0;
return *((opus_int32 *)( &t ));
#else
return (opus_int32)( ( x > 0 ) ? x + 0.5 : x - 0.5 );
return (opus_int32)( ( x > 0 ) ? x + 0.5 : x - 0.5 );
#endif
}
@ -187,11 +187,11 @@ SKP_INLINE void SKP_float2short_array(
opus_int32 k;
for (k = length-1; k >= 0; k--) {
#ifdef _WIN32
double t = in[k] + 6755399441055744.0;
out[k] = (opus_int16)SKP_SAT16(*(( opus_int32 * )( &t )));
double t = in[k] + 6755399441055744.0;
out[k] = (opus_int16)SKP_SAT16(*(( opus_int32 * )( &t )));
#else
double x = in[k];
out[k] = (opus_int16)SKP_SAT16( ( x > 0 ) ? x + 0.5 : x - 0.5 );
double x = in[k];
out[k] = (opus_int16)SKP_SAT16( ( x > 0 ) ? x + 0.5 : x - 0.5 );
#endif
}
}

View file

@ -60,8 +60,8 @@ void silk_find_pred_coefs_FLP(
psEncCtrl->pitchL, Wght, psEnc->sCmn.subfr_length, psEnc->sCmn.nb_subfr, psEnc->sCmn.ltp_mem_length );
#ifdef SAVE_ALL_INTERNAL_DATA
DEBUG_STORE_DATA( ltp_gains.dat, psEncCtrl->LTPCoef, sizeof( psEncCtrl->LTPCoef ) );
DEBUG_STORE_DATA( ltp_weights.dat, WLTP, sizeof( WLTP ) );
DEBUG_STORE_DATA( ltp_gains.dat, psEncCtrl->LTPCoef, sizeof( psEncCtrl->LTPCoef ) );
DEBUG_STORE_DATA( ltp_weights.dat, WLTP, sizeof( WLTP ) );
#endif
/* Quantize LTP gain parameters */

View file

@ -115,7 +115,7 @@ SKP_INLINE void warped_true2monic_coefs(
coefs_ana[ i ] *= gain_ana;
}
}
SKP_assert( 0 );
SKP_assert( 0 );
}
/* Compute noise shaping coefficients and initial gain values */

View file

@ -151,14 +151,14 @@ void silk_prefilter_FLP(
*/
SKP_INLINE void silk_prefilt_FLP(
silk_prefilter_state_FLP *P,/* I/O state */
SKP_float st_res[], /* I */
SKP_float xw[], /* O */
SKP_float *HarmShapeFIR, /* I */
SKP_float Tilt, /* I */
SKP_float LF_MA_shp, /* I */
SKP_float LF_AR_shp, /* I */
opus_int lag, /* I */
opus_int length /* I */
SKP_float st_res[], /* I */
SKP_float xw[], /* O */
SKP_float *HarmShapeFIR, /* I */
SKP_float Tilt, /* I */
SKP_float LF_MA_shp, /* I */
SKP_float LF_AR_shp, /* I */
opus_int lag, /* I */
opus_int length /* I */
)
{
opus_int i;

View file

@ -83,30 +83,30 @@ typedef struct {
/************************/
typedef struct {
/* Prediction and coding parameters */
SKP_float Gains[ MAX_NB_SUBFR ];
SKP_float PredCoef[ 2 ][ MAX_LPC_ORDER ]; /* holds interpolated and final coefficients */
SKP_float LTPCoef[LTP_ORDER * MAX_NB_SUBFR];
SKP_float LTP_scale;
SKP_float Gains[ MAX_NB_SUBFR ];
SKP_float PredCoef[ 2 ][ MAX_LPC_ORDER ]; /* holds interpolated and final coefficients */
SKP_float LTPCoef[LTP_ORDER * MAX_NB_SUBFR];
SKP_float LTP_scale;
opus_int pitchL[ MAX_NB_SUBFR ];
/* Noise shaping parameters */
SKP_float AR1[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ];
SKP_float AR2[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ];
SKP_float LF_MA_shp[ MAX_NB_SUBFR ];
SKP_float LF_AR_shp[ MAX_NB_SUBFR ];
SKP_float GainsPre[ MAX_NB_SUBFR ];
SKP_float HarmBoost[ MAX_NB_SUBFR ];
SKP_float Tilt[ MAX_NB_SUBFR ];
SKP_float HarmShapeGain[ MAX_NB_SUBFR ];
SKP_float Lambda;
SKP_float input_quality;
SKP_float coding_quality;
SKP_float AR1[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ];
SKP_float AR2[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ];
SKP_float LF_MA_shp[ MAX_NB_SUBFR ];
SKP_float LF_AR_shp[ MAX_NB_SUBFR ];
SKP_float GainsPre[ MAX_NB_SUBFR ];
SKP_float HarmBoost[ MAX_NB_SUBFR ];
SKP_float Tilt[ MAX_NB_SUBFR ];
SKP_float HarmShapeGain[ MAX_NB_SUBFR ];
SKP_float Lambda;
SKP_float input_quality;
SKP_float coding_quality;
/* Measures */
SKP_float sparseness;
/* Measures */
SKP_float sparseness;
SKP_float predGain;
SKP_float LTPredCodGain;
SKP_float ResNrg[ MAX_NB_SUBFR ]; /* Residual energy per subframe */
SKP_float LTPredCodGain;
SKP_float ResNrg[ MAX_NB_SUBFR ]; /* Residual energy per subframe */
} silk_encoder_control_FLP;
/************************/

View file

@ -78,8 +78,8 @@ opus_int silk_QueryEncoder( /* O: Returns error c
/**************************/
/* Encode frame with Silk */
/**************************/
/* Note: if prefillFlag is set, the input must contain 10 ms of audio, irrespective of what */
/* encControl->payloadSize_ms is set to */
/* Note: if prefillFlag is set, the input must contain 10 ms of audio, irrespective of what */
/* encControl->payloadSize_ms is set to */
opus_int silk_Encode( /* O: Returns error code */
void *encState, /* I/O: State */
silk_EncControlStruct *encControl, /* I: Control status */

View file

@ -29,138 +29,138 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define _SIGPROCFIX_API_MACROCOUNT_H_
#include <stdio.h>
#ifdef SKP_MACRO_COUNT
#ifdef SKP_MACRO_COUNT
#define varDefine opus_int64 ops_count = 0;
extern opus_int64 ops_count;
SKP_INLINE opus_int64 SKP_SaveCount(){
return(ops_count);
return(ops_count);
}
SKP_INLINE opus_int64 SKP_SaveResetCount(){
opus_int64 ret;
opus_int64 ret;
ret = ops_count;
ops_count = 0;
return(ret);
ret = ops_count;
ops_count = 0;
return(ret);
}
SKP_INLINE SKP_PrintCount(){
printf("ops_count = %d \n ", (opus_int32)ops_count);
printf("ops_count = %d \n ", (opus_int32)ops_count);
}
#undef SKP_MUL
SKP_INLINE opus_int32 SKP_MUL(opus_int32 a32, opus_int32 b32){
opus_int32 ret;
ops_count += 4;
ret = a32 * b32;
return ret;
opus_int32 ret;
ops_count += 4;
ret = a32 * b32;
return ret;
}
#undef SKP_MUL_uint
SKP_INLINE opus_uint32 SKP_MUL_uint(opus_uint32 a32, opus_uint32 b32){
opus_uint32 ret;
ops_count += 4;
ret = a32 * b32;
return ret;
opus_uint32 ret;
ops_count += 4;
ret = a32 * b32;
return ret;
}
#undef SKP_MLA
SKP_INLINE opus_int32 SKP_MLA(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
ops_count += 4;
ret = a32 + b32 * c32;
return ret;
opus_int32 ret;
ops_count += 4;
ret = a32 + b32 * c32;
return ret;
}
#undef SKP_MLA_uint
SKP_INLINE opus_int32 SKP_MLA_uint(opus_uint32 a32, opus_uint32 b32, opus_uint32 c32){
opus_uint32 ret;
ops_count += 4;
ret = a32 + b32 * c32;
return ret;
opus_uint32 ret;
ops_count += 4;
ret = a32 + b32 * c32;
return ret;
}
#undef SKP_SMULWB
SKP_INLINE opus_int32 SKP_SMULWB(opus_int32 a32, opus_int32 b32){
opus_int32 ret;
ops_count += 5;
ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16);
return ret;
opus_int32 ret;
ops_count += 5;
ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16);
return ret;
}
#undef SKP_SMLAWB
#undef SKP_SMLAWB
SKP_INLINE opus_int32 SKP_SMLAWB(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
ops_count += 5;
ret = ((a32) + ((((b32) >> 16) * (opus_int32)((opus_int16)(c32))) + ((((b32) & 0x0000FFFF) * (opus_int32)((opus_int16)(c32))) >> 16)));
return ret;
opus_int32 ret;
ops_count += 5;
ret = ((a32) + ((((b32) >> 16) * (opus_int32)((opus_int16)(c32))) + ((((b32) & 0x0000FFFF) * (opus_int32)((opus_int16)(c32))) >> 16)));
return ret;
}
#undef SKP_SMULWT
SKP_INLINE opus_int32 SKP_SMULWT(opus_int32 a32, opus_int32 b32){
opus_int32 ret;
ops_count += 4;
ret = (a32 >> 16) * (b32 >> 16) + (((a32 & 0x0000FFFF) * (b32 >> 16)) >> 16);
return ret;
opus_int32 ret;
ops_count += 4;
ret = (a32 >> 16) * (b32 >> 16) + (((a32 & 0x0000FFFF) * (b32 >> 16)) >> 16);
return ret;
}
#undef SKP_SMLAWT
SKP_INLINE opus_int32 SKP_SMLAWT(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
ops_count += 4;
ret = a32 + ((b32 >> 16) * (c32 >> 16)) + (((b32 & 0x0000FFFF) * ((c32 >> 16)) >> 16));
return ret;
opus_int32 ret;
ops_count += 4;
ret = a32 + ((b32 >> 16) * (c32 >> 16)) + (((b32 & 0x0000FFFF) * ((c32 >> 16)) >> 16));
return ret;
}
#undef SKP_SMULBB
SKP_INLINE opus_int32 SKP_SMULBB(opus_int32 a32, opus_int32 b32){
opus_int32 ret;
ops_count += 1;
ret = (opus_int32)((opus_int16)a32) * (opus_int32)((opus_int16)b32);
return ret;
opus_int32 ret;
ops_count += 1;
ret = (opus_int32)((opus_int16)a32) * (opus_int32)((opus_int16)b32);
return ret;
}
#undef SKP_SMLABB
SKP_INLINE opus_int32 SKP_SMLABB(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
ops_count += 1;
ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32);
return ret;
opus_int32 ret;
ops_count += 1;
ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32);
return ret;
}
#undef SKP_SMULBT
SKP_INLINE opus_int32 SKP_SMULBT(opus_int32 a32, opus_int32 b32 ){
opus_int32 ret;
ops_count += 4;
ret = ((opus_int32)((opus_int16)a32)) * (b32 >> 16);
return ret;
opus_int32 ret;
ops_count += 4;
ret = ((opus_int32)((opus_int16)a32)) * (b32 >> 16);
return ret;
}
#undef SKP_SMLABT
SKP_INLINE opus_int32 SKP_SMLABT(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
ops_count += 1;
ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16);
return ret;
opus_int32 ret;
ops_count += 1;
ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16);
return ret;
}
#undef SKP_SMULTT
SKP_INLINE opus_int32 SKP_SMULTT(opus_int32 a32, opus_int32 b32){
opus_int32 ret;
ops_count += 1;
ret = (a32 >> 16) * (b32 >> 16);
return ret;
opus_int32 ret;
ops_count += 1;
ret = (a32 >> 16) * (b32 >> 16);
return ret;
}
#undef SKP_SMLATT
#undef SKP_SMLATT
SKP_INLINE opus_int32 SKP_SMLATT(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
ops_count += 1;
ret = a32 + (b32 >> 16) * (c32 >> 16);
return ret;
opus_int32 ret;
ops_count += 1;
ret = a32 + (b32 >> 16) * (c32 >> 16);
return ret;
}
// multiply-accumulate macros that allow overflow in the addition (ie, no asserts in debug mode)
#undef SKP_MLA_ovflw
#undef SKP_MLA_ovflw
#define SKP_MLA_ovflw SKP_MLA
#undef SKP_SMLABB_ovflw
@ -180,32 +180,32 @@ SKP_INLINE opus_int32 SKP_SMLATT(opus_int32 a32, opus_int32 b32, opus_int32 c32)
#undef SKP_SMULL
SKP_INLINE opus_int64 SKP_SMULL(opus_int32 a32, opus_int32 b32){
opus_int64 ret;
ops_count += 8;
ret = ((opus_int64)(a32) * /*(opus_int64)*/(b32));
return ret;
opus_int64 ret;
ops_count += 8;
ret = ((opus_int64)(a32) * /*(opus_int64)*/(b32));
return ret;
}
#undef SKP_SMLAL
#undef SKP_SMLAL
SKP_INLINE opus_int64 SKP_SMLAL(opus_int64 a64, opus_int32 b32, opus_int32 c32){
opus_int64 ret;
ops_count += 8;
ret = a64 + ((opus_int64)(b32) * /*(opus_int64)*/(c32));
return ret;
opus_int64 ret;
ops_count += 8;
ret = a64 + ((opus_int64)(b32) * /*(opus_int64)*/(c32));
return ret;
}
#undef SKP_SMLALBB
#undef SKP_SMLALBB
SKP_INLINE opus_int64 SKP_SMLALBB(opus_int64 a64, opus_int16 b16, opus_int16 c16){
opus_int64 ret;
ops_count += 4;
ret = a64 + ((opus_int64)(b16) * /*(opus_int64)*/(c16));
return ret;
opus_int64 ret;
ops_count += 4;
ret = a64 + ((opus_int64)(b16) * /*(opus_int64)*/(c16));
return ret;
}
#undef SigProcFIX_CLZ16
#undef SigProcFIX_CLZ16
SKP_INLINE opus_int32 SigProcFIX_CLZ16(opus_int16 in16)
{
opus_int32 out32 = 0;
ops_count += 10;
ops_count += 10;
if( in16 == 0 ) {
return 16;
}
@ -243,7 +243,7 @@ SKP_INLINE opus_int32 SigProcFIX_CLZ16(opus_int16 in16)
SKP_INLINE opus_int32 SigProcFIX_CLZ32(opus_int32 in32)
{
/* test highest 16 bits and convert to opus_int16 */
ops_count += 2;
ops_count += 2;
if( in32 & 0xFFFF0000 ) {
return SigProcFIX_CLZ16((opus_int16)(in32 >> 16));
} else {
@ -253,419 +253,419 @@ SKP_INLINE opus_int32 SigProcFIX_CLZ32(opus_int32 in32)
#undef SKP_DIV32
SKP_INLINE opus_int32 SKP_DIV32(opus_int32 a32, opus_int32 b32){
ops_count += 64;
return a32 / b32;
ops_count += 64;
return a32 / b32;
}
#undef SKP_DIV32_16
SKP_INLINE opus_int32 SKP_DIV32_16(opus_int32 a32, opus_int32 b32){
ops_count += 32;
return a32 / b32;
ops_count += 32;
return a32 / b32;
}
#undef SKP_SAT8
SKP_INLINE opus_int8 SKP_SAT8(opus_int64 a){
opus_int8 tmp;
ops_count += 1;
tmp = (opus_int8)((a) > SKP_int8_MAX ? SKP_int8_MAX : \
opus_int8 tmp;
ops_count += 1;
tmp = (opus_int8)((a) > SKP_int8_MAX ? SKP_int8_MAX : \
((a) < SKP_int8_MIN ? SKP_int8_MIN : (a)));
return(tmp);
return(tmp);
}
#undef SKP_SAT16
SKP_INLINE opus_int16 SKP_SAT16(opus_int64 a){
opus_int16 tmp;
ops_count += 1;
tmp = (opus_int16)((a) > SKP_int16_MAX ? SKP_int16_MAX : \
opus_int16 tmp;
ops_count += 1;
tmp = (opus_int16)((a) > SKP_int16_MAX ? SKP_int16_MAX : \
((a) < SKP_int16_MIN ? SKP_int16_MIN : (a)));
return(tmp);
return(tmp);
}
#undef SKP_SAT32
SKP_INLINE opus_int32 SKP_SAT32(opus_int64 a){
opus_int32 tmp;
ops_count += 1;
tmp = (opus_int32)((a) > SKP_int32_MAX ? SKP_int32_MAX : \
opus_int32 tmp;
ops_count += 1;
tmp = (opus_int32)((a) > SKP_int32_MAX ? SKP_int32_MAX : \
((a) < SKP_int32_MIN ? SKP_int32_MIN : (a)));
return(tmp);
return(tmp);
}
#undef SKP_POS_SAT32
SKP_INLINE opus_int32 SKP_POS_SAT32(opus_int64 a){
opus_int32 tmp;
ops_count += 1;
tmp = (opus_int32)((a) > SKP_int32_MAX ? SKP_int32_MAX : (a));
return(tmp);
opus_int32 tmp;
ops_count += 1;
tmp = (opus_int32)((a) > SKP_int32_MAX ? SKP_int32_MAX : (a));
return(tmp);
}
#undef SKP_ADD_POS_SAT8
SKP_INLINE opus_int8 SKP_ADD_POS_SAT8(opus_int64 a, opus_int64 b){
opus_int8 tmp;
ops_count += 1;
tmp = (opus_int8)((((a)+(b)) & 0x80) ? SKP_int8_MAX : ((a)+(b)));
return(tmp);
opus_int8 tmp;
ops_count += 1;
tmp = (opus_int8)((((a)+(b)) & 0x80) ? SKP_int8_MAX : ((a)+(b)));
return(tmp);
}
#undef SKP_ADD_POS_SAT16
SKP_INLINE opus_int16 SKP_ADD_POS_SAT16(opus_int64 a, opus_int64 b){
opus_int16 tmp;
ops_count += 1;
tmp = (opus_int16)((((a)+(b)) & 0x8000) ? SKP_int16_MAX : ((a)+(b)));
return(tmp);
opus_int16 tmp;
ops_count += 1;
tmp = (opus_int16)((((a)+(b)) & 0x8000) ? SKP_int16_MAX : ((a)+(b)));
return(tmp);
}
#undef SKP_ADD_POS_SAT32
SKP_INLINE opus_int32 SKP_ADD_POS_SAT32(opus_int64 a, opus_int64 b){
opus_int32 tmp;
ops_count += 1;
tmp = (opus_int32)((((a)+(b)) & 0x80000000) ? SKP_int32_MAX : ((a)+(b)));
return(tmp);
opus_int32 tmp;
ops_count += 1;
tmp = (opus_int32)((((a)+(b)) & 0x80000000) ? SKP_int32_MAX : ((a)+(b)));
return(tmp);
}
#undef SKP_ADD_POS_SAT64
SKP_INLINE opus_int64 SKP_ADD_POS_SAT64(opus_int64 a, opus_int64 b){
opus_int64 tmp;
ops_count += 1;
tmp = ((((a)+(b)) & 0x8000000000000000LL) ? SKP_int64_MAX : ((a)+(b)));
return(tmp);
opus_int64 tmp;
ops_count += 1;
tmp = ((((a)+(b)) & 0x8000000000000000LL) ? SKP_int64_MAX : ((a)+(b)));
return(tmp);
}
#undef SKP_LSHIFT8
#undef SKP_LSHIFT8
SKP_INLINE opus_int8 SKP_LSHIFT8(opus_int8 a, opus_int32 shift){
opus_int8 ret;
ops_count += 1;
ret = a << shift;
return ret;
opus_int8 ret;
ops_count += 1;
ret = a << shift;
return ret;
}
#undef SKP_LSHIFT16
#undef SKP_LSHIFT16
SKP_INLINE opus_int16 SKP_LSHIFT16(opus_int16 a, opus_int32 shift){
opus_int16 ret;
ops_count += 1;
ret = a << shift;
return ret;
opus_int16 ret;
ops_count += 1;
ret = a << shift;
return ret;
}
#undef SKP_LSHIFT32
#undef SKP_LSHIFT32
SKP_INLINE opus_int32 SKP_LSHIFT32(opus_int32 a, opus_int32 shift){
opus_int32 ret;
ops_count += 1;
ret = a << shift;
return ret;
opus_int32 ret;
ops_count += 1;
ret = a << shift;
return ret;
}
#undef SKP_LSHIFT64
#undef SKP_LSHIFT64
SKP_INLINE opus_int64 SKP_LSHIFT64(opus_int64 a, opus_int shift){
ops_count += 1;
return a << shift;
ops_count += 1;
return a << shift;
}
#undef SKP_LSHIFT_ovflw
#undef SKP_LSHIFT_ovflw
SKP_INLINE opus_int32 SKP_LSHIFT_ovflw(opus_int32 a, opus_int32 shift){
ops_count += 1;
return a << shift;
ops_count += 1;
return a << shift;
}
#undef SKP_LSHIFT_uint
#undef SKP_LSHIFT_uint
SKP_INLINE opus_uint32 SKP_LSHIFT_uint(opus_uint32 a, opus_int32 shift){
opus_uint32 ret;
ops_count += 1;
ret = a << shift;
return ret;
opus_uint32 ret;
ops_count += 1;
ret = a << shift;
return ret;
}
#undef SKP_RSHIFT8
#undef SKP_RSHIFT8
SKP_INLINE opus_int8 SKP_RSHIFT8(opus_int8 a, opus_int32 shift){
ops_count += 1;
return a >> shift;
ops_count += 1;
return a >> shift;
}
#undef SKP_RSHIFT16
#undef SKP_RSHIFT16
SKP_INLINE opus_int16 SKP_RSHIFT16(opus_int16 a, opus_int32 shift){
ops_count += 1;
return a >> shift;
ops_count += 1;
return a >> shift;
}
#undef SKP_RSHIFT32
#undef SKP_RSHIFT32
SKP_INLINE opus_int32 SKP_RSHIFT32(opus_int32 a, opus_int32 shift){
ops_count += 1;
return a >> shift;
ops_count += 1;
return a >> shift;
}
#undef SKP_RSHIFT64
#undef SKP_RSHIFT64
SKP_INLINE opus_int64 SKP_RSHIFT64(opus_int64 a, opus_int64 shift){
ops_count += 1;
return a >> shift;
ops_count += 1;
return a >> shift;
}
#undef SKP_RSHIFT_uint
#undef SKP_RSHIFT_uint
SKP_INLINE opus_uint32 SKP_RSHIFT_uint(opus_uint32 a, opus_int32 shift){
ops_count += 1;
return a >> shift;
ops_count += 1;
return a >> shift;
}
#undef SKP_ADD_LSHIFT
#undef SKP_ADD_LSHIFT
SKP_INLINE opus_int32 SKP_ADD_LSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret;
ops_count += 1;
ret = a + (b << shift);
return ret; // shift >= 0
opus_int32 ret;
ops_count += 1;
ret = a + (b << shift);
return ret; // shift >= 0
}
#undef SKP_ADD_LSHIFT32
#undef SKP_ADD_LSHIFT32
SKP_INLINE opus_int32 SKP_ADD_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret;
ops_count += 1;
ret = a + (b << shift);
return ret; // shift >= 0
opus_int32 ret;
ops_count += 1;
ret = a + (b << shift);
return ret; // shift >= 0
}
#undef SKP_ADD_LSHIFT_uint
#undef SKP_ADD_LSHIFT_uint
SKP_INLINE opus_uint32 SKP_ADD_LSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){
opus_uint32 ret;
ops_count += 1;
ret = a + (b << shift);
return ret; // shift >= 0
opus_uint32 ret;
ops_count += 1;
ret = a + (b << shift);
return ret; // shift >= 0
}
#undef SKP_ADD_RSHIFT
#undef SKP_ADD_RSHIFT
SKP_INLINE opus_int32 SKP_ADD_RSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret;
ops_count += 1;
ret = a + (b >> shift);
return ret; // shift > 0
opus_int32 ret;
ops_count += 1;
ret = a + (b >> shift);
return ret; // shift > 0
}
#undef SKP_ADD_RSHIFT32
#undef SKP_ADD_RSHIFT32
SKP_INLINE opus_int32 SKP_ADD_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret;
ops_count += 1;
ret = a + (b >> shift);
return ret; // shift > 0
opus_int32 ret;
ops_count += 1;
ret = a + (b >> shift);
return ret; // shift > 0
}
#undef SKP_ADD_RSHIFT_uint
#undef SKP_ADD_RSHIFT_uint
SKP_INLINE opus_uint32 SKP_ADD_RSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){
opus_uint32 ret;
ops_count += 1;
ret = a + (b >> shift);
return ret; // shift > 0
opus_uint32 ret;
ops_count += 1;
ret = a + (b >> shift);
return ret; // shift > 0
}
#undef SKP_SUB_LSHIFT32
#undef SKP_SUB_LSHIFT32
SKP_INLINE opus_int32 SKP_SUB_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret;
ops_count += 1;
ret = a - (b << shift);
return ret; // shift >= 0
opus_int32 ret;
ops_count += 1;
ret = a - (b << shift);
return ret; // shift >= 0
}
#undef SKP_SUB_RSHIFT32
#undef SKP_SUB_RSHIFT32
SKP_INLINE opus_int32 SKP_SUB_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret;
ops_count += 1;
ret = a - (b >> shift);
return ret; // shift > 0
opus_int32 ret;
ops_count += 1;
ret = a - (b >> shift);
return ret; // shift > 0
}
#undef SKP_RSHIFT_ROUND
#undef SKP_RSHIFT_ROUND
SKP_INLINE opus_int32 SKP_RSHIFT_ROUND(opus_int32 a, opus_int32 shift){
opus_int32 ret;
ops_count += 3;
ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1;
return ret;
opus_int32 ret;
ops_count += 3;
ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1;
return ret;
}
#undef SKP_RSHIFT_ROUND64
#undef SKP_RSHIFT_ROUND64
SKP_INLINE opus_int64 SKP_RSHIFT_ROUND64(opus_int64 a, opus_int32 shift){
opus_int64 ret;
ops_count += 6;
ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1;
return ret;
opus_int64 ret;
ops_count += 6;
ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1;
return ret;
}
#undef SKP_abs_int64
#undef SKP_abs_int64
SKP_INLINE opus_int64 SKP_abs_int64(opus_int64 a){
ops_count += 1;
return (((a) > 0) ? (a) : -(a)); // Be careful, SKP_abs returns wrong when input equals to SKP_intXX_MIN
ops_count += 1;
return (((a) > 0) ? (a) : -(a)); // Be careful, SKP_abs returns wrong when input equals to SKP_intXX_MIN
}
#undef SKP_abs_int32
#undef SKP_abs_int32
SKP_INLINE opus_int32 SKP_abs_int32(opus_int32 a){
ops_count += 1;
return abs(a);
ops_count += 1;
return abs(a);
}
#undef SKP_min
static SKP_min(a, b){
ops_count += 1;
return (((a) < (b)) ? (a) : (b));
ops_count += 1;
return (((a) < (b)) ? (a) : (b));
}
#undef SKP_max
static SKP_max(a, b){
ops_count += 1;
return (((a) > (b)) ? (a) : (b));
ops_count += 1;
return (((a) > (b)) ? (a) : (b));
}
#undef SKP_sign
static SKP_sign(a){
ops_count += 1;
return ((a) > 0 ? 1 : ( (a) < 0 ? -1 : 0 ));
ops_count += 1;
return ((a) > 0 ? 1 : ( (a) < 0 ? -1 : 0 ));
}
#undef SKP_ADD16
#undef SKP_ADD16
SKP_INLINE opus_int16 SKP_ADD16(opus_int16 a, opus_int16 b){
opus_int16 ret;
ops_count += 1;
ret = a + b;
return ret;
opus_int16 ret;
ops_count += 1;
ret = a + b;
return ret;
}
#undef SKP_ADD32
#undef SKP_ADD32
SKP_INLINE opus_int32 SKP_ADD32(opus_int32 a, opus_int32 b){
opus_int32 ret;
ops_count += 1;
ret = a + b;
return ret;
opus_int32 ret;
ops_count += 1;
ret = a + b;
return ret;
}
#undef SKP_ADD64
#undef SKP_ADD64
SKP_INLINE opus_int64 SKP_ADD64(opus_int64 a, opus_int64 b){
opus_int64 ret;
ops_count += 2;
ret = a + b;
return ret;
opus_int64 ret;
ops_count += 2;
ret = a + b;
return ret;
}
#undef SKP_SUB16
#undef SKP_SUB16
SKP_INLINE opus_int16 SKP_SUB16(opus_int16 a, opus_int16 b){
opus_int16 ret;
ops_count += 1;
ret = a - b;
return ret;
opus_int16 ret;
ops_count += 1;
ret = a - b;
return ret;
}
#undef SKP_SUB32
#undef SKP_SUB32
SKP_INLINE opus_int32 SKP_SUB32(opus_int32 a, opus_int32 b){
opus_int32 ret;
ops_count += 1;
ret = a - b;
return ret;
opus_int32 ret;
ops_count += 1;
ret = a - b;
return ret;
}
#undef SKP_SUB64
#undef SKP_SUB64
SKP_INLINE opus_int64 SKP_SUB64(opus_int64 a, opus_int64 b){
opus_int64 ret;
ops_count += 2;
ret = a - b;
return ret;
opus_int64 ret;
ops_count += 2;
ret = a - b;
return ret;
}
#undef SKP_ADD_SAT16
SKP_INLINE opus_int16 SKP_ADD_SAT16( opus_int16 a16, opus_int16 b16 ) {
opus_int16 res;
// Nb will be counted in AKP_add32 and SKP_SAT16
res = (opus_int16)SKP_SAT16( SKP_ADD32( (opus_int32)(a16), (b16) ) );
return res;
opus_int16 res;
// Nb will be counted in AKP_add32 and SKP_SAT16
res = (opus_int16)SKP_SAT16( SKP_ADD32( (opus_int32)(a16), (b16) ) );
return res;
}
#undef SKP_ADD_SAT32
SKP_INLINE opus_int32 SKP_ADD_SAT32(opus_int32 a32, opus_int32 b32){
opus_int32 res;
ops_count += 1;
res = ((((a32) + (b32)) & 0x80000000) == 0 ? \
((((a32) & (b32)) & 0x80000000) != 0 ? SKP_int32_MIN : (a32)+(b32)) : \
((((a32) | (b32)) & 0x80000000) == 0 ? SKP_int32_MAX : (a32)+(b32)) );
return res;
opus_int32 res;
ops_count += 1;
res = ((((a32) + (b32)) & 0x80000000) == 0 ? \
((((a32) & (b32)) & 0x80000000) != 0 ? SKP_int32_MIN : (a32)+(b32)) : \
((((a32) | (b32)) & 0x80000000) == 0 ? SKP_int32_MAX : (a32)+(b32)) );
return res;
}
#undef SKP_ADD_SAT64
SKP_INLINE opus_int64 SKP_ADD_SAT64( opus_int64 a64, opus_int64 b64 ) {
opus_int64 res;
ops_count += 1;
res = ((((a64) + (b64)) & 0x8000000000000000LL) == 0 ? \
((((a64) & (b64)) & 0x8000000000000000LL) != 0 ? SKP_int64_MIN : (a64)+(b64)) : \
((((a64) | (b64)) & 0x8000000000000000LL) == 0 ? SKP_int64_MAX : (a64)+(b64)) );
return res;
opus_int64 res;
ops_count += 1;
res = ((((a64) + (b64)) & 0x8000000000000000LL) == 0 ? \
((((a64) & (b64)) & 0x8000000000000000LL) != 0 ? SKP_int64_MIN : (a64)+(b64)) : \
((((a64) | (b64)) & 0x8000000000000000LL) == 0 ? SKP_int64_MAX : (a64)+(b64)) );
return res;
}
#undef SKP_SUB_SAT16
SKP_INLINE opus_int16 SKP_SUB_SAT16( opus_int16 a16, opus_int16 b16 ) {
opus_int16 res;
SKP_assert(0);
// Nb will be counted in sub-macros
res = (opus_int16)SKP_SAT16( SKP_SUB32( (opus_int32)(a16), (b16) ) );
return res;
opus_int16 res;
SKP_assert(0);
// Nb will be counted in sub-macros
res = (opus_int16)SKP_SAT16( SKP_SUB32( (opus_int32)(a16), (b16) ) );
return res;
}
#undef SKP_SUB_SAT32
SKP_INLINE opus_int32 SKP_SUB_SAT32( opus_int32 a32, opus_int32 b32 ) {
opus_int32 res;
ops_count += 1;
res = ((((a32)-(b32)) & 0x80000000) == 0 ? \
(( (a32) & ((b32)^0x80000000) & 0x80000000) ? SKP_int32_MIN : (a32)-(b32)) : \
((((a32)^0x80000000) & (b32) & 0x80000000) ? SKP_int32_MAX : (a32)-(b32)) );
return res;
opus_int32 res;
ops_count += 1;
res = ((((a32)-(b32)) & 0x80000000) == 0 ? \
(( (a32) & ((b32)^0x80000000) & 0x80000000) ? SKP_int32_MIN : (a32)-(b32)) : \
((((a32)^0x80000000) & (b32) & 0x80000000) ? SKP_int32_MAX : (a32)-(b32)) );
return res;
}
#undef SKP_SUB_SAT64
SKP_INLINE opus_int64 SKP_SUB_SAT64( opus_int64 a64, opus_int64 b64 ) {
opus_int64 res;
ops_count += 1;
res = ((((a64)-(b64)) & 0x8000000000000000LL) == 0 ? \
(( (a64) & ((b64)^0x8000000000000000LL) & 0x8000000000000000LL) ? SKP_int64_MIN : (a64)-(b64)) : \
((((a64)^0x8000000000000000LL) & (b64) & 0x8000000000000000LL) ? SKP_int64_MAX : (a64)-(b64)) );
opus_int64 res;
ops_count += 1;
res = ((((a64)-(b64)) & 0x8000000000000000LL) == 0 ? \
(( (a64) & ((b64)^0x8000000000000000LL) & 0x8000000000000000LL) ? SKP_int64_MIN : (a64)-(b64)) : \
((((a64)^0x8000000000000000LL) & (b64) & 0x8000000000000000LL) ? SKP_int64_MAX : (a64)-(b64)) );
return res;
return res;
}
#undef SKP_SMULWW
#undef SKP_SMULWW
SKP_INLINE opus_int32 SKP_SMULWW(opus_int32 a32, opus_int32 b32){
opus_int32 ret;
// Nb will be counted in sub-macros
ret = SKP_MLA(SKP_SMULWB((a32), (b32)), (a32), SKP_RSHIFT_ROUND((b32), 16));
return ret;
opus_int32 ret;
// Nb will be counted in sub-macros
ret = SKP_MLA(SKP_SMULWB((a32), (b32)), (a32), SKP_RSHIFT_ROUND((b32), 16));
return ret;
}
#undef SKP_SMLAWW
#undef SKP_SMLAWW
SKP_INLINE opus_int32 SKP_SMLAWW(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
// Nb will be counted in sub-macros
ret = SKP_MLA(SKP_SMLAWB((a32), (b32), (c32)), (b32), SKP_RSHIFT_ROUND((c32), 16));
return ret;
opus_int32 ret;
// Nb will be counted in sub-macros
ret = SKP_MLA(SKP_SMLAWB((a32), (b32), (c32)), (b32), SKP_RSHIFT_ROUND((c32), 16));
return ret;
}
#undef SKP_min_int
#undef SKP_min_int
SKP_INLINE opus_int SKP_min_int(opus_int a, opus_int b)
{
ops_count += 1;
return (((a) < (b)) ? (a) : (b));
ops_count += 1;
return (((a) < (b)) ? (a) : (b));
}
#undef SKP_min_16
#undef SKP_min_16
SKP_INLINE opus_int16 SKP_min_16(opus_int16 a, opus_int16 b)
{
ops_count += 1;
return (((a) < (b)) ? (a) : (b));
ops_count += 1;
return (((a) < (b)) ? (a) : (b));
}
#undef SKP_min_32
#undef SKP_min_32
SKP_INLINE opus_int32 SKP_min_32(opus_int32 a, opus_int32 b)
{
ops_count += 1;
return (((a) < (b)) ? (a) : (b));
ops_count += 1;
return (((a) < (b)) ? (a) : (b));
}
#undef SKP_min_64
#undef SKP_min_64
SKP_INLINE opus_int64 SKP_min_64(opus_int64 a, opus_int64 b)
{
ops_count += 1;
return (((a) < (b)) ? (a) : (b));
ops_count += 1;
return (((a) < (b)) ? (a) : (b));
}
/* SKP_min() versions with typecast in the function call */
#undef SKP_max_int
#undef SKP_max_int
SKP_INLINE opus_int SKP_max_int(opus_int a, opus_int b)
{
ops_count += 1;
return (((a) > (b)) ? (a) : (b));
ops_count += 1;
return (((a) > (b)) ? (a) : (b));
}
#undef SKP_max_16
#undef SKP_max_16
SKP_INLINE opus_int16 SKP_max_16(opus_int16 a, opus_int16 b)
{
ops_count += 1;
return (((a) > (b)) ? (a) : (b));
ops_count += 1;
return (((a) > (b)) ? (a) : (b));
}
#undef SKP_max_32
#undef SKP_max_32
SKP_INLINE opus_int32 SKP_max_32(opus_int32 a, opus_int32 b)
{
ops_count += 1;
return (((a) > (b)) ? (a) : (b));
}
#undef SKP_max_64
#undef SKP_max_64
SKP_INLINE opus_int64 SKP_max_64(opus_int64 a, opus_int64 b)
{
ops_count += 1;

View file

@ -33,277 +33,277 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if 0 && defined (_WIN32) && defined (_DEBUG) && !defined (SKP_MACRO_COUNT)
#undef SKP_ADD16
#undef SKP_ADD16
SKP_INLINE opus_int16 SKP_ADD16(opus_int16 a, opus_int16 b){
opus_int16 ret;
opus_int16 ret;
ret = a + b;
SKP_assert( ret == SKP_ADD_SAT16( a, b ));
return ret;
ret = a + b;
SKP_assert( ret == SKP_ADD_SAT16( a, b ));
return ret;
}
#undef SKP_ADD32
#undef SKP_ADD32
SKP_INLINE opus_int32 SKP_ADD32(opus_int32 a, opus_int32 b){
opus_int32 ret;
opus_int32 ret;
ret = a + b;
SKP_assert( ret == SKP_ADD_SAT32( a, b ));
return ret;
ret = a + b;
SKP_assert( ret == SKP_ADD_SAT32( a, b ));
return ret;
}
#undef SKP_ADD64
#undef SKP_ADD64
SKP_INLINE opus_int64 SKP_ADD64(opus_int64 a, opus_int64 b){
opus_int64 ret;
opus_int64 ret;
ret = a + b;
SKP_assert( ret == SKP_ADD_SAT64( a, b ));
return ret;
ret = a + b;
SKP_assert( ret == SKP_ADD_SAT64( a, b ));
return ret;
}
#undef SKP_SUB16
#undef SKP_SUB16
SKP_INLINE opus_int16 SKP_SUB16(opus_int16 a, opus_int16 b){
opus_int16 ret;
opus_int16 ret;
ret = a - b;
SKP_assert( ret == SKP_SUB_SAT16( a, b ));
return ret;
ret = a - b;
SKP_assert( ret == SKP_SUB_SAT16( a, b ));
return ret;
}
#undef SKP_SUB32
#undef SKP_SUB32
SKP_INLINE opus_int32 SKP_SUB32(opus_int32 a, opus_int32 b){
opus_int32 ret;
opus_int32 ret;
ret = a - b;
SKP_assert( ret == SKP_SUB_SAT32( a, b ));
return ret;
ret = a - b;
SKP_assert( ret == SKP_SUB_SAT32( a, b ));
return ret;
}
#undef SKP_SUB64
#undef SKP_SUB64
SKP_INLINE opus_int64 SKP_SUB64(opus_int64 a, opus_int64 b){
opus_int64 ret;
opus_int64 ret;
ret = a - b;
SKP_assert( ret == SKP_SUB_SAT64( a, b ));
return ret;
ret = a - b;
SKP_assert( ret == SKP_SUB_SAT64( a, b ));
return ret;
}
#undef SKP_ADD_SAT16
SKP_INLINE opus_int16 SKP_ADD_SAT16( opus_int16 a16, opus_int16 b16 ) {
opus_int16 res;
res = (opus_int16)SKP_SAT16( SKP_ADD32( (opus_int32)(a16), (b16) ) );
SKP_assert( res == SKP_SAT16( ( opus_int32 )a16 + ( opus_int32 )b16 ) );
return res;
opus_int16 res;
res = (opus_int16)SKP_SAT16( SKP_ADD32( (opus_int32)(a16), (b16) ) );
SKP_assert( res == SKP_SAT16( ( opus_int32 )a16 + ( opus_int32 )b16 ) );
return res;
}
#undef SKP_ADD_SAT32
SKP_INLINE opus_int32 SKP_ADD_SAT32(opus_int32 a32, opus_int32 b32){
opus_int32 res;
res = ((((a32) + (b32)) & 0x80000000) == 0 ? \
((((a32) & (b32)) & 0x80000000) != 0 ? SKP_int32_MIN : (a32)+(b32)) : \
((((a32) | (b32)) & 0x80000000) == 0 ? SKP_int32_MAX : (a32)+(b32)) );
SKP_assert( res == SKP_SAT32( ( opus_int64 )a32 + ( opus_int64 )b32 ) );
return res;
opus_int32 res;
res = ((((a32) + (b32)) & 0x80000000) == 0 ? \
((((a32) & (b32)) & 0x80000000) != 0 ? SKP_int32_MIN : (a32)+(b32)) : \
((((a32) | (b32)) & 0x80000000) == 0 ? SKP_int32_MAX : (a32)+(b32)) );
SKP_assert( res == SKP_SAT32( ( opus_int64 )a32 + ( opus_int64 )b32 ) );
return res;
}
#undef SKP_ADD_SAT64
SKP_INLINE opus_int64 SKP_ADD_SAT64( opus_int64 a64, opus_int64 b64 ) {
opus_int64 res;
res = ((((a64) + (b64)) & 0x8000000000000000LL) == 0 ? \
((((a64) & (b64)) & 0x8000000000000000LL) != 0 ? SKP_int64_MIN : (a64)+(b64)) : \
((((a64) | (b64)) & 0x8000000000000000LL) == 0 ? SKP_int64_MAX : (a64)+(b64)) );
if( res != a64 + b64 ) {
// Check that we saturated to the correct extreme value
SKP_assert( ( res == SKP_int64_MAX && ( ( a64 >> 1 ) + ( b64 >> 1 ) > ( SKP_int64_MAX >> 3 ) ) ) ||
( res == SKP_int64_MIN && ( ( a64 >> 1 ) + ( b64 >> 1 ) < ( SKP_int64_MIN >> 3 ) ) ) );
} else {
// Saturation not necessary
SKP_assert( res == a64 + b64 );
}
return res;
opus_int64 res;
res = ((((a64) + (b64)) & 0x8000000000000000LL) == 0 ? \
((((a64) & (b64)) & 0x8000000000000000LL) != 0 ? SKP_int64_MIN : (a64)+(b64)) : \
((((a64) | (b64)) & 0x8000000000000000LL) == 0 ? SKP_int64_MAX : (a64)+(b64)) );
if( res != a64 + b64 ) {
// Check that we saturated to the correct extreme value
SKP_assert( ( res == SKP_int64_MAX && ( ( a64 >> 1 ) + ( b64 >> 1 ) > ( SKP_int64_MAX >> 3 ) ) ) ||
( res == SKP_int64_MIN && ( ( a64 >> 1 ) + ( b64 >> 1 ) < ( SKP_int64_MIN >> 3 ) ) ) );
} else {
// Saturation not necessary
SKP_assert( res == a64 + b64 );
}
return res;
}
#undef SKP_SUB_SAT16
SKP_INLINE opus_int16 SKP_SUB_SAT16( opus_int16 a16, opus_int16 b16 ) {
opus_int16 res;
res = (opus_int16)SKP_SAT16( SKP_SUB32( (opus_int32)(a16), (b16) ) );
SKP_assert( res == SKP_SAT16( ( opus_int32 )a16 - ( opus_int32 )b16 ) );
return res;
opus_int16 res;
res = (opus_int16)SKP_SAT16( SKP_SUB32( (opus_int32)(a16), (b16) ) );
SKP_assert( res == SKP_SAT16( ( opus_int32 )a16 - ( opus_int32 )b16 ) );
return res;
}
#undef SKP_SUB_SAT32
SKP_INLINE opus_int32 SKP_SUB_SAT32( opus_int32 a32, opus_int32 b32 ) {
opus_int32 res;
res = ((((a32)-(b32)) & 0x80000000) == 0 ? \
(( (a32) & ((b32)^0x80000000) & 0x80000000) ? SKP_int32_MIN : (a32)-(b32)) : \
((((a32)^0x80000000) & (b32) & 0x80000000) ? SKP_int32_MAX : (a32)-(b32)) );
SKP_assert( res == SKP_SAT32( ( opus_int64 )a32 - ( opus_int64 )b32 ) );
return res;
opus_int32 res;
res = ((((a32)-(b32)) & 0x80000000) == 0 ? \
(( (a32) & ((b32)^0x80000000) & 0x80000000) ? SKP_int32_MIN : (a32)-(b32)) : \
((((a32)^0x80000000) & (b32) & 0x80000000) ? SKP_int32_MAX : (a32)-(b32)) );
SKP_assert( res == SKP_SAT32( ( opus_int64 )a32 - ( opus_int64 )b32 ) );
return res;
}
#undef SKP_SUB_SAT64
SKP_INLINE opus_int64 SKP_SUB_SAT64( opus_int64 a64, opus_int64 b64 ) {
opus_int64 res;
res = ((((a64)-(b64)) & 0x8000000000000000LL) == 0 ? \
(( (a64) & ((b64)^0x8000000000000000LL) & 0x8000000000000000LL) ? SKP_int64_MIN : (a64)-(b64)) : \
((((a64)^0x8000000000000000LL) & (b64) & 0x8000000000000000LL) ? SKP_int64_MAX : (a64)-(b64)) );
opus_int64 res;
res = ((((a64)-(b64)) & 0x8000000000000000LL) == 0 ? \
(( (a64) & ((b64)^0x8000000000000000LL) & 0x8000000000000000LL) ? SKP_int64_MIN : (a64)-(b64)) : \
((((a64)^0x8000000000000000LL) & (b64) & 0x8000000000000000LL) ? SKP_int64_MAX : (a64)-(b64)) );
if( res != a64 - b64 ) {
// Check that we saturated to the correct extreme value
SKP_assert( ( res == SKP_int64_MAX && ( ( a64 >> 1 ) + ( b64 >> 1 ) > ( SKP_int64_MAX >> 3 ) ) ) ||
( res == SKP_int64_MIN && ( ( a64 >> 1 ) + ( b64 >> 1 ) < ( SKP_int64_MIN >> 3 ) ) ) );
} else {
// Saturation not necessary
SKP_assert( res == a64 - b64 );
}
return res;
if( res != a64 - b64 ) {
// Check that we saturated to the correct extreme value
SKP_assert( ( res == SKP_int64_MAX && ( ( a64 >> 1 ) + ( b64 >> 1 ) > ( SKP_int64_MAX >> 3 ) ) ) ||
( res == SKP_int64_MIN && ( ( a64 >> 1 ) + ( b64 >> 1 ) < ( SKP_int64_MIN >> 3 ) ) ) );
} else {
// Saturation not necessary
SKP_assert( res == a64 - b64 );
}
return res;
}
#undef SKP_MUL
SKP_INLINE opus_int32 SKP_MUL(opus_int32 a32, opus_int32 b32){
opus_int32 ret;
opus_int64 ret64; // Will easily show how many bits that are needed
ret = a32 * b32;
ret64 = (opus_int64)a32 * (opus_int64)b32;
SKP_assert((opus_int64)ret == ret64 ); //Check output overflow
return ret;
opus_int32 ret;
opus_int64 ret64; // Will easily show how many bits that are needed
ret = a32 * b32;
ret64 = (opus_int64)a32 * (opus_int64)b32;
SKP_assert((opus_int64)ret == ret64 ); //Check output overflow
return ret;
}
#undef SKP_MUL_uint
SKP_INLINE opus_uint32 SKP_MUL_uint(opus_uint32 a32, opus_uint32 b32){
opus_uint32 ret;
ret = a32 * b32;
SKP_assert((opus_uint64)ret == (opus_uint64)a32 * (opus_uint64)b32); //Check output overflow
return ret;
opus_uint32 ret;
ret = a32 * b32;
SKP_assert((opus_uint64)ret == (opus_uint64)a32 * (opus_uint64)b32); //Check output overflow
return ret;
}
#undef SKP_MLA
SKP_INLINE opus_int32 SKP_MLA(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
ret = a32 + b32 * c32;
SKP_assert((opus_int64)ret == (opus_int64)a32 + (opus_int64)b32 * (opus_int64)c32); //Check output overflow
return ret;
opus_int32 ret;
ret = a32 + b32 * c32;
SKP_assert((opus_int64)ret == (opus_int64)a32 + (opus_int64)b32 * (opus_int64)c32); //Check output overflow
return ret;
}
#undef SKP_MLA_uint
SKP_INLINE opus_int32 SKP_MLA_uint(opus_uint32 a32, opus_uint32 b32, opus_uint32 c32){
opus_uint32 ret;
ret = a32 + b32 * c32;
SKP_assert((opus_int64)ret == (opus_int64)a32 + (opus_int64)b32 * (opus_int64)c32); //Check output overflow
return ret;
opus_uint32 ret;
ret = a32 + b32 * c32;
SKP_assert((opus_int64)ret == (opus_int64)a32 + (opus_int64)b32 * (opus_int64)c32); //Check output overflow
return ret;
}
#undef SKP_SMULWB
#undef SKP_SMULWB
SKP_INLINE opus_int32 SKP_SMULWB(opus_int32 a32, opus_int32 b32){
opus_int32 ret;
ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16);
SKP_assert((opus_int64)ret == ((opus_int64)a32 * (opus_int16)b32) >> 16);
return ret;
opus_int32 ret;
ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16);
SKP_assert((opus_int64)ret == ((opus_int64)a32 * (opus_int16)b32) >> 16);
return ret;
}
#undef SKP_SMLAWB
#undef SKP_SMLAWB
SKP_INLINE opus_int32 SKP_SMLAWB(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
ret = SKP_ADD32( a32, SKP_SMULWB( b32, c32 ) );
SKP_assert(SKP_ADD32( a32, SKP_SMULWB( b32, c32 ) ) == SKP_ADD_SAT32( a32, SKP_SMULWB( b32, c32 ) ));
return ret;
opus_int32 ret;
ret = SKP_ADD32( a32, SKP_SMULWB( b32, c32 ) );
SKP_assert(SKP_ADD32( a32, SKP_SMULWB( b32, c32 ) ) == SKP_ADD_SAT32( a32, SKP_SMULWB( b32, c32 ) ));
return ret;
}
#undef SKP_SMULWT
SKP_INLINE opus_int32 SKP_SMULWT(opus_int32 a32, opus_int32 b32){
opus_int32 ret;
ret = (a32 >> 16) * (b32 >> 16) + (((a32 & 0x0000FFFF) * (b32 >> 16)) >> 16);
SKP_assert((opus_int64)ret == ((opus_int64)a32 * (b32 >> 16)) >> 16);
return ret;
opus_int32 ret;
ret = (a32 >> 16) * (b32 >> 16) + (((a32 & 0x0000FFFF) * (b32 >> 16)) >> 16);
SKP_assert((opus_int64)ret == ((opus_int64)a32 * (b32 >> 16)) >> 16);
return ret;
}
#undef SKP_SMLAWT
SKP_INLINE opus_int32 SKP_SMLAWT(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
ret = a32 + ((b32 >> 16) * (c32 >> 16)) + (((b32 & 0x0000FFFF) * ((c32 >> 16)) >> 16));
SKP_assert((opus_int64)ret == (opus_int64)a32 + (((opus_int64)b32 * (c32 >> 16)) >> 16));
return ret;
opus_int32 ret;
ret = a32 + ((b32 >> 16) * (c32 >> 16)) + (((b32 & 0x0000FFFF) * ((c32 >> 16)) >> 16));
SKP_assert((opus_int64)ret == (opus_int64)a32 + (((opus_int64)b32 * (c32 >> 16)) >> 16));
return ret;
}
#undef SKP_SMULL
SKP_INLINE opus_int64 SKP_SMULL(opus_int64 a64, opus_int64 b64){
opus_int64 ret64;
ret64 = a64 * b64;
if( b64 != 0 ) {
SKP_assert( a64 == (ret64 / b64) );
} else if( a64 != 0 ) {
SKP_assert( b64 == (ret64 / a64) );
}
return ret64;
opus_int64 ret64;
ret64 = a64 * b64;
if( b64 != 0 ) {
SKP_assert( a64 == (ret64 / b64) );
} else if( a64 != 0 ) {
SKP_assert( b64 == (ret64 / a64) );
}
return ret64;
}
// no checking needed for SKP_SMULBB
#undef SKP_SMLABB
#undef SKP_SMLABB
SKP_INLINE opus_int32 SKP_SMLABB(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32);
SKP_assert((opus_int64)ret == (opus_int64)a32 + (opus_int64)b32 * (opus_int16)c32);
return ret;
opus_int32 ret;
ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32);
SKP_assert((opus_int64)ret == (opus_int64)a32 + (opus_int64)b32 * (opus_int16)c32);
return ret;
}
// no checking needed for SKP_SMULBT
#undef SKP_SMLABT
#undef SKP_SMLABT
SKP_INLINE opus_int32 SKP_SMLABT(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16);
SKP_assert((opus_int64)ret == (opus_int64)a32 + (opus_int64)b32 * (c32 >> 16));
return ret;
opus_int32 ret;
ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16);
SKP_assert((opus_int64)ret == (opus_int64)a32 + (opus_int64)b32 * (c32 >> 16));
return ret;
}
// no checking needed for SKP_SMULTT
#undef SKP_SMLATT
#undef SKP_SMLATT
SKP_INLINE opus_int32 SKP_SMLATT(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
ret = a32 + (b32 >> 16) * (c32 >> 16);
SKP_assert((opus_int64)ret == (opus_int64)a32 + (b32 >> 16) * (c32 >> 16));
return ret;
opus_int32 ret;
ret = a32 + (b32 >> 16) * (c32 >> 16);
SKP_assert((opus_int64)ret == (opus_int64)a32 + (b32 >> 16) * (c32 >> 16));
return ret;
}
#undef SKP_SMULWW
#undef SKP_SMULWW
SKP_INLINE opus_int32 SKP_SMULWW(opus_int32 a32, opus_int32 b32){
opus_int32 ret, tmp1, tmp2;
opus_int64 ret64;
opus_int32 ret, tmp1, tmp2;
opus_int64 ret64;
ret = SKP_SMULWB( a32, b32 );
tmp1 = SKP_RSHIFT_ROUND( b32, 16 );
tmp2 = SKP_MUL( a32, tmp1 );
ret = SKP_SMULWB( a32, b32 );
tmp1 = SKP_RSHIFT_ROUND( b32, 16 );
tmp2 = SKP_MUL( a32, tmp1 );
SKP_assert( (opus_int64)tmp2 == (opus_int64) a32 * (opus_int64) tmp1 );
SKP_assert( (opus_int64)tmp2 == (opus_int64) a32 * (opus_int64) tmp1 );
tmp1 = ret;
ret = SKP_ADD32( tmp1, tmp2 );
SKP_assert( SKP_ADD32( tmp1, tmp2 ) == SKP_ADD_SAT32( tmp1, tmp2 ) );
tmp1 = ret;
ret = SKP_ADD32( tmp1, tmp2 );
SKP_assert( SKP_ADD32( tmp1, tmp2 ) == SKP_ADD_SAT32( tmp1, tmp2 ) );
ret64 = SKP_RSHIFT64( SKP_SMULL( a32, b32 ), 16 );
SKP_assert( (opus_int64)ret == ret64 );
ret64 = SKP_RSHIFT64( SKP_SMULL( a32, b32 ), 16 );
SKP_assert( (opus_int64)ret == ret64 );
return ret;
return ret;
}
#undef SKP_SMLAWW
#undef SKP_SMLAWW
SKP_INLINE opus_int32 SKP_SMLAWW(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret, tmp;
opus_int32 ret, tmp;
tmp = SKP_SMULWW( b32, c32 );
ret = SKP_ADD32( a32, tmp );
SKP_assert( ret == SKP_ADD_SAT32( a32, tmp ) );
return ret;
tmp = SKP_SMULWW( b32, c32 );
ret = SKP_ADD32( a32, tmp );
SKP_assert( ret == SKP_ADD_SAT32( a32, tmp ) );
return ret;
}
// multiply-accumulate macros that allow overflow in the addition (ie, no asserts in debug mode)
#undef SKP_MLA_ovflw
#define SKP_MLA_ovflw(a32, b32, c32) ((a32) + ((b32) * (c32)))
#undef SKP_SMLABB_ovflw
#define SKP_SMLABB_ovflw(a32, b32, c32) ((a32) + ((opus_int32)((opus_int16)(b32))) * (opus_int32)((opus_int16)(c32)))
#undef SKP_SMLABT_ovflw
#define SKP_SMLABT_ovflw(a32, b32, c32) ((a32) + ((opus_int32)((opus_int16)(b32))) * ((c32) >> 16))
#undef SKP_SMLATT_ovflw
#define SKP_SMLATT_ovflw(a32, b32, c32) ((a32) + ((b32) >> 16) * ((c32) >> 16))
#undef SKP_SMLAWB_ovflw
#define SKP_SMLAWB_ovflw(a32, b32, c32) ((a32) + ((((b32) >> 16) * (opus_int32)((opus_int16)(c32))) + ((((b32) & 0x0000FFFF) * (opus_int32)((opus_int16)(c32))) >> 16)))
#undef SKP_SMLAWT_ovflw
#define SKP_SMLAWT_ovflw(a32, b32, c32) ((a32) + (((b32) >> 16) * ((c32) >> 16)) + ((((b32) & 0x0000FFFF) * ((c32) >> 16)) >> 16))
#undef SKP_MLA_ovflw
#define SKP_MLA_ovflw(a32, b32, c32) ((a32) + ((b32) * (c32)))
#undef SKP_SMLABB_ovflw
#define SKP_SMLABB_ovflw(a32, b32, c32) ((a32) + ((opus_int32)((opus_int16)(b32))) * (opus_int32)((opus_int16)(c32)))
#undef SKP_SMLABT_ovflw
#define SKP_SMLABT_ovflw(a32, b32, c32) ((a32) + ((opus_int32)((opus_int16)(b32))) * ((c32) >> 16))
#undef SKP_SMLATT_ovflw
#define SKP_SMLATT_ovflw(a32, b32, c32) ((a32) + ((b32) >> 16) * ((c32) >> 16))
#undef SKP_SMLAWB_ovflw
#define SKP_SMLAWB_ovflw(a32, b32, c32) ((a32) + ((((b32) >> 16) * (opus_int32)((opus_int16)(c32))) + ((((b32) & 0x0000FFFF) * (opus_int32)((opus_int16)(c32))) >> 16)))
#undef SKP_SMLAWT_ovflw
#define SKP_SMLAWT_ovflw(a32, b32, c32) ((a32) + (((b32) >> 16) * ((c32) >> 16)) + ((((b32) & 0x0000FFFF) * ((c32) >> 16)) >> 16))
// no checking needed for SKP_SMULL
// no checking needed for SKP_SMLAL
@ -313,16 +313,16 @@ SKP_INLINE opus_int32 SKP_SMLAWW(opus_int32 a32, opus_int32 b32, opus_int32 c32)
#undef SKP_DIV32
SKP_INLINE opus_int32 SKP_DIV32(opus_int32 a32, opus_int32 b32){
SKP_assert( b32 != 0 );
return a32 / b32;
SKP_assert( b32 != 0 );
return a32 / b32;
}
#undef SKP_DIV32_16
SKP_INLINE opus_int32 SKP_DIV32_16(opus_int32 a32, opus_int32 b32){
SKP_assert( b32 != 0 );
SKP_assert( b32 <= SKP_int16_MAX );
SKP_assert( b32 >= SKP_int16_MIN );
return a32 / b32;
SKP_assert( b32 != 0 );
SKP_assert( b32 <= SKP_int16_MAX );
SKP_assert( b32 >= SKP_int16_MIN );
return a32 / b32;
}
// no checking needed for SKP_SAT8
@ -333,220 +333,220 @@ SKP_INLINE opus_int32 SKP_DIV32_16(opus_int32 a32, opus_int32 b32){
// no checking needed for SKP_ADD_POS_SAT16
// no checking needed for SKP_ADD_POS_SAT32
// no checking needed for SKP_ADD_POS_SAT64
#undef SKP_LSHIFT8
#undef SKP_LSHIFT8
SKP_INLINE opus_int8 SKP_LSHIFT8(opus_int8 a, opus_int32 shift){
opus_int8 ret;
ret = a << shift;
SKP_assert(shift >= 0);
SKP_assert(shift < 8);
SKP_assert((opus_int64)ret == ((opus_int64)a) << shift);
return ret;
opus_int8 ret;
ret = a << shift;
SKP_assert(shift >= 0);
SKP_assert(shift < 8);
SKP_assert((opus_int64)ret == ((opus_int64)a) << shift);
return ret;
}
#undef SKP_LSHIFT16
#undef SKP_LSHIFT16
SKP_INLINE opus_int16 SKP_LSHIFT16(opus_int16 a, opus_int32 shift){
opus_int16 ret;
ret = a << shift;
SKP_assert(shift >= 0);
SKP_assert(shift < 16);
SKP_assert((opus_int64)ret == ((opus_int64)a) << shift);
return ret;
opus_int16 ret;
ret = a << shift;
SKP_assert(shift >= 0);
SKP_assert(shift < 16);
SKP_assert((opus_int64)ret == ((opus_int64)a) << shift);
return ret;
}
#undef SKP_LSHIFT32
#undef SKP_LSHIFT32
SKP_INLINE opus_int32 SKP_LSHIFT32(opus_int32 a, opus_int32 shift){
opus_int32 ret;
ret = a << shift;
SKP_assert(shift >= 0);
SKP_assert(shift < 32);
SKP_assert((opus_int64)ret == ((opus_int64)a) << shift);
return ret;
opus_int32 ret;
ret = a << shift;
SKP_assert(shift >= 0);
SKP_assert(shift < 32);
SKP_assert((opus_int64)ret == ((opus_int64)a) << shift);
return ret;
}
#undef SKP_LSHIFT64
#undef SKP_LSHIFT64
SKP_INLINE opus_int64 SKP_LSHIFT64(opus_int64 a, opus_int shift){
SKP_assert(shift >= 0);
SKP_assert(shift < 64);
return a << shift;
SKP_assert(shift >= 0);
SKP_assert(shift < 64);
return a << shift;
}
#undef SKP_LSHIFT_ovflw
#undef SKP_LSHIFT_ovflw
SKP_INLINE opus_int32 SKP_LSHIFT_ovflw(opus_int32 a, opus_int32 shift){
SKP_assert(shift >= 0); /* no check for overflow */
return a << shift;
SKP_assert(shift >= 0); /* no check for overflow */
return a << shift;
}
#undef SKP_LSHIFT_uint
#undef SKP_LSHIFT_uint
SKP_INLINE opus_uint32 SKP_LSHIFT_uint(opus_uint32 a, opus_int32 shift){
opus_uint32 ret;
ret = a << shift;
SKP_assert(shift >= 0);
SKP_assert((opus_int64)ret == ((opus_int64)a) << shift);
return ret;
opus_uint32 ret;
ret = a << shift;
SKP_assert(shift >= 0);
SKP_assert((opus_int64)ret == ((opus_int64)a) << shift);
return ret;
}
#undef SKP_RSHIFT8
#undef SKP_RSHIFT8
SKP_INLINE opus_int8 SKP_RSHIFT8(opus_int8 a, opus_int32 shift){
SKP_assert(shift >= 0);
SKP_assert(shift < 8);
return a >> shift;
SKP_assert(shift >= 0);
SKP_assert(shift < 8);
return a >> shift;
}
#undef SKP_RSHIFT16
#undef SKP_RSHIFT16
SKP_INLINE opus_int16 SKP_RSHIFT16(opus_int16 a, opus_int32 shift){
SKP_assert(shift >= 0);
SKP_assert(shift < 16);
return a >> shift;
SKP_assert(shift >= 0);
SKP_assert(shift < 16);
return a >> shift;
}
#undef SKP_RSHIFT32
#undef SKP_RSHIFT32
SKP_INLINE opus_int32 SKP_RSHIFT32(opus_int32 a, opus_int32 shift){
SKP_assert(shift >= 0);
SKP_assert(shift < 32);
return a >> shift;
SKP_assert(shift >= 0);
SKP_assert(shift < 32);
return a >> shift;
}
#undef SKP_RSHIFT64
#undef SKP_RSHIFT64
SKP_INLINE opus_int64 SKP_RSHIFT64(opus_int64 a, opus_int64 shift){
SKP_assert(shift >= 0);
SKP_assert(shift <= 63);
return a >> shift;
SKP_assert(shift >= 0);
SKP_assert(shift <= 63);
return a >> shift;
}
#undef SKP_RSHIFT_uint
#undef SKP_RSHIFT_uint
SKP_INLINE opus_uint32 SKP_RSHIFT_uint(opus_uint32 a, opus_int32 shift){
SKP_assert(shift >= 0);
SKP_assert(shift <= 32);
return a >> shift;
SKP_assert(shift >= 0);
SKP_assert(shift <= 32);
return a >> shift;
}
#undef SKP_ADD_LSHIFT
#undef SKP_ADD_LSHIFT
SKP_INLINE opus_int32 SKP_ADD_LSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 31);
ret = a + (b << shift);
SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift));
return ret; // shift >= 0
opus_int32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 31);
ret = a + (b << shift);
SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift));
return ret; // shift >= 0
}
#undef SKP_ADD_LSHIFT32
#undef SKP_ADD_LSHIFT32
SKP_INLINE opus_int32 SKP_ADD_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 31);
ret = a + (b << shift);
SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift));
return ret; // shift >= 0
opus_int32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 31);
ret = a + (b << shift);
SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift));
return ret; // shift >= 0
}
#undef SKP_ADD_LSHIFT_uint
#undef SKP_ADD_LSHIFT_uint
SKP_INLINE opus_uint32 SKP_ADD_LSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){
opus_uint32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 32);
ret = a + (b << shift);
SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift));
return ret; // shift >= 0
opus_uint32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 32);
ret = a + (b << shift);
SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift));
return ret; // shift >= 0
}
#undef SKP_ADD_RSHIFT
#undef SKP_ADD_RSHIFT
SKP_INLINE opus_int32 SKP_ADD_RSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 31);
ret = a + (b >> shift);
SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift));
return ret; // shift > 0
opus_int32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 31);
ret = a + (b >> shift);
SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift));
return ret; // shift > 0
}
#undef SKP_ADD_RSHIFT32
#undef SKP_ADD_RSHIFT32
SKP_INLINE opus_int32 SKP_ADD_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 31);
ret = a + (b >> shift);
SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift));
return ret; // shift > 0
opus_int32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 31);
ret = a + (b >> shift);
SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift));
return ret; // shift > 0
}
#undef SKP_ADD_RSHIFT_uint
#undef SKP_ADD_RSHIFT_uint
SKP_INLINE opus_uint32 SKP_ADD_RSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){
opus_uint32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 32);
ret = a + (b >> shift);
SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift));
return ret; // shift > 0
opus_uint32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 32);
ret = a + (b >> shift);
SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift));
return ret; // shift > 0
}
#undef SKP_SUB_LSHIFT32
#undef SKP_SUB_LSHIFT32
SKP_INLINE opus_int32 SKP_SUB_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 31);
ret = a - (b << shift);
SKP_assert((opus_int64)ret == (opus_int64)a - (((opus_int64)b) << shift));
return ret; // shift >= 0
opus_int32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 31);
ret = a - (b << shift);
SKP_assert((opus_int64)ret == (opus_int64)a - (((opus_int64)b) << shift));
return ret; // shift >= 0
}
#undef SKP_SUB_RSHIFT32
#undef SKP_SUB_RSHIFT32
SKP_INLINE opus_int32 SKP_SUB_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
opus_int32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 31);
ret = a - (b >> shift);
SKP_assert((opus_int64)ret == (opus_int64)a - (((opus_int64)b) >> shift));
return ret; // shift > 0
opus_int32 ret;
SKP_assert(shift >= 0);
SKP_assert(shift <= 31);
ret = a - (b >> shift);
SKP_assert((opus_int64)ret == (opus_int64)a - (((opus_int64)b) >> shift));
return ret; // shift > 0
}
#undef SKP_RSHIFT_ROUND
#undef SKP_RSHIFT_ROUND
SKP_INLINE opus_int32 SKP_RSHIFT_ROUND(opus_int32 a, opus_int32 shift){
opus_int32 ret;
SKP_assert(shift > 0); /* the marco definition can't handle a shift of zero */
SKP_assert(shift < 32);
ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1;
SKP_assert((opus_int64)ret == ((opus_int64)a + ((opus_int64)1 << (shift - 1))) >> shift);
return ret;
opus_int32 ret;
SKP_assert(shift > 0); /* the marco definition can't handle a shift of zero */
SKP_assert(shift < 32);
ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1;
SKP_assert((opus_int64)ret == ((opus_int64)a + ((opus_int64)1 << (shift - 1))) >> shift);
return ret;
}
#undef SKP_RSHIFT_ROUND64
#undef SKP_RSHIFT_ROUND64
SKP_INLINE opus_int64 SKP_RSHIFT_ROUND64(opus_int64 a, opus_int32 shift){
opus_int64 ret;
SKP_assert(shift > 0); /* the marco definition can't handle a shift of zero */
SKP_assert(shift < 64);
ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1;
return ret;
opus_int64 ret;
SKP_assert(shift > 0); /* the marco definition can't handle a shift of zero */
SKP_assert(shift < 64);
ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1;
return ret;
}
// SKP_abs is used on floats also, so doesn't work...
//#undef SKP_abs
//#undef SKP_abs
//SKP_INLINE opus_int32 SKP_abs(opus_int32 a){
// SKP_assert(a != 0x80000000);
// return (((a) > 0) ? (a) : -(a)); // Be careful, SKP_abs returns wrong when input equals to SKP_intXX_MIN
// SKP_assert(a != 0x80000000);
// return (((a) > 0) ? (a) : -(a)); // Be careful, SKP_abs returns wrong when input equals to SKP_intXX_MIN
//}
#undef SKP_abs_int64
#undef SKP_abs_int64
SKP_INLINE opus_int64 SKP_abs_int64(opus_int64 a){
SKP_assert(a != 0x8000000000000000);
return (((a) > 0) ? (a) : -(a)); // Be careful, SKP_abs returns wrong when input equals to SKP_intXX_MIN
SKP_assert(a != 0x8000000000000000);
return (((a) > 0) ? (a) : -(a)); // Be careful, SKP_abs returns wrong when input equals to SKP_intXX_MIN
}
#undef SKP_abs_int32
#undef SKP_abs_int32
SKP_INLINE opus_int32 SKP_abs_int32(opus_int32 a){
SKP_assert(a != 0x80000000);
return abs(a);
SKP_assert(a != 0x80000000);
return abs(a);
}
#undef SKP_CHECK_FIT8
#undef SKP_CHECK_FIT8
SKP_INLINE opus_int8 SKP_CHECK_FIT8( opus_int64 a ){
opus_int8 ret;
ret = (opus_int8)a;
SKP_assert( (opus_int64)ret == a );
return( ret );
opus_int8 ret;
ret = (opus_int8)a;
SKP_assert( (opus_int64)ret == a );
return( ret );
}
#undef SKP_CHECK_FIT16
#undef SKP_CHECK_FIT16
SKP_INLINE opus_int16 SKP_CHECK_FIT16( opus_int64 a ){
opus_int16 ret;
ret = (opus_int16)a;
SKP_assert( (opus_int64)ret == a );
return( ret );
opus_int16 ret;
ret = (opus_int16)a;
SKP_assert( (opus_int64)ret == a );
return( ret );
}
#undef SKP_CHECK_FIT32
#undef SKP_CHECK_FIT32
SKP_INLINE opus_int32 SKP_CHECK_FIT32( opus_int64 a ){
opus_int32 ret;
ret = (opus_int32)a;
SKP_assert( (opus_int64)ret == a );
return( ret );
opus_int32 ret;
ret = (opus_int32)a;
SKP_assert( (opus_int64)ret == a );
return( ret );
}
// no checking for SKP_NSHIFT_MUL_32_32

View file

@ -152,7 +152,7 @@ void silk_NLSF2A(
if( silk_LPC_inverse_pred_gain( &invGain_Q30, a_Q12, d ) == 1 ) {
/* Prediction coefficients are (too close to) unstable; apply bandwidth expansion */
/* on the unscaled coefficients, convert to Q12 and measure again */
silk_bwexpander_32( a32_QA1, d, 65536 - SKP_SMULBB( 9 + i, i ) ); /* 10_Q16 = 0.00015 */
silk_bwexpander_32( a32_QA1, d, 65536 - SKP_SMULBB( 9 + i, i ) ); /* 10_Q16 = 0.00015 */
for( k = 0; k < d; k++ ) {
a_Q12[ k ] = (opus_int16)SKP_RSHIFT_ROUND( a32_QA1[ k ], QA + 1 - 12 ); /* QA+1 -> Q12 */
}

View file

@ -133,7 +133,7 @@ opus_int32 silk_NLSF_encode( /* O Returns RD
#if STORE_LSF_DATA_FOR_TRAINING
{
/* code for training the codebooks */
/* code for training the codebooks */
opus_int32 RD_dec_Q22, Dist_Q22_dec, Rate_Q7, diff_Q15;
ind1 = NLSFIndices[ 0 ];
silk_NLSF_unpack( ec_ix, pred_Q8, psNLSF_CB, ind1 );

View file

@ -655,7 +655,7 @@ SKP_INLINE void silk_nsq_del_dec_scale_states(
/* Scale scalar states */
psDD->LF_AR_Q12 = SKP_SMULWW( gain_adj_Q16, psDD->LF_AR_Q12 );
/* Scale short-term prediction and shaping states */
/* Scale short-term prediction and shaping states */
for( i = 0; i < NSQ_LPC_BUF_LENGTH; i++ ) {
psDD->sLPC_Q14[ i ] = SKP_SMULWW( gain_adj_Q16, psDD->sLPC_Q14[ i ] );
}

View file

@ -174,7 +174,7 @@ void silk_PLC_conceal(
exc_buf_ptr = exc_buf;
/* FIXME: JMV: Is this the right fix? */
for (i=0;i<MAX_FRAME_LENGTH;i++)
exc_buf[i] = 0;
exc_buf[i] = 0;
for( k = ( psDec->nb_subfr >> 1 ); k < psDec->nb_subfr; k++ ) {
for( i = 0; i < psDec->subfr_length; i++ ) {
exc_buf_ptr[ i ] = ( opus_int16 )SKP_RSHIFT(
@ -374,7 +374,7 @@ void silk_PLC_glue_frames(
gain_Q16 = SKP_LSHIFT( silk_SQRT_APPROX( frac_Q24 ), 4 );
slope_Q16 = SKP_DIV32_16( ( 1 << 16 ) - gain_Q16, length );
/* Make slope 4x steeper to avoid missing onsets after DTX */
/* Make slope 4x steeper to avoid missing onsets after DTX */
slope_Q16 = SKP_LSHIFT( slope_Q16, 2 );
for( i = 0; i < length; i++ ) {

View file

@ -52,26 +52,26 @@ extern "C"
* Initialize/reset the resampler state for a given pair of input/output sampling rates
*/
opus_int silk_resampler_init(
silk_resampler_state_struct *S, /* I/O: Resampler state */
opus_int32 Fs_Hz_in, /* I: Input sampling rate (Hz) */
opus_int32 Fs_Hz_out /* I: Output sampling rate (Hz) */
silk_resampler_state_struct *S, /* I/O: Resampler state */
opus_int32 Fs_Hz_in, /* I: Input sampling rate (Hz) */
opus_int32 Fs_Hz_out /* I: Output sampling rate (Hz) */
);
/*!
* Clear the states of all resampling filters, without resetting sampling rate ratio
*/
opus_int silk_resampler_clear(
silk_resampler_state_struct *S /* I/O: Resampler state */
silk_resampler_state_struct *S /* I/O: Resampler state */
);
/*!
* Resampler: convert from one sampling rate to another
*/
opus_int silk_resampler(
silk_resampler_state_struct *S, /* I/O: Resampler state */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
silk_resampler_state_struct *S, /* I/O: Resampler state */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
);
/*!

View file

@ -34,7 +34,7 @@ opus_int16 silk_int16_array_maxabs( /* O Maximum absolute value, max
)
{
opus_int32 max = 0, i, lvl = 0, ind;
if( len == 0 ) return 0;
if( len == 0 ) return 0;
ind = len - 1;
max = SKP_SMULBB( vec[ ind ], vec[ ind ] );

View file

@ -73,11 +73,11 @@ opus_int check_control_input(
SKP_assert( 0 );
return SILK_ENC_INVALID_DTX_SETTING;
}
if( encControl->useCBR < 0 || encControl->useCBR > 1 ) {
if( encControl->useCBR < 0 || encControl->useCBR > 1 ) {
SKP_assert( 0 );
return SILK_ENC_INVALID_CBR_SETTING;
}
if( encControl->useInBandFEC < 0 || encControl->useInBandFEC > 1 ) {
if( encControl->useInBandFEC < 0 || encControl->useInBandFEC > 1 ) {
SKP_assert( 0 );
return SILK_ENC_INVALID_INBAND_FEC_SETTING;
}

View file

@ -54,7 +54,7 @@ opus_int silk_setup_complexity(
);
SKP_INLINE opus_int silk_setup_LBRR(
silk_encoder_state *psEncC, /* I/O */
silk_encoder_state *psEncC, /* I/O */
const opus_int32 TargetRate_bps /* I */
);

View file

@ -248,12 +248,12 @@ extern opus_int64 silk_Timer_depth[SKP_NUM_TIMERS_MAX];
#define SAVE_DATA( FILE_NAME, DATA_PTR, N_BYTES ) { \
static opus_int32 init = 0; \
FILE *fp; \
if (init == 0) { \
if (init == 0) { \
init = 1; \
fp = fopen(#FILE_NAME, "wb"); \
} else { \
fp = fopen(#FILE_NAME, "ab+"); \
} \
} \
fwrite((DATA_PTR), (N_BYTES), 1, fp); \
fclose(fp); \
}
@ -276,7 +276,7 @@ extern int silk_debug_store_count;
static opus_int init = 0, cnt = 0; \
static FILE **fp; \
if (init == 0) { \
init = 1; \
init = 1; \
cnt = silk_debug_store_count++; \
silk_debug_store_fp[ cnt ] = fopen(#FILE_NAME, "wb"); \
} \

View file

@ -131,4 +131,3 @@ TOC(DECODE_FRAME)
return ret;
}

View file

@ -69,7 +69,7 @@ void silk_decode_pulses(
nLshifts[ i ]++;
/* When we've already got 10 LSBs, we shift the table to not allow (MAX_PULSES + 1) */
sum_pulses[ i ] = ec_dec_icdf( psRangeDec,
silk_pulses_per_block_iCDF[ N_RATE_LEVELS - 1] + (nLshifts[ i ]==10), 8 );
silk_pulses_per_block_iCDF[ N_RATE_LEVELS - 1] + (nLshifts[ i ]==10), 8 );
}
}

View file

@ -58,7 +58,7 @@ opus_int silk_Get_Encoder_Size( opus_int32 *encSizeBytes )
/*************************/
opus_int silk_InitEncoder(
void *encState, /* I/O: State */
silk_EncControlStruct *encStatus /* O: Control structure */
silk_EncControlStruct *encStatus /* O: Control structure */
)
{
silk_encoder *psEnc;

View file

@ -38,7 +38,7 @@ void silk_quant_LTP_gains(
)
{
opus_int j, k, cbk_size;
opus_int8 temp_idx[ MAX_NB_SUBFR ];
opus_int8 temp_idx[ MAX_NB_SUBFR ];
const opus_uint8 *cl_ptr_Q5;
const opus_int8 *cbk_ptr_Q7;
const opus_int16 *b_Q14_ptr;
@ -87,7 +87,7 @@ TIC(quant_LTP)
if( rate_dist_Q14 < min_rate_dist_Q14 ) {
min_rate_dist_Q14 = rate_dist_Q14;
*periodicity_index = (opus_int8)k;
SKP_memcpy( cbk_index, temp_idx, nb_subfr * sizeof( opus_int8 ) );
SKP_memcpy( cbk_index, temp_idx, nb_subfr * sizeof( opus_int8 ) );
}
/* Break early in low-complexity mode if rate distortion is below threshold */

View file

@ -70,53 +70,53 @@ static opus_int32 gcd(
/* Initialize/reset the resampler state for a given pair of input/output sampling rates */
opus_int silk_resampler_init(
silk_resampler_state_struct *S, /* I/O: Resampler state */
opus_int32 Fs_Hz_in, /* I: Input sampling rate (Hz) */
opus_int32 Fs_Hz_out /* I: Output sampling rate (Hz) */
silk_resampler_state_struct *S, /* I/O: Resampler state */
opus_int32 Fs_Hz_in, /* I: Input sampling rate (Hz) */
opus_int32 Fs_Hz_out /* I: Output sampling rate (Hz) */
)
{
opus_int32 cycleLen, cyclesPerBatch, up2 = 0, down2 = 0;
/* Clear state */
SKP_memset( S, 0, sizeof( silk_resampler_state_struct ) );
/* Clear state */
SKP_memset( S, 0, sizeof( silk_resampler_state_struct ) );
/* Input checking */
/* Input checking */
#if RESAMPLER_SUPPORT_ABOVE_48KHZ
if( Fs_Hz_in < 8000 || Fs_Hz_in > 192000 || Fs_Hz_out < 8000 || Fs_Hz_out > 192000 ) {
if( Fs_Hz_in < 8000 || Fs_Hz_in > 192000 || Fs_Hz_out < 8000 || Fs_Hz_out > 192000 ) {
#else
if( Fs_Hz_in < 8000 || Fs_Hz_in > 48000 || Fs_Hz_out < 8000 || Fs_Hz_out > 48000 ) {
#endif
SKP_assert( 0 );
return -1;
}
SKP_assert( 0 );
return -1;
}
#if RESAMPLER_SUPPORT_ABOVE_48KHZ
/* Determine pre downsampling and post upsampling */
if( Fs_Hz_in > 96000 ) {
S->nPreDownsamplers = 2;
/* Determine pre downsampling and post upsampling */
if( Fs_Hz_in > 96000 ) {
S->nPreDownsamplers = 2;
S->down_pre_function = silk_resampler_private_down4;
} else if( Fs_Hz_in > 48000 ) {
S->nPreDownsamplers = 1;
S->nPreDownsamplers = 1;
S->down_pre_function = silk_resampler_down2;
} else {
S->nPreDownsamplers = 0;
S->nPreDownsamplers = 0;
S->down_pre_function = NULL;
}
if( Fs_Hz_out > 96000 ) {
S->nPostUpsamplers = 2;
if( Fs_Hz_out > 96000 ) {
S->nPostUpsamplers = 2;
S->up_post_function = silk_resampler_private_up4;
} else if( Fs_Hz_out > 48000 ) {
S->nPostUpsamplers = 1;
S->nPostUpsamplers = 1;
S->up_post_function = silk_resampler_up2;
} else {
S->nPostUpsamplers = 0;
S->nPostUpsamplers = 0;
S->up_post_function = NULL;
}
if( S->nPreDownsamplers + S->nPostUpsamplers > 0 ) {
/* Ratio of output/input samples */
S->ratio_Q16 = SKP_LSHIFT32( SKP_DIV32( SKP_LSHIFT32( Fs_Hz_out, 13 ), Fs_Hz_in ), 3 );
S->ratio_Q16 = SKP_LSHIFT32( SKP_DIV32( SKP_LSHIFT32( Fs_Hz_out, 13 ), Fs_Hz_in ), 3 );
/* Make sure the ratio is rounded up */
while( SKP_SMULWW( S->ratio_Q16, Fs_Hz_in ) < Fs_Hz_out ) S->ratio_Q16++;
@ -124,8 +124,8 @@ opus_int silk_resampler_init(
S->batchSizePrePost = SKP_DIV32_16( Fs_Hz_in, 100 );
/* Convert sampling rate to those after pre-downsampling and before post-upsampling */
Fs_Hz_in = SKP_RSHIFT( Fs_Hz_in, S->nPreDownsamplers );
Fs_Hz_out = SKP_RSHIFT( Fs_Hz_out, S->nPostUpsamplers );
Fs_Hz_in = SKP_RSHIFT( Fs_Hz_in, S->nPreDownsamplers );
Fs_Hz_out = SKP_RSHIFT( Fs_Hz_out, S->nPostUpsamplers );
}
#endif
@ -146,15 +146,15 @@ opus_int silk_resampler_init(
}
/* Find resampler with the right sampling ratio */
/* Find resampler with the right sampling ratio */
if( Fs_Hz_out > Fs_Hz_in ) {
/* Upsample */
if( Fs_Hz_out == SKP_MUL( Fs_Hz_in, 2 ) ) { /* Fs_out : Fs_in = 2 : 1 */
/* Special case: directly use 2x upsampler */
S->resampler_function = silk_resampler_private_up2_HQ_wrapper;
S->resampler_function = silk_resampler_private_up2_HQ_wrapper;
} else {
/* Default resampler */
S->resampler_function = silk_resampler_private_IIR_FIR;
/* Default resampler */
S->resampler_function = silk_resampler_private_IIR_FIR;
up2 = 1;
if( Fs_Hz_in > 24000 ) {
/* Low-quality all-pass upsampler */
@ -167,53 +167,53 @@ opus_int silk_resampler_init(
} else if ( Fs_Hz_out < Fs_Hz_in ) {
/* Downsample */
if( SKP_MUL( Fs_Hz_out, 4 ) == SKP_MUL( Fs_Hz_in, 3 ) ) { /* Fs_out : Fs_in = 3 : 4 */
S->FIR_Fracs = 3;
S->Coefs = silk_Resampler_3_4_COEFS;
S->resampler_function = silk_resampler_private_down_FIR;
S->FIR_Fracs = 3;
S->Coefs = silk_Resampler_3_4_COEFS;
S->resampler_function = silk_resampler_private_down_FIR;
} else if( SKP_MUL( Fs_Hz_out, 3 ) == SKP_MUL( Fs_Hz_in, 2 ) ) { /* Fs_out : Fs_in = 2 : 3 */
S->FIR_Fracs = 2;
S->Coefs = silk_Resampler_2_3_COEFS;
S->resampler_function = silk_resampler_private_down_FIR;
S->FIR_Fracs = 2;
S->Coefs = silk_Resampler_2_3_COEFS;
S->resampler_function = silk_resampler_private_down_FIR;
} else if( SKP_MUL( Fs_Hz_out, 2 ) == Fs_Hz_in ) { /* Fs_out : Fs_in = 1 : 2 */
S->FIR_Fracs = 1;
S->Coefs = silk_Resampler_1_2_COEFS;
S->resampler_function = silk_resampler_private_down_FIR;
S->FIR_Fracs = 1;
S->Coefs = silk_Resampler_1_2_COEFS;
S->resampler_function = silk_resampler_private_down_FIR;
} else if( SKP_MUL( Fs_Hz_out, 8 ) == SKP_MUL( Fs_Hz_in, 3 ) ) { /* Fs_out : Fs_in = 3 : 8 */
S->FIR_Fracs = 3;
S->Coefs = silk_Resampler_3_8_COEFS;
S->resampler_function = silk_resampler_private_down_FIR;
S->FIR_Fracs = 3;
S->Coefs = silk_Resampler_3_8_COEFS;
S->resampler_function = silk_resampler_private_down_FIR;
} else if( SKP_MUL( Fs_Hz_out, 3 ) == Fs_Hz_in ) { /* Fs_out : Fs_in = 1 : 3 */
S->FIR_Fracs = 1;
S->Coefs = silk_Resampler_1_3_COEFS;
S->resampler_function = silk_resampler_private_down_FIR;
S->FIR_Fracs = 1;
S->Coefs = silk_Resampler_1_3_COEFS;
S->resampler_function = silk_resampler_private_down_FIR;
} else if( SKP_MUL( Fs_Hz_out, 4 ) == Fs_Hz_in ) { /* Fs_out : Fs_in = 1 : 4 */
S->FIR_Fracs = 1;
S->FIR_Fracs = 1;
down2 = 1;
S->Coefs = silk_Resampler_1_2_COEFS;
S->Coefs = silk_Resampler_1_2_COEFS;
S->resampler_function = silk_resampler_private_down_FIR;
} else if( SKP_MUL( Fs_Hz_out, 6 ) == Fs_Hz_in ) { /* Fs_out : Fs_in = 1 : 6 */
S->FIR_Fracs = 1;
S->FIR_Fracs = 1;
down2 = 1;
S->Coefs = silk_Resampler_1_3_COEFS;
S->Coefs = silk_Resampler_1_3_COEFS;
S->resampler_function = silk_resampler_private_down_FIR;
} else if( SKP_MUL( Fs_Hz_out, 441 ) == SKP_MUL( Fs_Hz_in, 80 ) ) { /* Fs_out : Fs_in = 80 : 441 */
S->Coefs = silk_Resampler_80_441_ARMA4_COEFS;
S->resampler_function = silk_resampler_private_IIR_FIR;
S->Coefs = silk_Resampler_80_441_ARMA4_COEFS;
S->resampler_function = silk_resampler_private_IIR_FIR;
} else if( SKP_MUL( Fs_Hz_out, 441 ) == SKP_MUL( Fs_Hz_in, 120 ) ) { /* Fs_out : Fs_in = 120 : 441 */
S->Coefs = silk_Resampler_120_441_ARMA4_COEFS;
S->resampler_function = silk_resampler_private_IIR_FIR;
S->Coefs = silk_Resampler_120_441_ARMA4_COEFS;
S->resampler_function = silk_resampler_private_IIR_FIR;
} else if( SKP_MUL( Fs_Hz_out, 441 ) == SKP_MUL( Fs_Hz_in, 160 ) ) { /* Fs_out : Fs_in = 160 : 441 */
S->Coefs = silk_Resampler_160_441_ARMA4_COEFS;
S->resampler_function = silk_resampler_private_IIR_FIR;
S->Coefs = silk_Resampler_160_441_ARMA4_COEFS;
S->resampler_function = silk_resampler_private_IIR_FIR;
} else if( SKP_MUL( Fs_Hz_out, 441 ) == SKP_MUL( Fs_Hz_in, 240 ) ) { /* Fs_out : Fs_in = 240 : 441 */
S->Coefs = silk_Resampler_240_441_ARMA4_COEFS;
S->resampler_function = silk_resampler_private_IIR_FIR;
S->Coefs = silk_Resampler_240_441_ARMA4_COEFS;
S->resampler_function = silk_resampler_private_IIR_FIR;
} else if( SKP_MUL( Fs_Hz_out, 441 ) == SKP_MUL( Fs_Hz_in, 320 ) ) { /* Fs_out : Fs_in = 320 : 441 */
S->Coefs = silk_Resampler_320_441_ARMA4_COEFS;
S->resampler_function = silk_resampler_private_IIR_FIR;
S->Coefs = silk_Resampler_320_441_ARMA4_COEFS;
S->resampler_function = silk_resampler_private_IIR_FIR;
} else {
/* Default resampler */
S->resampler_function = silk_resampler_private_IIR_FIR;
/* Default resampler */
S->resampler_function = silk_resampler_private_IIR_FIR;
up2 = 1;
if( Fs_Hz_in > 24000 ) {
/* Low-quality all-pass upsampler */
@ -237,78 +237,78 @@ opus_int silk_resampler_init(
S->invRatio_Q16++;
}
S->magic_number = 123456789;
S->magic_number = 123456789;
return 0;
return 0;
}
/* Clear the states of all resampling filters, without resetting sampling rate ratio */
opus_int silk_resampler_clear(
silk_resampler_state_struct *S /* I/O: Resampler state */
silk_resampler_state_struct *S /* I/O: Resampler state */
)
{
/* Clear state */
SKP_memset( S->sDown2, 0, sizeof( S->sDown2 ) );
SKP_memset( S->sIIR, 0, sizeof( S->sIIR ) );
SKP_memset( S->sFIR, 0, sizeof( S->sFIR ) );
/* Clear state */
SKP_memset( S->sDown2, 0, sizeof( S->sDown2 ) );
SKP_memset( S->sIIR, 0, sizeof( S->sIIR ) );
SKP_memset( S->sFIR, 0, sizeof( S->sFIR ) );
#if RESAMPLER_SUPPORT_ABOVE_48KHZ
SKP_memset( S->sDownPre, 0, sizeof( S->sDownPre ) );
SKP_memset( S->sUpPost, 0, sizeof( S->sUpPost ) );
SKP_memset( S->sDownPre, 0, sizeof( S->sDownPre ) );
SKP_memset( S->sUpPost, 0, sizeof( S->sUpPost ) );
#endif
return 0;
}
/* Resampler: convert from one sampling rate to another */
opus_int silk_resampler(
silk_resampler_state_struct *S, /* I/O: Resampler state */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
silk_resampler_state_struct *S, /* I/O: Resampler state */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
)
{
/* Verify that state was initialized and has not been corrupted */
/* Verify that state was initialized and has not been corrupted */
if( S->magic_number != 123456789 ) {
SKP_assert( 0 );
return -1;
}
#if RESAMPLER_SUPPORT_ABOVE_48KHZ
if( S->nPreDownsamplers + S->nPostUpsamplers > 0 ) {
/* The input and/or output sampling rate is above 48000 Hz */
if( S->nPreDownsamplers + S->nPostUpsamplers > 0 ) {
/* The input and/or output sampling rate is above 48000 Hz */
opus_int32 nSamplesIn, nSamplesOut;
opus_int16 in_buf[ 480 ], out_buf[ 480 ];
opus_int16 in_buf[ 480 ], out_buf[ 480 ];
while( inLen > 0 ) {
/* Number of input and output samples to process */
nSamplesIn = SKP_min( inLen, S->batchSizePrePost );
nSamplesIn = SKP_min( inLen, S->batchSizePrePost );
nSamplesOut = SKP_SMULWB( S->ratio_Q16, nSamplesIn );
SKP_assert( SKP_RSHIFT32( nSamplesIn, S->nPreDownsamplers ) <= 480 );
SKP_assert( SKP_RSHIFT32( nSamplesOut, S->nPostUpsamplers ) <= 480 );
if( S->nPreDownsamplers > 0 ) {
if( S->nPreDownsamplers > 0 ) {
S->down_pre_function( S->sDownPre, in_buf, in, nSamplesIn );
if( S->nPostUpsamplers > 0 ) {
S->resampler_function( S, out_buf, in_buf, SKP_RSHIFT32( nSamplesIn, S->nPreDownsamplers ) );
if( S->nPostUpsamplers > 0 ) {
S->resampler_function( S, out_buf, in_buf, SKP_RSHIFT32( nSamplesIn, S->nPreDownsamplers ) );
S->up_post_function( S->sUpPost, out, out_buf, SKP_RSHIFT32( nSamplesOut, S->nPostUpsamplers ) );
} else {
S->resampler_function( S, out, in_buf, SKP_RSHIFT32( nSamplesIn, S->nPreDownsamplers ) );
S->resampler_function( S, out, in_buf, SKP_RSHIFT32( nSamplesIn, S->nPreDownsamplers ) );
}
} else {
S->resampler_function( S, out_buf, in, SKP_RSHIFT32( nSamplesIn, S->nPreDownsamplers ) );
S->resampler_function( S, out_buf, in, SKP_RSHIFT32( nSamplesIn, S->nPreDownsamplers ) );
S->up_post_function( S->sUpPost, out, out_buf, SKP_RSHIFT32( nSamplesOut, S->nPostUpsamplers ) );
}
in += nSamplesIn;
in += nSamplesIn;
out += nSamplesOut;
inLen -= nSamplesIn;
inLen -= nSamplesIn;
}
} else
} else
#endif
{
/* Input and output sampling rate are at most 48000 Hz */
S->resampler_function( S, out, in, inLen );
}
{
/* Input and output sampling rate are at most 48000 Hz */
S->resampler_function( S, out, in, inLen );
}
return 0;
return 0;
}

View file

@ -38,22 +38,22 @@ void silk_resampler_down3(
opus_int32 inLen /* I: Number of input samples */
)
{
opus_int32 nSamplesIn, counter, res_Q6;
opus_int32 buf[ RESAMPLER_MAX_BATCH_SIZE_IN + ORDER_FIR ];
opus_int32 *buf_ptr;
opus_int32 nSamplesIn, counter, res_Q6;
opus_int32 buf[ RESAMPLER_MAX_BATCH_SIZE_IN + ORDER_FIR ];
opus_int32 *buf_ptr;
/* Copy buffered samples to start of buffer */
SKP_memcpy( buf, S, ORDER_FIR * sizeof( opus_int32 ) );
/* Copy buffered samples to start of buffer */
SKP_memcpy( buf, S, ORDER_FIR * sizeof( opus_int32 ) );
/* Iterate over blocks of frameSizeIn input samples */
while( 1 ) {
nSamplesIn = SKP_min( inLen, RESAMPLER_MAX_BATCH_SIZE_IN );
/* Iterate over blocks of frameSizeIn input samples */
while( 1 ) {
nSamplesIn = SKP_min( inLen, RESAMPLER_MAX_BATCH_SIZE_IN );
/* Second-order AR filter (output in Q8) */
silk_resampler_private_AR2( &S[ ORDER_FIR ], &buf[ ORDER_FIR ], in,
/* Second-order AR filter (output in Q8) */
silk_resampler_private_AR2( &S[ ORDER_FIR ], &buf[ ORDER_FIR ], in,
silk_Resampler_1_3_COEFS_LQ, nSamplesIn );
/* Interpolate filtered signal */
/* Interpolate filtered signal */
buf_ptr = buf;
counter = nSamplesIn;
while( counter > 2 ) {
@ -69,17 +69,17 @@ void silk_resampler_down3(
counter -= 3;
}
in += nSamplesIn;
inLen -= nSamplesIn;
in += nSamplesIn;
inLen -= nSamplesIn;
if( inLen > 0 ) {
/* More iterations to do; copy last part of filtered signal to beginning of buffer */
SKP_memcpy( buf, &buf[ nSamplesIn ], ORDER_FIR * sizeof( opus_int32 ) );
} else {
break;
}
}
if( inLen > 0 ) {
/* More iterations to do; copy last part of filtered signal to beginning of buffer */
SKP_memcpy( buf, &buf[ nSamplesIn ], ORDER_FIR * sizeof( opus_int32 ) );
} else {
break;
}
}
/* Copy last part of filtered signal to the state for the next call */
SKP_memcpy( S, &buf[ nSamplesIn ], ORDER_FIR * sizeof( opus_int32 ) );
/* Copy last part of filtered signal to the state for the next call */
SKP_memcpy( S, &buf[ nSamplesIn ], ORDER_FIR * sizeof( opus_int32 ) );
}

View file

@ -39,33 +39,33 @@ extern "C" {
/* Number of input samples to process in the inner loop */
#define RESAMPLER_MAX_BATCH_SIZE_IN 480
/* Description: Hybrid IIR/FIR polyphase implementation of resampling */
/* Description: Hybrid IIR/FIR polyphase implementation of resampling */
void silk_resampler_private_IIR_FIR(
void *SS, /* I/O: Resampler state */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
void *SS, /* I/O: Resampler state */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
);
/* Description: Hybrid IIR/FIR polyphase implementation of resampling */
/* Description: Hybrid IIR/FIR polyphase implementation of resampling */
void silk_resampler_private_down_FIR(
void *SS, /* I/O: Resampler state */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
void *SS, /* I/O: Resampler state */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
);
/* Copy */
void silk_resampler_private_copy(
void *SS, /* I/O: Resampler state (unused) */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
void *SS, /* I/O: Resampler state (unused) */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
);
/* Upsample by a factor 2, high quality */
void silk_resampler_private_up2_HQ_wrapper(
void *SS, /* I/O: Resampler state (unused) */
void *SS, /* I/O: Resampler state (unused) */
opus_int16 *out, /* O: Output signal [ 2 * len ] */
const opus_int16 *in, /* I: Input signal [ len ] */
opus_int32 len /* I: Number of input samples */
@ -73,7 +73,7 @@ void silk_resampler_private_up2_HQ_wrapper(
/* Upsample by a factor 2, high quality */
void silk_resampler_private_up2_HQ(
opus_int32 *S, /* I/O: Resampler state [ 6 ] */
opus_int32 *S, /* I/O: Resampler state [ 6 ] */
opus_int16 *out, /* O: Output signal [ 2 * len ] */
const opus_int16 *in, /* I: Input signal [ len ] */
opus_int32 len /* I: Number of input samples */
@ -97,20 +97,20 @@ void silk_resampler_private_down4(
/* Second order AR filter */
void silk_resampler_private_AR2(
opus_int32 S[], /* I/O: State vector [ 2 ] */
opus_int32 out_Q8[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
const opus_int16 A_Q14[], /* I: AR coefficients, Q14 */
opus_int32 len /* I: Signal length */
opus_int32 S[], /* I/O: State vector [ 2 ] */
opus_int32 out_Q8[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
const opus_int16 A_Q14[], /* I: AR coefficients, Q14 */
opus_int32 len /* I: Signal length */
);
/* Fourth order ARMA filter */
void silk_resampler_private_ARMA4(
opus_int32 S[], /* I/O: State vector [ 4 ] */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
const opus_int16 Coef[], /* I: ARMA coefficients [ 7 ] */
opus_int32 len /* I: Signal length */
opus_int32 S[], /* I/O: State vector [ 4 ] */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
const opus_int16 Coef[], /* I: ARMA coefficients [ 7 ] */
opus_int32 len /* I: Signal length */
);

View file

@ -30,22 +30,22 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* Second order AR filter with single delay elements */
void silk_resampler_private_AR2(
opus_int32 S[], /* I/O: State vector [ 2 ] */
opus_int32 out_Q8[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
const opus_int16 A_Q14[], /* I: AR coefficients, Q14 */
opus_int32 len /* I: Signal length */
opus_int32 S[], /* I/O: State vector [ 2 ] */
opus_int32 out_Q8[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
const opus_int16 A_Q14[], /* I: AR coefficients, Q14 */
opus_int32 len /* I: Signal length */
)
{
opus_int32 k;
opus_int32 out32;
opus_int32 k;
opus_int32 out32;
for( k = 0; k < len; k++ ) {
out32 = SKP_ADD_LSHIFT32( S[ 0 ], (opus_int32)in[ k ], 8 );
out_Q8[ k ] = out32;
out32 = SKP_LSHIFT( out32, 2 );
S[ 0 ] = SKP_SMLAWB( S[ 1 ], out32, A_Q14[ 0 ] );
S[ 1 ] = SKP_SMULWB( out32, A_Q14[ 1 ] );
}
for( k = 0; k < len; k++ ) {
out32 = SKP_ADD_LSHIFT32( S[ 0 ], (opus_int32)in[ k ], 8 );
out_Q8[ k ] = out32;
out32 = SKP_LSHIFT( out32, 2 );
S[ 0 ] = SKP_SMLAWB( S[ 1 ], out32, A_Q14[ 0 ] );
S[ 1 ] = SKP_SMULWB( out32, A_Q14[ 1 ] );
}
}

View file

@ -36,17 +36,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* where it is assumed that B*_Q14[0], B*_Q14[2], A*_Q14[0] are all 16384 */
void silk_resampler_private_ARMA4(
opus_int32 S[], /* I/O: State vector [ 4 ] */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
const opus_int16 Coef[], /* I: ARMA coefficients [ 7 ] */
opus_int32 len /* I: Signal length */
opus_int32 S[], /* I/O: State vector [ 4 ] */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
const opus_int16 Coef[], /* I: ARMA coefficients [ 7 ] */
opus_int32 len /* I: Signal length */
)
{
opus_int32 k;
opus_int32 in_Q8, out1_Q8, out2_Q8, X;
opus_int32 k;
opus_int32 in_Q8, out1_Q8, out2_Q8, X;
for( k = 0; k < len; k++ ) {
for( k = 0; k < len; k++ ) {
in_Q8 = SKP_LSHIFT32( (opus_int32)in[ k ], 8 );
/* Outputs of first and second biquad */
@ -65,7 +65,7 @@ void silk_resampler_private_ARMA4(
/* Apply gain and store to output. The coefficient is in Q16 */
out[ k ] = (opus_int16)SKP_SAT16( SKP_RSHIFT32( SKP_SMLAWB( 128, out2_Q8, Coef[ 6 ] ), 8 ) );
}
}
}

View file

@ -29,12 +29,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "silk_resampler_private.h"
SKP_INLINE opus_int16 *silk_resampler_private_IIR_FIR_INTERPOL(
opus_int16 * out, opus_int16 * buf, opus_int32 max_index_Q16 , opus_int32 index_increment_Q16 ){
opus_int32 index_Q16, res_Q15;
opus_int16 *buf_ptr;
opus_int32 table_index;
/* Interpolate upsampled signal and store in output array */
for( index_Q16 = 0; index_Q16 < max_index_Q16; index_Q16 += index_increment_Q16 ) {
opus_int16 * out, opus_int16 * buf, opus_int32 max_index_Q16 , opus_int32 index_increment_Q16 ){
opus_int32 index_Q16, res_Q15;
opus_int16 *buf_ptr;
opus_int32 table_index;
/* Interpolate upsampled signal and store in output array */
for( index_Q16 = 0; index_Q16 < max_index_Q16; index_Q16 += index_increment_Q16 ) {
table_index = SKP_SMULWB( index_Q16 & 0xFFFF, 144 );
buf_ptr = &buf[ index_Q16 >> 16 ];
@ -44,54 +44,54 @@ SKP_INLINE opus_int16 *silk_resampler_private_IIR_FIR_INTERPOL(
res_Q15 = SKP_SMLABB( res_Q15, buf_ptr[ 3 ], silk_resampler_frac_FIR_144[ 143 - table_index ][ 2 ] );
res_Q15 = SKP_SMLABB( res_Q15, buf_ptr[ 4 ], silk_resampler_frac_FIR_144[ 143 - table_index ][ 1 ] );
res_Q15 = SKP_SMLABB( res_Q15, buf_ptr[ 5 ], silk_resampler_frac_FIR_144[ 143 - table_index ][ 0 ] );
*out++ = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q15, 15 ) );
}
return out;
*out++ = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q15, 15 ) );
}
return out;
}
/* Upsample using a combination of allpass-based 2x upsampling and FIR interpolation */
void silk_resampler_private_IIR_FIR(
void *SS, /* I/O: Resampler state */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
void *SS, /* I/O: Resampler state */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
)
{
silk_resampler_state_struct *S = (silk_resampler_state_struct *)SS;
opus_int32 nSamplesIn;
opus_int32 max_index_Q16, index_increment_Q16;
opus_int16 buf[ 2 * RESAMPLER_MAX_BATCH_SIZE_IN + RESAMPLER_ORDER_FIR_144 ];
opus_int32 nSamplesIn;
opus_int32 max_index_Q16, index_increment_Q16;
opus_int16 buf[ 2 * RESAMPLER_MAX_BATCH_SIZE_IN + RESAMPLER_ORDER_FIR_144 ];
/* Copy buffered samples to start of buffer */
SKP_memcpy( buf, S->sFIR, RESAMPLER_ORDER_FIR_144 * sizeof( opus_int32 ) );
/* Copy buffered samples to start of buffer */
SKP_memcpy( buf, S->sFIR, RESAMPLER_ORDER_FIR_144 * sizeof( opus_int32 ) );
/* Iterate over blocks of frameSizeIn input samples */
/* Iterate over blocks of frameSizeIn input samples */
index_increment_Q16 = S->invRatio_Q16;
while( 1 ) {
nSamplesIn = SKP_min( inLen, S->batchSize );
while( 1 ) {
nSamplesIn = SKP_min( inLen, S->batchSize );
if( S->input2x == 1 ) {
/* Upsample 2x */
/* Upsample 2x */
S->up2_function( S->sIIR, &buf[ RESAMPLER_ORDER_FIR_144 ], in, nSamplesIn );
} else {
/* Fourth-order ARMA filter */
/* Fourth-order ARMA filter */
silk_resampler_private_ARMA4( S->sIIR, &buf[ RESAMPLER_ORDER_FIR_144 ], in, S->Coefs, nSamplesIn );
}
max_index_Q16 = SKP_LSHIFT32( nSamplesIn, 16 + S->input2x ); /* +1 if 2x upsampling */
out = silk_resampler_private_IIR_FIR_INTERPOL(out, buf, max_index_Q16, index_increment_Q16);
in += nSamplesIn;
inLen -= nSamplesIn;
out = silk_resampler_private_IIR_FIR_INTERPOL(out, buf, max_index_Q16, index_increment_Q16);
in += nSamplesIn;
inLen -= nSamplesIn;
if( inLen > 0 ) {
/* More iterations to do; copy last part of filtered signal to beginning of buffer */
SKP_memcpy( buf, &buf[ nSamplesIn << S->input2x ], RESAMPLER_ORDER_FIR_144 * sizeof( opus_int32 ) );
} else {
break;
}
}
if( inLen > 0 ) {
/* More iterations to do; copy last part of filtered signal to beginning of buffer */
SKP_memcpy( buf, &buf[ nSamplesIn << S->input2x ], RESAMPLER_ORDER_FIR_144 * sizeof( opus_int32 ) );
} else {
break;
}
}
/* Copy last part of filtered signal to the state for the next call */
SKP_memcpy( S->sFIR, &buf[nSamplesIn << S->input2x ], RESAMPLER_ORDER_FIR_144 * sizeof( opus_int32 ) );
/* Copy last part of filtered signal to the state for the next call */
SKP_memcpy( S->sFIR, &buf[nSamplesIn << S->input2x ], RESAMPLER_ORDER_FIR_144 * sizeof( opus_int32 ) );
}

View file

@ -30,10 +30,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* Copy */
void silk_resampler_private_copy(
void *SS, /* I/O: Resampler state (unused) */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
void *SS, /* I/O: Resampler state (unused) */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
)
{
SKP_memcpy( out, in, inLen * sizeof( opus_int16 ) );

View file

@ -29,95 +29,95 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "silk_resampler_private.h"
SKP_INLINE opus_int16 *silk_resampler_private_down_FIR_INTERPOL0(
opus_int16 *out, opus_int32 *buf2, const opus_int16 *FIR_Coefs, opus_int32 max_index_Q16, opus_int32 index_increment_Q16){
opus_int16 *out, opus_int32 *buf2, const opus_int16 *FIR_Coefs, opus_int32 max_index_Q16, opus_int32 index_increment_Q16){
opus_int32 index_Q16, res_Q6;
opus_int32 *buf_ptr;
for( index_Q16 = 0; index_Q16 < max_index_Q16; index_Q16 += index_increment_Q16 ) {
/* Integer part gives pointer to buffered input */
buf_ptr = buf2 + SKP_RSHIFT( index_Q16, 16 );
opus_int32 index_Q16, res_Q6;
opus_int32 *buf_ptr;
for( index_Q16 = 0; index_Q16 < max_index_Q16; index_Q16 += index_increment_Q16 ) {
/* Integer part gives pointer to buffered input */
buf_ptr = buf2 + SKP_RSHIFT( index_Q16, 16 );
/* Inner product */
res_Q6 = SKP_SMULWB( SKP_ADD32( buf_ptr[ 0 ], buf_ptr[ 15 ] ), FIR_Coefs[ 0 ] );
res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 1 ], buf_ptr[ 14 ] ), FIR_Coefs[ 1 ] );
res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 2 ], buf_ptr[ 13 ] ), FIR_Coefs[ 2 ] );
res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 3 ], buf_ptr[ 12 ] ), FIR_Coefs[ 3 ] );
res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 4 ], buf_ptr[ 11 ] ), FIR_Coefs[ 4 ] );
res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 5 ], buf_ptr[ 10 ] ), FIR_Coefs[ 5 ] );
res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 6 ], buf_ptr[ 9 ] ), FIR_Coefs[ 6 ] );
res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 7 ], buf_ptr[ 8 ] ), FIR_Coefs[ 7 ] );
/* Inner product */
res_Q6 = SKP_SMULWB( SKP_ADD32( buf_ptr[ 0 ], buf_ptr[ 15 ] ), FIR_Coefs[ 0 ] );
res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 1 ], buf_ptr[ 14 ] ), FIR_Coefs[ 1 ] );
res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 2 ], buf_ptr[ 13 ] ), FIR_Coefs[ 2 ] );
res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 3 ], buf_ptr[ 12 ] ), FIR_Coefs[ 3 ] );
res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 4 ], buf_ptr[ 11 ] ), FIR_Coefs[ 4 ] );
res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 5 ], buf_ptr[ 10 ] ), FIR_Coefs[ 5 ] );
res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 6 ], buf_ptr[ 9 ] ), FIR_Coefs[ 6 ] );
res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 7 ], buf_ptr[ 8 ] ), FIR_Coefs[ 7 ] );
/* Scale down, saturate and store in output array */
*out++ = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q6, 6 ) );
}
return out;
/* Scale down, saturate and store in output array */
*out++ = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q6, 6 ) );
}
return out;
}
SKP_INLINE opus_int16 *silk_resampler_private_down_FIR_INTERPOL1(
opus_int16 *out, opus_int32 *buf2, const opus_int16 *FIR_Coefs, opus_int32 max_index_Q16, opus_int32 index_increment_Q16, opus_int32 FIR_Fracs){
opus_int16 *out, opus_int32 *buf2, const opus_int16 *FIR_Coefs, opus_int32 max_index_Q16, opus_int32 index_increment_Q16, opus_int32 FIR_Fracs){
opus_int32 index_Q16, res_Q6;
opus_int32 *buf_ptr;
opus_int32 interpol_ind;
const opus_int16 *interpol_ptr;
for( index_Q16 = 0; index_Q16 < max_index_Q16; index_Q16 += index_increment_Q16 ) {
/* Integer part gives pointer to buffered input */
buf_ptr = buf2 + SKP_RSHIFT( index_Q16, 16 );
opus_int32 index_Q16, res_Q6;
opus_int32 *buf_ptr;
opus_int32 interpol_ind;
const opus_int16 *interpol_ptr;
for( index_Q16 = 0; index_Q16 < max_index_Q16; index_Q16 += index_increment_Q16 ) {
/* Integer part gives pointer to buffered input */
buf_ptr = buf2 + SKP_RSHIFT( index_Q16, 16 );
/* Fractional part gives interpolation coefficients */
interpol_ind = SKP_SMULWB( index_Q16 & 0xFFFF, FIR_Fracs );
/* Fractional part gives interpolation coefficients */
interpol_ind = SKP_SMULWB( index_Q16 & 0xFFFF, FIR_Fracs );
/* Inner product */
interpol_ptr = &FIR_Coefs[ RESAMPLER_DOWN_ORDER_FIR / 2 * interpol_ind ];
res_Q6 = SKP_SMULWB( buf_ptr[ 0 ], interpol_ptr[ 0 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 1 ], interpol_ptr[ 1 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 2 ], interpol_ptr[ 2 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 3 ], interpol_ptr[ 3 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 4 ], interpol_ptr[ 4 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 5 ], interpol_ptr[ 5 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 6 ], interpol_ptr[ 6 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 7 ], interpol_ptr[ 7 ] );
interpol_ptr = &FIR_Coefs[ RESAMPLER_DOWN_ORDER_FIR / 2 * ( FIR_Fracs - 1 - interpol_ind ) ];
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 15 ], interpol_ptr[ 0 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 14 ], interpol_ptr[ 1 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 13 ], interpol_ptr[ 2 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 12 ], interpol_ptr[ 3 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 11 ], interpol_ptr[ 4 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 10 ], interpol_ptr[ 5 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 9 ], interpol_ptr[ 6 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 8 ], interpol_ptr[ 7 ] );
/* Inner product */
interpol_ptr = &FIR_Coefs[ RESAMPLER_DOWN_ORDER_FIR / 2 * interpol_ind ];
res_Q6 = SKP_SMULWB( buf_ptr[ 0 ], interpol_ptr[ 0 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 1 ], interpol_ptr[ 1 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 2 ], interpol_ptr[ 2 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 3 ], interpol_ptr[ 3 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 4 ], interpol_ptr[ 4 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 5 ], interpol_ptr[ 5 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 6 ], interpol_ptr[ 6 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 7 ], interpol_ptr[ 7 ] );
interpol_ptr = &FIR_Coefs[ RESAMPLER_DOWN_ORDER_FIR / 2 * ( FIR_Fracs - 1 - interpol_ind ) ];
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 15 ], interpol_ptr[ 0 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 14 ], interpol_ptr[ 1 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 13 ], interpol_ptr[ 2 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 12 ], interpol_ptr[ 3 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 11 ], interpol_ptr[ 4 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 10 ], interpol_ptr[ 5 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 9 ], interpol_ptr[ 6 ] );
res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 8 ], interpol_ptr[ 7 ] );
/* Scale down, saturate and store in output array */
*out++ = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q6, 6 ) );
}
return out;
/* Scale down, saturate and store in output array */
*out++ = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q6, 6 ) );
}
return out;
}
/* Resample with a 2x downsampler (optional), a 2nd order AR filter followed by FIR interpolation */
void silk_resampler_private_down_FIR(
void *SS, /* I/O: Resampler state */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
void *SS, /* I/O: Resampler state */
opus_int16 out[], /* O: Output signal */
const opus_int16 in[], /* I: Input signal */
opus_int32 inLen /* I: Number of input samples */
)
{
silk_resampler_state_struct *S = (silk_resampler_state_struct *)SS;
opus_int32 nSamplesIn;
opus_int32 max_index_Q16, index_increment_Q16;
opus_int16 buf1[ RESAMPLER_MAX_BATCH_SIZE_IN / 2 ];
opus_int32 buf2[ RESAMPLER_MAX_BATCH_SIZE_IN + RESAMPLER_DOWN_ORDER_FIR ];
const opus_int16 *FIR_Coefs;
opus_int32 nSamplesIn;
opus_int32 max_index_Q16, index_increment_Q16;
opus_int16 buf1[ RESAMPLER_MAX_BATCH_SIZE_IN / 2 ];
opus_int32 buf2[ RESAMPLER_MAX_BATCH_SIZE_IN + RESAMPLER_DOWN_ORDER_FIR ];
const opus_int16 *FIR_Coefs;
/* Copy buffered samples to start of buffer */
SKP_memcpy( buf2, S->sFIR, RESAMPLER_DOWN_ORDER_FIR * sizeof( opus_int32 ) );
/* Copy buffered samples to start of buffer */
SKP_memcpy( buf2, S->sFIR, RESAMPLER_DOWN_ORDER_FIR * sizeof( opus_int32 ) );
FIR_Coefs = &S->Coefs[ 2 ];
/* Iterate over blocks of frameSizeIn input samples */
/* Iterate over blocks of frameSizeIn input samples */
index_increment_Q16 = S->invRatio_Q16;
while( 1 ) {
nSamplesIn = SKP_min( inLen, S->batchSize );
while( 1 ) {
nSamplesIn = SKP_min( inLen, S->batchSize );
if( S->input2x == 1 ) {
/* Downsample 2x */
@ -125,34 +125,34 @@ void silk_resampler_private_down_FIR(
nSamplesIn = SKP_RSHIFT32( nSamplesIn, 1 );
/* Second-order AR filter (output in Q8) */
silk_resampler_private_AR2( S->sIIR, &buf2[ RESAMPLER_DOWN_ORDER_FIR ], buf1, S->Coefs, nSamplesIn );
/* Second-order AR filter (output in Q8) */
silk_resampler_private_AR2( S->sIIR, &buf2[ RESAMPLER_DOWN_ORDER_FIR ], buf1, S->Coefs, nSamplesIn );
} else {
/* Second-order AR filter (output in Q8) */
silk_resampler_private_AR2( S->sIIR, &buf2[ RESAMPLER_DOWN_ORDER_FIR ], in, S->Coefs, nSamplesIn );
/* Second-order AR filter (output in Q8) */
silk_resampler_private_AR2( S->sIIR, &buf2[ RESAMPLER_DOWN_ORDER_FIR ], in, S->Coefs, nSamplesIn );
}
max_index_Q16 = SKP_LSHIFT32( nSamplesIn, 16 );
/* Interpolate filtered signal */
/* Interpolate filtered signal */
if( S->FIR_Fracs == 1 ) {
out = silk_resampler_private_down_FIR_INTERPOL0(out, buf2, FIR_Coefs, max_index_Q16, index_increment_Q16);
out = silk_resampler_private_down_FIR_INTERPOL0(out, buf2, FIR_Coefs, max_index_Q16, index_increment_Q16);
} else {
out = silk_resampler_private_down_FIR_INTERPOL1(out, buf2, FIR_Coefs, max_index_Q16, index_increment_Q16, S->FIR_Fracs);
out = silk_resampler_private_down_FIR_INTERPOL1(out, buf2, FIR_Coefs, max_index_Q16, index_increment_Q16, S->FIR_Fracs);
}
in += nSamplesIn << S->input2x;
inLen -= nSamplesIn << S->input2x;
in += nSamplesIn << S->input2x;
inLen -= nSamplesIn << S->input2x;
if( inLen > S->input2x ) {
/* More iterations to do; copy last part of filtered signal to beginning of buffer */
SKP_memcpy( buf2, &buf2[ nSamplesIn ], RESAMPLER_DOWN_ORDER_FIR * sizeof( opus_int32 ) );
} else {
break;
}
}
if( inLen > S->input2x ) {
/* More iterations to do; copy last part of filtered signal to beginning of buffer */
SKP_memcpy( buf2, &buf2[ nSamplesIn ], RESAMPLER_DOWN_ORDER_FIR * sizeof( opus_int32 ) );
} else {
break;
}
}
/* Copy last part of filtered signal to the state for the next call */
SKP_memcpy( S->sFIR, &buf2[ nSamplesIn ], RESAMPLER_DOWN_ORDER_FIR * sizeof( opus_int32 ) );
/* Copy last part of filtered signal to the state for the next call */
SKP_memcpy( S->sFIR, &buf2[ nSamplesIn ], RESAMPLER_DOWN_ORDER_FIR * sizeof( opus_int32 ) );
}

View file

@ -32,7 +32,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* Uses 2nd order allpass filters for the 2x upsampling, followed by a */
/* notch filter just above Nyquist. */
void silk_resampler_private_up2_HQ(
opus_int32 *S, /* I/O: Resampler state [ 6 ] */
opus_int32 *S, /* I/O: Resampler state [ 6 ] */
opus_int16 *out, /* O: Output signal [ 2 * len ] */
const opus_int16 *in, /* I: Input signal [ len ] */
opus_int32 len /* I: Number of INPUT samples */
@ -98,7 +98,7 @@ void silk_resampler_private_up2_HQ(
}
void silk_resampler_private_up2_HQ_wrapper(
void *SS, /* I/O: Resampler state (unused) */
void *SS, /* I/O: Resampler state (unused) */
opus_int16 *out, /* O: Output signal [ 2 * len ] */
const opus_int16 *in, /* I: Input signal [ len ] */
opus_int32 len /* I: Number of input samples */

View file

@ -25,7 +25,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
/* Filter coefficients for IIR/FIR polyphase resampling *
/* Filter coefficients for IIR/FIR polyphase resampling *
* Total size: < 600 Words (1.2 kB) */
#include "silk_resampler_private.h"
@ -45,44 +45,44 @@ const opus_int16 silk_resampler_up2_hq_notch[ 4 ] = { 6554, -3932, 6554, 305
/* Tables with IIR and FIR coefficients for fractional downsamplers (90 Words) */
SKP_DWORD_ALIGN const opus_int16 silk_Resampler_3_4_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR / 2 ] = {
-20253, -13986,
86, 7, -151, 368, -542, 232, 11041, 21904,
39, 90, -181, 216, -17, -877, 6408, 19695,
2, 113, -108, 2, 314, -977, 2665, 15787,
-20253, -13986,
86, 7, -151, 368, -542, 232, 11041, 21904,
39, 90, -181, 216, -17, -877, 6408, 19695,
2, 113, -108, 2, 314, -977, 2665, 15787,
};
SKP_DWORD_ALIGN const opus_int16 silk_Resampler_2_3_COEFS[ 2 + 2 * RESAMPLER_DOWN_ORDER_FIR / 2 ] = {
-13997, -14120,
60, -174, 71, 298, -800, 659, 9238, 17461,
48, -40, -150, 314, -155, -845, 4188, 14293,
-13997, -14120,
60, -174, 71, 298, -800, 659, 9238, 17461,
48, -40, -150, 314, -155, -845, 4188, 14293,
};
SKP_DWORD_ALIGN const opus_int16 silk_Resampler_1_2_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR / 2 ] = {
1233, -14293,
-91, 162, 169, -342, -505, 1332, 5281, 8742,
1233, -14293,
-91, 162, 169, -342, -505, 1332, 5281, 8742,
};
SKP_DWORD_ALIGN const opus_int16 silk_Resampler_3_8_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR / 2 ] = {
12634, -14550,
246, -175, -326, -113, 764, 2209, 3664, 4402,
171, 3, -301, -258, 391, 1693, 3227, 4272,
88, 138, -236, -327, 95, 1203, 2733, 4022,
12634, -14550,
246, -175, -326, -113, 764, 2209, 3664, 4402,
171, 3, -301, -258, 391, 1693, 3227, 4272,
88, 138, -236, -327, 95, 1203, 2733, 4022,
};
SKP_DWORD_ALIGN const opus_int16 silk_Resampler_1_3_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR / 2 ] = {
16306, -14409,
99, -201, -220, -16, 572, 1483, 2433, 3043,
16306, -14409,
99, -201, -220, -16, 572, 1483, 2433, 3043,
};
SKP_DWORD_ALIGN const opus_int16 silk_Resampler_2_3_COEFS_LQ[ 2 + 2 * 2 ] = {
-2797, -6507,
4697, 10739,
1567, 8276,
-2797, -6507,
4697, 10739,
1567, 8276,
};
SKP_DWORD_ALIGN const opus_int16 silk_Resampler_1_3_COEFS_LQ[ 2 + 3 ] = {
16777, -9792,
890, 1614, 2148,
16777, -9792,
890, 1614, 2148,
};
@ -90,169 +90,169 @@ SKP_DWORD_ALIGN const opus_int16 silk_Resampler_1_3_COEFS_LQ[ 2 + 3 ] = {
/* { B1_Q14[1], B2_Q14[1], -A1_Q14[1], -A1_Q14[2], -A2_Q14[1], -A2_Q14[2], gain_Q16 } */
/* where it is assumed that B*_Q14[0], B*_Q14[2], A*_Q14[0] are all 16384 */
SKP_DWORD_ALIGN const opus_int16 silk_Resampler_320_441_ARMA4_COEFS[ 7 ] = {
31454, 24746, -9706, -3386, -17911, -13243, 24797
31454, 24746, -9706, -3386, -17911, -13243, 24797
};
SKP_DWORD_ALIGN const opus_int16 silk_Resampler_240_441_ARMA4_COEFS[ 7 ] = {
28721, 11254, 3189, -2546, -1495, -12618, 11562
28721, 11254, 3189, -2546, -1495, -12618, 11562
};
SKP_DWORD_ALIGN const opus_int16 silk_Resampler_160_441_ARMA4_COEFS[ 7 ] = {
23492, -6457, 14358, -4856, 14654, -13008, 4456
23492, -6457, 14358, -4856, 14654, -13008, 4456
};
SKP_DWORD_ALIGN const opus_int16 silk_Resampler_120_441_ARMA4_COEFS[ 7 ] = {
19311, -15569, 19489, -6950, 21441, -13559, 2370
19311, -15569, 19489, -6950, 21441, -13559, 2370
};
SKP_DWORD_ALIGN const opus_int16 silk_Resampler_80_441_ARMA4_COEFS[ 7 ] = {
13248, -23849, 24126, -9486, 26806, -14286, 1065
13248, -23849, 24126, -9486, 26806, -14286, 1065
};
/* Table with interplation fractions of 1/288 : 2/288 : 287/288 (432 Words) */
SKP_DWORD_ALIGN const opus_int16 silk_resampler_frac_FIR_144[ 144 ][ RESAMPLER_ORDER_FIR_144 / 2 ] = {
{ -25, 58, 32526},
{ -8, -69, 32461},
{ 8, -195, 32393},
{ 25, -318, 32321},
{ 41, -439, 32244},
{ 57, -557, 32163},
{ 72, -673, 32079},
{ 88, -787, 31990},
{ 103, -899, 31897},
{ 118, -1009, 31801},
{ 133, -1116, 31700},
{ 148, -1221, 31596},
{ 162, -1324, 31488},
{ 177, -1424, 31376},
{ 191, -1522, 31260},
{ 205, -1618, 31140},
{ 218, -1712, 31017},
{ 231, -1803, 30890},
{ 245, -1893, 30759},
{ 257, -1980, 30625},
{ 270, -2065, 30487},
{ 282, -2147, 30346},
{ 295, -2228, 30201},
{ 306, -2306, 30052},
{ 318, -2382, 29900},
{ 330, -2456, 29745},
{ 341, -2528, 29586},
{ 352, -2597, 29424},
{ 362, -2664, 29259},
{ 373, -2730, 29090},
{ 383, -2793, 28918},
{ 393, -2854, 28743},
{ 402, -2912, 28565},
{ 411, -2969, 28384},
{ 421, -3024, 28199},
{ 429, -3076, 28012},
{ 438, -3126, 27822},
{ 446, -3175, 27628},
{ 454, -3221, 27432},
{ 462, -3265, 27233},
{ 469, -3307, 27031},
{ 476, -3348, 26826},
{ 483, -3386, 26619},
{ 490, -3422, 26409},
{ 496, -3456, 26196},
{ 502, -3488, 25981},
{ 508, -3518, 25763},
{ 514, -3547, 25543},
{ 519, -3573, 25320},
{ 524, -3597, 25095},
{ 529, -3620, 24867},
{ 533, -3640, 24637},
{ 538, -3659, 24405},
{ 541, -3676, 24171},
{ 545, -3691, 23934},
{ 548, -3704, 23696},
{ 552, -3716, 23455},
{ 554, -3726, 23212},
{ 557, -3733, 22967},
{ 559, -3740, 22721},
{ 561, -3744, 22472},
{ 563, -3747, 22222},
{ 565, -3748, 21970},
{ 566, -3747, 21716},
{ 567, -3745, 21460},
{ 568, -3741, 21203},
{ 568, -3735, 20944},
{ 568, -3728, 20684},
{ 568, -3719, 20422},
{ 568, -3708, 20159},
{ 568, -3697, 19894},
{ 567, -3683, 19628},
{ 566, -3668, 19361},
{ 564, -3652, 19093},
{ 563, -3634, 18823},
{ 561, -3614, 18552},
{ 559, -3594, 18280},
{ 557, -3571, 18008},
{ 554, -3548, 17734},
{ 552, -3523, 17459},
{ 549, -3497, 17183},
{ 546, -3469, 16907},
{ 542, -3440, 16630},
{ 539, -3410, 16352},
{ 535, -3379, 16074},
{ 531, -3346, 15794},
{ 527, -3312, 15515},
{ 522, -3277, 15235},
{ 517, -3241, 14954},
{ 513, -3203, 14673},
{ 507, -3165, 14392},
{ 502, -3125, 14110},
{ 497, -3085, 13828},
{ 491, -3043, 13546},
{ 485, -3000, 13264},
{ 479, -2957, 12982},
{ 473, -2912, 12699},
{ 466, -2867, 12417},
{ 460, -2820, 12135},
{ 453, -2772, 11853},
{ 446, -2724, 11571},
{ 439, -2675, 11289},
{ 432, -2625, 11008},
{ 424, -2574, 10727},
{ 417, -2522, 10446},
{ 409, -2470, 10166},
{ 401, -2417, 9886},
{ 393, -2363, 9607},
{ 385, -2309, 9328},
{ 376, -2253, 9050},
{ 368, -2198, 8773},
{ 359, -2141, 8497},
{ 351, -2084, 8221},
{ 342, -2026, 7946},
{ 333, -1968, 7672},
{ 324, -1910, 7399},
{ 315, -1850, 7127},
{ 305, -1791, 6856},
{ 296, -1731, 6586},
{ 286, -1670, 6317},
{ 277, -1609, 6049},
{ 267, -1548, 5783},
{ 257, -1486, 5517},
{ 247, -1424, 5254},
{ 237, -1362, 4991},
{ 227, -1300, 4730},
{ 217, -1237, 4470},
{ 207, -1174, 4212},
{ 197, -1110, 3956},
{ 187, -1047, 3701},
{ 176, -984, 3448},
{ 166, -920, 3196},
{ 155, -856, 2946},
{ 145, -792, 2698},
{ 134, -728, 2452},
{ 124, -664, 2207},
{ 113, -600, 1965},
{ 102, -536, 1724},
{ 92, -472, 1486},
{ 81, -408, 1249},
{ 70, -345, 1015},
{ 60, -281, 783},
{ 49, -217, 553},
{ 38, -154, 325},
{ -25, 58, 32526},
{ -8, -69, 32461},
{ 8, -195, 32393},
{ 25, -318, 32321},
{ 41, -439, 32244},
{ 57, -557, 32163},
{ 72, -673, 32079},
{ 88, -787, 31990},
{ 103, -899, 31897},
{ 118, -1009, 31801},
{ 133, -1116, 31700},
{ 148, -1221, 31596},
{ 162, -1324, 31488},
{ 177, -1424, 31376},
{ 191, -1522, 31260},
{ 205, -1618, 31140},
{ 218, -1712, 31017},
{ 231, -1803, 30890},
{ 245, -1893, 30759},
{ 257, -1980, 30625},
{ 270, -2065, 30487},
{ 282, -2147, 30346},
{ 295, -2228, 30201},
{ 306, -2306, 30052},
{ 318, -2382, 29900},
{ 330, -2456, 29745},
{ 341, -2528, 29586},
{ 352, -2597, 29424},
{ 362, -2664, 29259},
{ 373, -2730, 29090},
{ 383, -2793, 28918},
{ 393, -2854, 28743},
{ 402, -2912, 28565},
{ 411, -2969, 28384},
{ 421, -3024, 28199},
{ 429, -3076, 28012},
{ 438, -3126, 27822},
{ 446, -3175, 27628},
{ 454, -3221, 27432},
{ 462, -3265, 27233},
{ 469, -3307, 27031},
{ 476, -3348, 26826},
{ 483, -3386, 26619},
{ 490, -3422, 26409},
{ 496, -3456, 26196},
{ 502, -3488, 25981},
{ 508, -3518, 25763},
{ 514, -3547, 25543},
{ 519, -3573, 25320},
{ 524, -3597, 25095},
{ 529, -3620, 24867},
{ 533, -3640, 24637},
{ 538, -3659, 24405},
{ 541, -3676, 24171},
{ 545, -3691, 23934},
{ 548, -3704, 23696},
{ 552, -3716, 23455},
{ 554, -3726, 23212},
{ 557, -3733, 22967},
{ 559, -3740, 22721},
{ 561, -3744, 22472},
{ 563, -3747, 22222},
{ 565, -3748, 21970},
{ 566, -3747, 21716},
{ 567, -3745, 21460},
{ 568, -3741, 21203},
{ 568, -3735, 20944},
{ 568, -3728, 20684},
{ 568, -3719, 20422},
{ 568, -3708, 20159},
{ 568, -3697, 19894},
{ 567, -3683, 19628},
{ 566, -3668, 19361},
{ 564, -3652, 19093},
{ 563, -3634, 18823},
{ 561, -3614, 18552},
{ 559, -3594, 18280},
{ 557, -3571, 18008},
{ 554, -3548, 17734},
{ 552, -3523, 17459},
{ 549, -3497, 17183},
{ 546, -3469, 16907},
{ 542, -3440, 16630},
{ 539, -3410, 16352},
{ 535, -3379, 16074},
{ 531, -3346, 15794},
{ 527, -3312, 15515},
{ 522, -3277, 15235},
{ 517, -3241, 14954},
{ 513, -3203, 14673},
{ 507, -3165, 14392},
{ 502, -3125, 14110},
{ 497, -3085, 13828},
{ 491, -3043, 13546},
{ 485, -3000, 13264},
{ 479, -2957, 12982},
{ 473, -2912, 12699},
{ 466, -2867, 12417},
{ 460, -2820, 12135},
{ 453, -2772, 11853},
{ 446, -2724, 11571},
{ 439, -2675, 11289},
{ 432, -2625, 11008},
{ 424, -2574, 10727},
{ 417, -2522, 10446},
{ 409, -2470, 10166},
{ 401, -2417, 9886},
{ 393, -2363, 9607},
{ 385, -2309, 9328},
{ 376, -2253, 9050},
{ 368, -2198, 8773},
{ 359, -2141, 8497},
{ 351, -2084, 8221},
{ 342, -2026, 7946},
{ 333, -1968, 7672},
{ 324, -1910, 7399},
{ 315, -1850, 7127},
{ 305, -1791, 6856},
{ 296, -1731, 6586},
{ 286, -1670, 6317},
{ 277, -1609, 6049},
{ 267, -1548, 5783},
{ 257, -1486, 5517},
{ 247, -1424, 5254},
{ 237, -1362, 4991},
{ 227, -1300, 4730},
{ 217, -1237, 4470},
{ 207, -1174, 4212},
{ 197, -1110, 3956},
{ 187, -1047, 3701},
{ 176, -984, 3448},
{ 166, -920, 3196},
{ 155, -856, 2946},
{ 145, -792, 2698},
{ 134, -728, 2452},
{ 124, -664, 2207},
{ 113, -600, 1965},
{ 102, -536, 1724},
{ 92, -472, 1486},
{ 81, -408, 1249},
{ 70, -345, 1015},
{ 60, -281, 783},
{ 49, -217, 553},
{ 38, -154, 325},
};

View file

@ -40,27 +40,27 @@ extern "C" {
typedef struct _silk_resampler_state_struct{
opus_int32 sIIR[ SILK_RESAMPLER_MAX_IIR_ORDER ]; /* this must be the first element of this struct */
opus_int32 sFIR[ SILK_RESAMPLER_MAX_FIR_ORDER ];
opus_int32 sDown2[ 2 ];
void (*resampler_function)( void *, opus_int16 *, const opus_int16 *, opus_int32 );
void (*up2_function)( opus_int32 *, opus_int16 *, const opus_int16 *, opus_int32 );
opus_int32 sIIR[ SILK_RESAMPLER_MAX_IIR_ORDER ]; /* this must be the first element of this struct */
opus_int32 sFIR[ SILK_RESAMPLER_MAX_FIR_ORDER ];
opus_int32 sDown2[ 2 ];
void (*resampler_function)( void *, opus_int16 *, const opus_int16 *, opus_int32 );
void (*up2_function)( opus_int32 *, opus_int16 *, const opus_int16 *, opus_int32 );
opus_int32 batchSize;
opus_int32 invRatio_Q16;
opus_int32 FIR_Fracs;
opus_int32 invRatio_Q16;
opus_int32 FIR_Fracs;
opus_int32 input2x;
const opus_int16 *Coefs;
const opus_int16 *Coefs;
#if RESAMPLER_SUPPORT_ABOVE_48KHZ
opus_int32 sDownPre[ 2 ];
opus_int32 sUpPost[ 2 ];
void (*down_pre_function)( opus_int32 *, opus_int16 *, const opus_int16 *, opus_int32 );
void (*up_post_function)( opus_int32 *, opus_int16 *, const opus_int16 *, opus_int32 );
opus_int32 batchSizePrePost;
opus_int32 ratio_Q16;
opus_int32 nPreDownsamplers;
opus_int32 nPostUpsamplers;
opus_int32 sDownPre[ 2 ];
opus_int32 sUpPost[ 2 ];
void (*down_pre_function)( opus_int32 *, opus_int16 *, const opus_int16 *, opus_int32 );
void (*up_post_function)( opus_int32 *, opus_int16 *, const opus_int16 *, opus_int32 );
opus_int32 batchSizePrePost;
opus_int32 ratio_Q16;
opus_int32 nPreDownsamplers;
opus_int32 nPostUpsamplers;
#endif
opus_int32 magic_number;
opus_int32 magic_number;
} silk_resampler_state_struct;
#ifdef __cplusplus

View file

@ -177,7 +177,7 @@ typedef struct {
opus_int NLSF_MSVQ_Survivors; /* Number of survivors in NLSF MSVQ */
opus_int first_frame_after_reset; /* Flag for deactivating NLSF interp. and fluc. reduction after resets */
opus_int controlled_since_last_payload; /* Flag for ensuring codec_control only runs once per packet */
opus_int warping_Q16; /* Warping parameter for warped noise shaping */
opus_int warping_Q16; /* Warping parameter for warped noise shaping */
opus_int useCBR; /* Flag to enable constant bitrate */
opus_int prefillFlag; /* Flag to indicate that only buffers are prefilled, no coding */
const opus_uint8 *pitch_lag_low_bits_iCDF; /* Pointer to iCDF table for low bits of pitch lag index */
@ -192,7 +192,7 @@ typedef struct {
opus_int LBRR_flags[ MAX_FRAMES_PER_PACKET ];
SideInfoIndices indices;
opus_int8 pulses[ MAX_FRAME_LENGTH ];
opus_int8 pulses[ MAX_FRAME_LENGTH ];
/* Input/output buffering */
opus_int16 inputBuf__[ MAX_FRAME_LENGTH + 2 ]; /* Buffer containing input signal */
@ -224,7 +224,7 @@ typedef struct {
opus_int LBRR_enabled; /* Depends on useInBandFRC, bitrate and packet loss rate */
opus_int LBRR_GainIncreases; /* Gains increment for coding LBRR frames */
SideInfoIndices indices_LBRR[ MAX_FRAMES_PER_PACKET ];
opus_int8 pulses_LBRR[ MAX_FRAMES_PER_PACKET ][ MAX_FRAME_LENGTH ];
opus_int8 pulses_LBRR[ MAX_FRAMES_PER_PACKET ][ MAX_FRAME_LENGTH ];
} silk_encoder_state;

View file

@ -28,41 +28,41 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "silk_tables.h"
const opus_uint8 silk_LTP_per_index_iCDF[3] = {
179, 99, 0
179, 99, 0
};
const opus_uint8 silk_LTP_gain_iCDF_0[8] = {
71, 56, 43, 30, 21, 12, 6, 0
71, 56, 43, 30, 21, 12, 6, 0
};
const opus_uint8 silk_LTP_gain_iCDF_1[16] = {
199, 165, 144, 124, 109, 96, 84, 71,
61, 51, 42, 32, 23, 15, 8, 0
199, 165, 144, 124, 109, 96, 84, 71,
61, 51, 42, 32, 23, 15, 8, 0
};
const opus_uint8 silk_LTP_gain_iCDF_2[32] = {
241, 225, 211, 199, 187, 175, 164, 153,
142, 132, 123, 114, 105, 96, 88, 80,
72, 64, 57, 50, 44, 38, 33, 29,
24, 20, 16, 12, 9, 5, 2, 0
241, 225, 211, 199, 187, 175, 164, 153,
142, 132, 123, 114, 105, 96, 88, 80,
72, 64, 57, 50, 44, 38, 33, 29,
24, 20, 16, 12, 9, 5, 2, 0
};
const opus_int16 silk_LTP_gain_middle_avg_RD_Q14 = 12304;
const opus_uint8 silk_LTP_gain_BITS_Q5_0[8] = {
15, 131, 138, 138, 155, 155, 173, 173
15, 131, 138, 138, 155, 155, 173, 173
};
const opus_uint8 silk_LTP_gain_BITS_Q5_1[16] = {
69, 93, 115, 118, 131, 138, 141, 138,
150, 150, 155, 150, 155, 160, 166, 160
69, 93, 115, 118, 131, 138, 141, 138,
150, 150, 155, 150, 155, 160, 166, 160
};
const opus_uint8 silk_LTP_gain_BITS_Q5_2[32] = {
131, 128, 134, 141, 141, 141, 145, 145,
145, 150, 155, 155, 155, 155, 160, 160,
160, 160, 166, 166, 173, 173, 182, 192,
182, 192, 192, 192, 205, 192, 205, 224
131, 128, 134, 141, 141, 141, 145, 145,
145, 150, 155, 155, 155, 155, 160, 160,
160, 160, 166, 166, 173, 173, 182, 192,
182, 192, 192, 192, 205, 192, 205, 224
};
const opus_uint8 * const silk_LTP_gain_iCDF_ptrs[NB_LTP_CBKS] = {
@ -80,180 +80,180 @@ const opus_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[NB_LTP_CBKS] = {
const opus_int8 silk_LTP_gain_vq_0[8][5] =
{
{
4, 6, 24, 7, 5
4, 6, 24, 7, 5
},
{
0, 0, 2, 0, 0
0, 0, 2, 0, 0
},
{
12, 28, 41, 13, -4
12, 28, 41, 13, -4
},
{
-9, 15, 42, 25, 14
-9, 15, 42, 25, 14
},
{
1, -2, 62, 41, -9
1, -2, 62, 41, -9
},
{
-10, 37, 65, -4, 3
-10, 37, 65, -4, 3
},
{
-6, 4, 66, 7, -8
-6, 4, 66, 7, -8
},
{
16, 14, 38, -3, 33
16, 14, 38, -3, 33
}
};
const opus_int8 silk_LTP_gain_vq_1[16][5] =
{
{
13, 22, 39, 23, 12
13, 22, 39, 23, 12
},
{
-1, 36, 64, 27, -6
-1, 36, 64, 27, -6
},
{
-7, 10, 55, 43, 17
-7, 10, 55, 43, 17
},
{
1, 1, 8, 1, 1
1, 1, 8, 1, 1
},
{
6, -11, 74, 53, -9
6, -11, 74, 53, -9
},
{
-12, 55, 76, -12, 8
-12, 55, 76, -12, 8
},
{
-3, 3, 93, 27, -4
-3, 3, 93, 27, -4
},
{
26, 39, 59, 3, -8
26, 39, 59, 3, -8
},
{
2, 0, 77, 11, 9
2, 0, 77, 11, 9
},
{
-8, 22, 44, -6, 7
-8, 22, 44, -6, 7
},
{
40, 9, 26, 3, 9
40, 9, 26, 3, 9
},
{
-7, 20, 101, -7, 4
-7, 20, 101, -7, 4
},
{
3, -8, 42, 26, 0
3, -8, 42, 26, 0
},
{
-15, 33, 68, 2, 23
-15, 33, 68, 2, 23
},
{
-2, 55, 46, -2, 15
-2, 55, 46, -2, 15
},
{
3, -1, 21, 16, 41
3, -1, 21, 16, 41
}
};
const opus_int8 silk_LTP_gain_vq_2[32][5] =
{
{
-6, 27, 61, 39, 5
-6, 27, 61, 39, 5
},
{
-11, 42, 88, 4, 1
-11, 42, 88, 4, 1
},
{
-2, 60, 65, 6, -4
-2, 60, 65, 6, -4
},
{
-1, -5, 73, 56, 1
-1, -5, 73, 56, 1
},
{
-9, 19, 94, 29, -9
-9, 19, 94, 29, -9
},
{
0, 12, 99, 6, 4
0, 12, 99, 6, 4
},
{
8, -19, 102, 46, -13
8, -19, 102, 46, -13
},
{
3, 2, 13, 3, 2
3, 2, 13, 3, 2
},
{
9, -21, 84, 72, -18
9, -21, 84, 72, -18
},
{
-11, 46, 104, -22, 8
-11, 46, 104, -22, 8
},
{
18, 38, 48, 23, 0
18, 38, 48, 23, 0
},
{
-16, 70, 83, -21, 11
-16, 70, 83, -21, 11
},
{
5, -11, 117, 22, -8
5, -11, 117, 22, -8
},
{
-6, 23, 117, -12, 3
-6, 23, 117, -12, 3
},
{
3, -8, 95, 28, 4
3, -8, 95, 28, 4
},
{
-10, 15, 77, 60, -15
-10, 15, 77, 60, -15
},
{
-1, 4, 124, 2, -4
-1, 4, 124, 2, -4
},
{
3, 38, 84, 24, -25
3, 38, 84, 24, -25
},
{
2, 13, 42, 13, 31
2, 13, 42, 13, 31
},
{
21, -4, 56, 46, -1
21, -4, 56, 46, -1
},
{
-1, 35, 79, -13, 19
-1, 35, 79, -13, 19
},
{
-7, 65, 88, -9, -14
-7, 65, 88, -9, -14
},
{
20, 4, 81, 49, -29
20, 4, 81, 49, -29
},
{
20, 0, 75, 3, -17
20, 0, 75, 3, -17
},
{
5, -9, 44, 92, -8
5, -9, 44, 92, -8
},
{
1, -3, 22, 69, 31
1, -3, 22, 69, 31
},
{
-6, 95, 41, -12, 5
-6, 95, 41, -12, 5
},
{
39, 67, 16, -4, 1
39, 67, 16, -4, 1
},
{
0, -6, 120, 55, -36
0, -6, 120, 55, -36
},
{
-13, 44, 122, 4, -24
-13, 44, 122, 4, -24
},
{
81, 5, 11, 3, 7
81, 5, 11, 3, 7
},
{
2, 0, 9, 10, 88
2, 0, 9, 10, 88
}
};

View file

@ -28,115 +28,115 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "silk_structs.h"
const opus_uint8 silk_NLSF_CB1_NB_MB_Q8[ 320 ] = {
12, 35, 60, 83, 108, 132, 157, 180,
206, 228, 15, 32, 55, 77, 101, 125,
151, 175, 201, 225, 19, 42, 66, 89,
114, 137, 162, 184, 209, 230, 12, 25,
50, 72, 97, 120, 147, 172, 200, 223,
26, 44, 69, 90, 114, 135, 159, 180,
205, 225, 13, 22, 53, 80, 106, 130,
156, 180, 205, 228, 15, 25, 44, 64,
90, 115, 142, 168, 196, 222, 19, 24,
62, 82, 100, 120, 145, 168, 190, 214,
22, 31, 50, 79, 103, 120, 151, 170,
203, 227, 21, 29, 45, 65, 106, 124,
150, 171, 196, 224, 30, 49, 75, 97,
121, 142, 165, 186, 209, 229, 19, 25,
52, 70, 93, 116, 143, 166, 192, 219,
26, 34, 62, 75, 97, 118, 145, 167,
194, 217, 25, 33, 56, 70, 91, 113,
143, 165, 196, 223, 21, 34, 51, 72,
97, 117, 145, 171, 196, 222, 20, 29,
50, 67, 90, 117, 144, 168, 197, 221,
22, 31, 48, 66, 95, 117, 146, 168,
196, 222, 24, 33, 51, 77, 116, 134,
158, 180, 200, 224, 21, 28, 70, 87,
106, 124, 149, 170, 194, 217, 26, 33,
53, 64, 83, 117, 152, 173, 204, 225,
27, 34, 65, 95, 108, 129, 155, 174,
210, 225, 20, 26, 72, 99, 113, 131,
154, 176, 200, 219, 34, 43, 61, 78,
93, 114, 155, 177, 205, 229, 23, 29,
54, 97, 124, 138, 163, 179, 209, 229,
30, 38, 56, 89, 118, 129, 158, 178,
200, 231, 21, 29, 49, 63, 85, 111,
142, 163, 193, 222, 27, 48, 77, 103,
133, 158, 179, 196, 215, 232, 29, 47,
74, 99, 124, 151, 176, 198, 220, 237,
33, 42, 61, 76, 93, 121, 155, 174,
207, 225, 29, 53, 87, 112, 136, 154,
170, 188, 208, 227, 24, 30, 52, 84,
131, 150, 166, 186, 203, 229, 37, 48,
64, 84, 104, 118, 156, 177, 201, 230
12, 35, 60, 83, 108, 132, 157, 180,
206, 228, 15, 32, 55, 77, 101, 125,
151, 175, 201, 225, 19, 42, 66, 89,
114, 137, 162, 184, 209, 230, 12, 25,
50, 72, 97, 120, 147, 172, 200, 223,
26, 44, 69, 90, 114, 135, 159, 180,
205, 225, 13, 22, 53, 80, 106, 130,
156, 180, 205, 228, 15, 25, 44, 64,
90, 115, 142, 168, 196, 222, 19, 24,
62, 82, 100, 120, 145, 168, 190, 214,
22, 31, 50, 79, 103, 120, 151, 170,
203, 227, 21, 29, 45, 65, 106, 124,
150, 171, 196, 224, 30, 49, 75, 97,
121, 142, 165, 186, 209, 229, 19, 25,
52, 70, 93, 116, 143, 166, 192, 219,
26, 34, 62, 75, 97, 118, 145, 167,
194, 217, 25, 33, 56, 70, 91, 113,
143, 165, 196, 223, 21, 34, 51, 72,
97, 117, 145, 171, 196, 222, 20, 29,
50, 67, 90, 117, 144, 168, 197, 221,
22, 31, 48, 66, 95, 117, 146, 168,
196, 222, 24, 33, 51, 77, 116, 134,
158, 180, 200, 224, 21, 28, 70, 87,
106, 124, 149, 170, 194, 217, 26, 33,
53, 64, 83, 117, 152, 173, 204, 225,
27, 34, 65, 95, 108, 129, 155, 174,
210, 225, 20, 26, 72, 99, 113, 131,
154, 176, 200, 219, 34, 43, 61, 78,
93, 114, 155, 177, 205, 229, 23, 29,
54, 97, 124, 138, 163, 179, 209, 229,
30, 38, 56, 89, 118, 129, 158, 178,
200, 231, 21, 29, 49, 63, 85, 111,
142, 163, 193, 222, 27, 48, 77, 103,
133, 158, 179, 196, 215, 232, 29, 47,
74, 99, 124, 151, 176, 198, 220, 237,
33, 42, 61, 76, 93, 121, 155, 174,
207, 225, 29, 53, 87, 112, 136, 154,
170, 188, 208, 227, 24, 30, 52, 84,
131, 150, 166, 186, 203, 229, 37, 48,
64, 84, 104, 118, 156, 177, 201, 230
};
const opus_uint8 silk_NLSF_CB1_iCDF_NB_MB[ 64 ] = {
212, 178, 148, 129, 108, 96, 85, 82,
79, 77, 61, 59, 57, 56, 51, 49,
48, 45, 42, 41, 40, 38, 36, 34,
31, 30, 21, 12, 10, 3, 1, 0,
255, 245, 244, 236, 233, 225, 217, 203,
190, 176, 175, 161, 149, 136, 125, 114,
102, 91, 81, 71, 60, 52, 43, 35,
28, 20, 19, 18, 12, 11, 5, 0
212, 178, 148, 129, 108, 96, 85, 82,
79, 77, 61, 59, 57, 56, 51, 49,
48, 45, 42, 41, 40, 38, 36, 34,
31, 30, 21, 12, 10, 3, 1, 0,
255, 245, 244, 236, 233, 225, 217, 203,
190, 176, 175, 161, 149, 136, 125, 114,
102, 91, 81, 71, 60, 52, 43, 35,
28, 20, 19, 18, 12, 11, 5, 0
};
const opus_uint8 silk_NLSF_CB2_SELECT_NB_MB[ 160 ] = {
16, 0, 0, 0, 0, 99, 66, 36,
36, 34, 36, 34, 34, 34, 34, 83,
69, 36, 52, 34, 116, 102, 70, 68,
68, 176, 102, 68, 68, 34, 65, 85,
68, 84, 36, 116, 141, 152, 139, 170,
132, 187, 184, 216, 137, 132, 249, 168,
185, 139, 104, 102, 100, 68, 68, 178,
218, 185, 185, 170, 244, 216, 187, 187,
170, 244, 187, 187, 219, 138, 103, 155,
184, 185, 137, 116, 183, 155, 152, 136,
132, 217, 184, 184, 170, 164, 217, 171,
155, 139, 244, 169, 184, 185, 170, 164,
216, 223, 218, 138, 214, 143, 188, 218,
168, 244, 141, 136, 155, 170, 168, 138,
220, 219, 139, 164, 219, 202, 216, 137,
168, 186, 246, 185, 139, 116, 185, 219,
185, 138, 100, 100, 134, 100, 102, 34,
68, 68, 100, 68, 168, 203, 221, 218,
168, 167, 154, 136, 104, 70, 164, 246,
171, 137, 139, 137, 155, 218, 219, 139
16, 0, 0, 0, 0, 99, 66, 36,
36, 34, 36, 34, 34, 34, 34, 83,
69, 36, 52, 34, 116, 102, 70, 68,
68, 176, 102, 68, 68, 34, 65, 85,
68, 84, 36, 116, 141, 152, 139, 170,
132, 187, 184, 216, 137, 132, 249, 168,
185, 139, 104, 102, 100, 68, 68, 178,
218, 185, 185, 170, 244, 216, 187, 187,
170, 244, 187, 187, 219, 138, 103, 155,
184, 185, 137, 116, 183, 155, 152, 136,
132, 217, 184, 184, 170, 164, 217, 171,
155, 139, 244, 169, 184, 185, 170, 164,
216, 223, 218, 138, 214, 143, 188, 218,
168, 244, 141, 136, 155, 170, 168, 138,
220, 219, 139, 164, 219, 202, 216, 137,
168, 186, 246, 185, 139, 116, 185, 219,
185, 138, 100, 100, 134, 100, 102, 34,
68, 68, 100, 68, 168, 203, 221, 218,
168, 167, 154, 136, 104, 70, 164, 246,
171, 137, 139, 137, 155, 218, 219, 139
};
const opus_uint8 silk_NLSF_CB2_iCDF_NB_MB[ 72 ] = {
255, 254, 253, 238, 14, 3, 2, 1,
0, 255, 254, 252, 218, 35, 3, 2,
1, 0, 255, 254, 250, 208, 59, 4,
2, 1, 0, 255, 254, 246, 194, 71,
10, 2, 1, 0, 255, 252, 236, 183,
82, 8, 2, 1, 0, 255, 252, 235,
180, 90, 17, 2, 1, 0, 255, 248,
224, 171, 97, 30, 4, 1, 0, 255,
254, 236, 173, 95, 37, 7, 1, 0
255, 254, 253, 238, 14, 3, 2, 1,
0, 255, 254, 252, 218, 35, 3, 2,
1, 0, 255, 254, 250, 208, 59, 4,
2, 1, 0, 255, 254, 246, 194, 71,
10, 2, 1, 0, 255, 252, 236, 183,
82, 8, 2, 1, 0, 255, 252, 235,
180, 90, 17, 2, 1, 0, 255, 248,
224, 171, 97, 30, 4, 1, 0, 255,
254, 236, 173, 95, 37, 7, 1, 0
};
const opus_uint8 silk_NLSF_CB2_BITS_NB_MB_Q5[ 72 ] = {
255, 255, 255, 131, 6, 145, 255, 255,
255, 255, 255, 236, 93, 15, 96, 255,
255, 255, 255, 255, 194, 83, 25, 71,
221, 255, 255, 255, 255, 162, 73, 34,
66, 162, 255, 255, 255, 210, 126, 73,
43, 57, 173, 255, 255, 255, 201, 125,
71, 48, 58, 130, 255, 255, 255, 166,
110, 73, 57, 62, 104, 210, 255, 255,
251, 123, 65, 55, 68, 100, 171, 255
255, 255, 255, 131, 6, 145, 255, 255,
255, 255, 255, 236, 93, 15, 96, 255,
255, 255, 255, 255, 194, 83, 25, 71,
221, 255, 255, 255, 255, 162, 73, 34,
66, 162, 255, 255, 255, 210, 126, 73,
43, 57, 173, 255, 255, 255, 201, 125,
71, 48, 58, 130, 255, 255, 255, 166,
110, 73, 57, 62, 104, 210, 255, 255,
251, 123, 65, 55, 68, 100, 171, 255
};
const opus_uint8 silk_NLSF_PRED_NB_MB_Q8[ 18 ] = {
179, 138, 140, 148, 151, 149, 153, 151,
163, 116, 67, 82, 59, 92, 72, 100,
89, 92
179, 138, 140, 148, 151, 149, 153, 151,
163, 116, 67, 82, 59, 92, 72, 100,
89, 92
};
const opus_int16 silk_NLSF_DELTA_MIN_NB_MB_Q15[ 11 ] = {
250, 3, 6, 3, 3, 3, 4, 3,
3, 3, 461
250, 3, 6, 3, 3, 3, 4, 3,
3, 3, 461
};
const silk_NLSF_CB_struct silk_NLSF_CB_NB_MB =

View file

@ -28,153 +28,153 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "silk_structs.h"
const opus_uint8 silk_NLSF_CB1_WB_Q8[ 512 ] = {
7, 23, 38, 54, 69, 85, 100, 116,
131, 147, 162, 178, 193, 208, 223, 239,
13, 25, 41, 55, 69, 83, 98, 112,
127, 142, 157, 171, 187, 203, 220, 236,
15, 21, 34, 51, 61, 78, 92, 106,
126, 136, 152, 167, 185, 205, 225, 240,
10, 21, 36, 50, 63, 79, 95, 110,
126, 141, 157, 173, 189, 205, 221, 237,
17, 20, 37, 51, 59, 78, 89, 107,
123, 134, 150, 164, 184, 205, 224, 240,
10, 15, 32, 51, 67, 81, 96, 112,
129, 142, 158, 173, 189, 204, 220, 236,
8, 21, 37, 51, 65, 79, 98, 113,
126, 138, 155, 168, 179, 192, 209, 218,
12, 15, 34, 55, 63, 78, 87, 108,
118, 131, 148, 167, 185, 203, 219, 236,
16, 19, 32, 36, 56, 79, 91, 108,
118, 136, 154, 171, 186, 204, 220, 237,
11, 28, 43, 58, 74, 89, 105, 120,
135, 150, 165, 180, 196, 211, 226, 241,
6, 16, 33, 46, 60, 75, 92, 107,
123, 137, 156, 169, 185, 199, 214, 225,
11, 19, 30, 44, 57, 74, 89, 105,
121, 135, 152, 169, 186, 202, 218, 234,
12, 19, 29, 46, 57, 71, 88, 100,
120, 132, 148, 165, 182, 199, 216, 233,
17, 23, 35, 46, 56, 77, 92, 106,
123, 134, 152, 167, 185, 204, 222, 237,
14, 17, 45, 53, 63, 75, 89, 107,
115, 132, 151, 171, 188, 206, 221, 240,
9, 16, 29, 40, 56, 71, 88, 103,
119, 137, 154, 171, 189, 205, 222, 237,
16, 19, 36, 48, 57, 76, 87, 105,
118, 132, 150, 167, 185, 202, 218, 236,
12, 17, 29, 54, 71, 81, 94, 104,
126, 136, 149, 164, 182, 201, 221, 237,
15, 28, 47, 62, 79, 97, 115, 129,
142, 155, 168, 180, 194, 208, 223, 238,
8, 14, 30, 45, 62, 78, 94, 111,
127, 143, 159, 175, 192, 207, 223, 239,
17, 30, 49, 62, 79, 92, 107, 119,
132, 145, 160, 174, 190, 204, 220, 235,
14, 19, 36, 45, 61, 76, 91, 108,
121, 138, 154, 172, 189, 205, 222, 238,
12, 18, 31, 45, 60, 76, 91, 107,
123, 138, 154, 171, 187, 204, 221, 236,
13, 17, 31, 43, 53, 70, 83, 103,
114, 131, 149, 167, 185, 203, 220, 237,
17, 22, 35, 42, 58, 78, 93, 110,
125, 139, 155, 170, 188, 206, 224, 240,
8, 15, 34, 50, 67, 83, 99, 115,
131, 146, 162, 178, 193, 209, 224, 239,
13, 16, 41, 66, 73, 86, 95, 111,
128, 137, 150, 163, 183, 206, 225, 241,
17, 25, 37, 52, 63, 75, 92, 102,
119, 132, 144, 160, 175, 191, 212, 231,
19, 31, 49, 65, 83, 100, 117, 133,
147, 161, 174, 187, 200, 213, 227, 242,
18, 31, 52, 68, 88, 103, 117, 126,
138, 149, 163, 177, 192, 207, 223, 239,
16, 29, 47, 61, 76, 90, 106, 119,
133, 147, 161, 176, 193, 209, 224, 240,
15, 21, 35, 50, 61, 73, 86, 97,
110, 119, 129, 141, 175, 198, 218, 237
7, 23, 38, 54, 69, 85, 100, 116,
131, 147, 162, 178, 193, 208, 223, 239,
13, 25, 41, 55, 69, 83, 98, 112,
127, 142, 157, 171, 187, 203, 220, 236,
15, 21, 34, 51, 61, 78, 92, 106,
126, 136, 152, 167, 185, 205, 225, 240,
10, 21, 36, 50, 63, 79, 95, 110,
126, 141, 157, 173, 189, 205, 221, 237,
17, 20, 37, 51, 59, 78, 89, 107,
123, 134, 150, 164, 184, 205, 224, 240,
10, 15, 32, 51, 67, 81, 96, 112,
129, 142, 158, 173, 189, 204, 220, 236,
8, 21, 37, 51, 65, 79, 98, 113,
126, 138, 155, 168, 179, 192, 209, 218,
12, 15, 34, 55, 63, 78, 87, 108,
118, 131, 148, 167, 185, 203, 219, 236,
16, 19, 32, 36, 56, 79, 91, 108,
118, 136, 154, 171, 186, 204, 220, 237,
11, 28, 43, 58, 74, 89, 105, 120,
135, 150, 165, 180, 196, 211, 226, 241,
6, 16, 33, 46, 60, 75, 92, 107,
123, 137, 156, 169, 185, 199, 214, 225,
11, 19, 30, 44, 57, 74, 89, 105,
121, 135, 152, 169, 186, 202, 218, 234,
12, 19, 29, 46, 57, 71, 88, 100,
120, 132, 148, 165, 182, 199, 216, 233,
17, 23, 35, 46, 56, 77, 92, 106,
123, 134, 152, 167, 185, 204, 222, 237,
14, 17, 45, 53, 63, 75, 89, 107,
115, 132, 151, 171, 188, 206, 221, 240,
9, 16, 29, 40, 56, 71, 88, 103,
119, 137, 154, 171, 189, 205, 222, 237,
16, 19, 36, 48, 57, 76, 87, 105,
118, 132, 150, 167, 185, 202, 218, 236,
12, 17, 29, 54, 71, 81, 94, 104,
126, 136, 149, 164, 182, 201, 221, 237,
15, 28, 47, 62, 79, 97, 115, 129,
142, 155, 168, 180, 194, 208, 223, 238,
8, 14, 30, 45, 62, 78, 94, 111,
127, 143, 159, 175, 192, 207, 223, 239,
17, 30, 49, 62, 79, 92, 107, 119,
132, 145, 160, 174, 190, 204, 220, 235,
14, 19, 36, 45, 61, 76, 91, 108,
121, 138, 154, 172, 189, 205, 222, 238,
12, 18, 31, 45, 60, 76, 91, 107,
123, 138, 154, 171, 187, 204, 221, 236,
13, 17, 31, 43, 53, 70, 83, 103,
114, 131, 149, 167, 185, 203, 220, 237,
17, 22, 35, 42, 58, 78, 93, 110,
125, 139, 155, 170, 188, 206, 224, 240,
8, 15, 34, 50, 67, 83, 99, 115,
131, 146, 162, 178, 193, 209, 224, 239,
13, 16, 41, 66, 73, 86, 95, 111,
128, 137, 150, 163, 183, 206, 225, 241,
17, 25, 37, 52, 63, 75, 92, 102,
119, 132, 144, 160, 175, 191, 212, 231,
19, 31, 49, 65, 83, 100, 117, 133,
147, 161, 174, 187, 200, 213, 227, 242,
18, 31, 52, 68, 88, 103, 117, 126,
138, 149, 163, 177, 192, 207, 223, 239,
16, 29, 47, 61, 76, 90, 106, 119,
133, 147, 161, 176, 193, 209, 224, 240,
15, 21, 35, 50, 61, 73, 86, 97,
110, 119, 129, 141, 175, 198, 218, 237
};
const opus_uint8 silk_NLSF_CB1_iCDF_WB[ 64 ] = {
225, 204, 201, 184, 183, 175, 158, 154,
153, 135, 119, 115, 113, 110, 109, 99,
98, 95, 79, 68, 52, 50, 48, 45,
43, 32, 31, 27, 18, 10, 3, 0,
255, 251, 235, 230, 212, 201, 196, 182,
167, 166, 163, 151, 138, 124, 110, 104,
90, 78, 76, 70, 69, 57, 45, 34,
24, 21, 11, 6, 5, 4, 3, 0
225, 204, 201, 184, 183, 175, 158, 154,
153, 135, 119, 115, 113, 110, 109, 99,
98, 95, 79, 68, 52, 50, 48, 45,
43, 32, 31, 27, 18, 10, 3, 0,
255, 251, 235, 230, 212, 201, 196, 182,
167, 166, 163, 151, 138, 124, 110, 104,
90, 78, 76, 70, 69, 57, 45, 34,
24, 21, 11, 6, 5, 4, 3, 0
};
const opus_uint8 silk_NLSF_CB2_SELECT_WB[ 256 ] = {
0, 0, 0, 0, 0, 0, 0, 1,
100, 102, 102, 68, 68, 36, 34, 96,
164, 107, 158, 185, 180, 185, 139, 102,
64, 66, 36, 34, 34, 0, 1, 32,
208, 139, 141, 191, 152, 185, 155, 104,
96, 171, 104, 166, 102, 102, 102, 132,
1, 0, 0, 0, 0, 16, 16, 0,
80, 109, 78, 107, 185, 139, 103, 101,
208, 212, 141, 139, 173, 153, 123, 103,
36, 0, 0, 0, 0, 0, 0, 1,
48, 0, 0, 0, 0, 0, 0, 32,
68, 135, 123, 119, 119, 103, 69, 98,
68, 103, 120, 118, 118, 102, 71, 98,
134, 136, 157, 184, 182, 153, 139, 134,
208, 168, 248, 75, 189, 143, 121, 107,
32, 49, 34, 34, 34, 0, 17, 2,
210, 235, 139, 123, 185, 137, 105, 134,
98, 135, 104, 182, 100, 183, 171, 134,
100, 70, 68, 70, 66, 66, 34, 131,
64, 166, 102, 68, 36, 2, 1, 0,
134, 166, 102, 68, 34, 34, 66, 132,
212, 246, 158, 139, 107, 107, 87, 102,
100, 219, 125, 122, 137, 118, 103, 132,
114, 135, 137, 105, 171, 106, 50, 34,
164, 214, 141, 143, 185, 151, 121, 103,
192, 34, 0, 0, 0, 0, 0, 1,
208, 109, 74, 187, 134, 249, 159, 137,
102, 110, 154, 118, 87, 101, 119, 101,
0, 2, 0, 36, 36, 66, 68, 35,
96, 164, 102, 100, 36, 0, 2, 33,
167, 138, 174, 102, 100, 84, 2, 2,
100, 107, 120, 119, 36, 197, 24, 0
0, 0, 0, 0, 0, 0, 0, 1,
100, 102, 102, 68, 68, 36, 34, 96,
164, 107, 158, 185, 180, 185, 139, 102,
64, 66, 36, 34, 34, 0, 1, 32,
208, 139, 141, 191, 152, 185, 155, 104,
96, 171, 104, 166, 102, 102, 102, 132,
1, 0, 0, 0, 0, 16, 16, 0,
80, 109, 78, 107, 185, 139, 103, 101,
208, 212, 141, 139, 173, 153, 123, 103,
36, 0, 0, 0, 0, 0, 0, 1,
48, 0, 0, 0, 0, 0, 0, 32,
68, 135, 123, 119, 119, 103, 69, 98,
68, 103, 120, 118, 118, 102, 71, 98,
134, 136, 157, 184, 182, 153, 139, 134,
208, 168, 248, 75, 189, 143, 121, 107,
32, 49, 34, 34, 34, 0, 17, 2,
210, 235, 139, 123, 185, 137, 105, 134,
98, 135, 104, 182, 100, 183, 171, 134,
100, 70, 68, 70, 66, 66, 34, 131,
64, 166, 102, 68, 36, 2, 1, 0,
134, 166, 102, 68, 34, 34, 66, 132,
212, 246, 158, 139, 107, 107, 87, 102,
100, 219, 125, 122, 137, 118, 103, 132,
114, 135, 137, 105, 171, 106, 50, 34,
164, 214, 141, 143, 185, 151, 121, 103,
192, 34, 0, 0, 0, 0, 0, 1,
208, 109, 74, 187, 134, 249, 159, 137,
102, 110, 154, 118, 87, 101, 119, 101,
0, 2, 0, 36, 36, 66, 68, 35,
96, 164, 102, 100, 36, 0, 2, 33,
167, 138, 174, 102, 100, 84, 2, 2,
100, 107, 120, 119, 36, 197, 24, 0
};
const opus_uint8 silk_NLSF_CB2_iCDF_WB[ 72 ] = {
255, 254, 253, 244, 12, 3, 2, 1,
0, 255, 254, 252, 224, 38, 3, 2,
1, 0, 255, 254, 251, 209, 57, 4,
2, 1, 0, 255, 254, 244, 195, 69,
4, 2, 1, 0, 255, 251, 232, 184,
84, 7, 2, 1, 0, 255, 254, 240,
186, 86, 14, 2, 1, 0, 255, 254,
239, 178, 91, 30, 5, 1, 0, 255,
248, 227, 177, 100, 19, 2, 1, 0
255, 254, 253, 244, 12, 3, 2, 1,
0, 255, 254, 252, 224, 38, 3, 2,
1, 0, 255, 254, 251, 209, 57, 4,
2, 1, 0, 255, 254, 244, 195, 69,
4, 2, 1, 0, 255, 251, 232, 184,
84, 7, 2, 1, 0, 255, 254, 240,
186, 86, 14, 2, 1, 0, 255, 254,
239, 178, 91, 30, 5, 1, 0, 255,
248, 227, 177, 100, 19, 2, 1, 0
};
const opus_uint8 silk_NLSF_CB2_BITS_WB_Q5[ 72 ] = {
255, 255, 255, 156, 4, 154, 255, 255,
255, 255, 255, 227, 102, 15, 92, 255,
255, 255, 255, 255, 213, 83, 24, 72,
236, 255, 255, 255, 255, 150, 76, 33,
63, 214, 255, 255, 255, 190, 121, 77,
43, 55, 185, 255, 255, 255, 245, 137,
71, 43, 59, 139, 255, 255, 255, 255,
131, 66, 50, 66, 107, 194, 255, 255,
166, 116, 76, 55, 53, 125, 255, 255
255, 255, 255, 156, 4, 154, 255, 255,
255, 255, 255, 227, 102, 15, 92, 255,
255, 255, 255, 255, 213, 83, 24, 72,
236, 255, 255, 255, 255, 150, 76, 33,
63, 214, 255, 255, 255, 190, 121, 77,
43, 55, 185, 255, 255, 255, 245, 137,
71, 43, 59, 139, 255, 255, 255, 255,
131, 66, 50, 66, 107, 194, 255, 255,
166, 116, 76, 55, 53, 125, 255, 255
};
const opus_uint8 silk_NLSF_PRED_WB_Q8[ 30 ] = {
175, 148, 160, 176, 178, 173, 174, 164,
177, 174, 196, 182, 198, 192, 182, 68,
62, 66, 60, 72, 117, 85, 90, 118,
136, 151, 142, 160, 142, 155
175, 148, 160, 176, 178, 173, 174, 164,
177, 174, 196, 182, 198, 192, 182, 68,
62, 66, 60, 72, 117, 85, 90, 118,
136, 151, 142, 160, 142, 155
};
const opus_int16 silk_NLSF_DELTA_MIN_WB_Q15[ 17 ] = {
100, 3, 40, 3, 3, 3, 5, 14,
14, 10, 11, 3, 8, 9, 7, 3,
347
14, 10, 11, 3, 8, 9, 7, 3,
347
};
const silk_NLSF_CB_struct silk_NLSF_CB_WB =

View file

@ -35,23 +35,23 @@ extern "C"
const opus_uint8 silk_gain_iCDF[ 3 ][ N_LEVELS_QGAIN / 8 ] =
{
{
224, 112, 44, 15, 3, 2, 1, 0
224, 112, 44, 15, 3, 2, 1, 0
},
{
254, 237, 192, 132, 70, 23, 4, 0
254, 237, 192, 132, 70, 23, 4, 0
},
{
255, 252, 226, 155, 61, 11, 2, 0
255, 252, 226, 155, 61, 11, 2, 0
}
};
const opus_uint8 silk_delta_gain_iCDF[ MAX_DELTA_GAIN_QUANT - MIN_DELTA_GAIN_QUANT + 1 ] = {
250, 245, 234, 203, 71, 50, 42, 38,
35, 33, 31, 29, 28, 27, 26, 25,
24, 23, 22, 21, 20, 19, 18, 17,
16, 15, 14, 13, 12, 11, 10, 9,
8, 7, 6, 5, 4, 3, 2, 1,
0
250, 245, 234, 203, 71, 50, 42, 38,
35, 33, 31, 29, 28, 27, 26, 25,
24, 23, 22, 21, 20, 19, 18, 17,
16, 15, 14, 13, 12, 11, 10, 9,
8, 7, 6, 5, 4, 3, 2, 1,
0
};
#ifdef __cplusplus

View file

@ -78,10 +78,10 @@ const opus_uint8 silk_LTPscale_iCDF[ 3 ] = { 128, 64, 0 };
/* Tables for signal type and offset coding */
const opus_uint8 silk_type_offset_VAD_iCDF[ 4 ] = {
232, 158, 10, 0
232, 158, 10, 0
};
const opus_uint8 silk_type_offset_no_VAD_iCDF[ 2 ] = {
230, 0
230, 0
};
/* Tables for NLSF interpolation factor */

View file

@ -28,10 +28,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "silk_tables.h"
const opus_uint8 silk_pitch_lag_iCDF[ 2 * ( PITCH_EST_MAX_LAG_MS - PITCH_EST_MIN_LAG_MS ) ] = {
253, 250, 244, 233, 212, 182, 150, 131,
120, 110, 98, 85, 72, 60, 49, 40,
32, 25, 19, 15, 13, 11, 9, 8,
7, 6, 5, 4, 3, 2, 1, 0
253, 250, 244, 233, 212, 182, 150, 131,
120, 110, 98, 85, 72, 60, 49, 40,
32, 25, 19, 15, 13, 11, 9, 8,
7, 6, 5, 4, 3, 2, 1, 0
};
const opus_uint8 silk_pitch_delta_iCDF[21] = {
@ -41,25 +41,25 @@ const opus_uint8 silk_pitch_delta_iCDF[21] = {
};
const opus_uint8 silk_pitch_contour_iCDF[34] = {
223, 201, 183, 167, 152, 138, 124, 111,
98, 88, 79, 70, 62, 56, 50, 44,
39, 35, 31, 27, 24, 21, 18, 16,
14, 12, 10, 8, 6, 4, 3, 2,
1, 0
223, 201, 183, 167, 152, 138, 124, 111,
98, 88, 79, 70, 62, 56, 50, 44,
39, 35, 31, 27, 24, 21, 18, 16,
14, 12, 10, 8, 6, 4, 3, 2,
1, 0
};
const opus_uint8 silk_pitch_contour_NB_iCDF[11] = {
188, 176, 155, 138, 119, 97, 67, 43,
26, 10, 0
188, 176, 155, 138, 119, 97, 67, 43,
26, 10, 0
};
const opus_uint8 silk_pitch_contour_10_ms_iCDF[12] = {
165, 119, 80, 61, 47, 35, 27, 20,
14, 9, 4, 0
165, 119, 80, 61, 47, 35, 27, 20,
14, 9, 4, 0
};
const opus_uint8 silk_pitch_contour_10_ms_NB_iCDF[3] = {
113, 63, 0
113, 63, 0
};

View file

@ -28,232 +28,232 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "silk_tables.h"
const opus_uint8 silk_max_pulses_table[ 4 ] = {
8, 10, 12, 16
8, 10, 12, 16
};
const opus_uint8 silk_pulses_per_block_iCDF[ 10 ][ 18 ] = {
{
125, 51, 26, 18, 15, 12, 11, 10,
9, 8, 7, 6, 5, 4, 3, 2,
1, 0
125, 51, 26, 18, 15, 12, 11, 10,
9, 8, 7, 6, 5, 4, 3, 2,
1, 0
},
{
198, 105, 45, 22, 15, 12, 11, 10,
9, 8, 7, 6, 5, 4, 3, 2,
1, 0
198, 105, 45, 22, 15, 12, 11, 10,
9, 8, 7, 6, 5, 4, 3, 2,
1, 0
},
{
213, 162, 116, 83, 59, 43, 32, 24,
18, 15, 12, 9, 7, 6, 5, 3,
2, 0
213, 162, 116, 83, 59, 43, 32, 24,
18, 15, 12, 9, 7, 6, 5, 3,
2, 0
},
{
239, 187, 116, 59, 28, 16, 11, 10,
9, 8, 7, 6, 5, 4, 3, 2,
1, 0
239, 187, 116, 59, 28, 16, 11, 10,
9, 8, 7, 6, 5, 4, 3, 2,
1, 0
},
{
250, 229, 188, 135, 86, 51, 30, 19,
13, 10, 8, 6, 5, 4, 3, 2,
1, 0
250, 229, 188, 135, 86, 51, 30, 19,
13, 10, 8, 6, 5, 4, 3, 2,
1, 0
},
{
249, 235, 213, 185, 156, 128, 103, 83,
66, 53, 42, 33, 26, 21, 17, 13,
10, 0
249, 235, 213, 185, 156, 128, 103, 83,
66, 53, 42, 33, 26, 21, 17, 13,
10, 0
},
{
254, 249, 235, 206, 164, 118, 77, 46,
27, 16, 10, 7, 5, 4, 3, 2,
1, 0
254, 249, 235, 206, 164, 118, 77, 46,
27, 16, 10, 7, 5, 4, 3, 2,
1, 0
},
{
255, 253, 249, 239, 220, 191, 156, 119,
85, 57, 37, 23, 15, 10, 6, 4,
2, 0
255, 253, 249, 239, 220, 191, 156, 119,
85, 57, 37, 23, 15, 10, 6, 4,
2, 0
},
{
255, 253, 251, 246, 237, 223, 203, 179,
152, 124, 98, 75, 55, 40, 29, 21,
15, 0
255, 253, 251, 246, 237, 223, 203, 179,
152, 124, 98, 75, 55, 40, 29, 21,
15, 0
},
{
255, 254, 253, 247, 220, 162, 106, 67,
42, 28, 18, 12, 9, 6, 4, 3,
2, 0
255, 254, 253, 247, 220, 162, 106, 67,
42, 28, 18, 12, 9, 6, 4, 3,
2, 0
}
};
const opus_uint8 silk_pulses_per_block_BITS_Q5[ 9 ][ 18 ] = {
{
31, 57, 107, 160, 205, 205, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255
31, 57, 107, 160, 205, 205, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255
},
{
69, 47, 67, 111, 166, 205, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255
69, 47, 67, 111, 166, 205, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255
},
{
82, 74, 79, 95, 109, 128, 145, 160,
173, 205, 205, 205, 224, 255, 255, 224,
255, 224
82, 74, 79, 95, 109, 128, 145, 160,
173, 205, 205, 205, 224, 255, 255, 224,
255, 224
},
{
125, 74, 59, 69, 97, 141, 182, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255
125, 74, 59, 69, 97, 141, 182, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255
},
{
173, 115, 85, 73, 76, 92, 115, 145,
173, 205, 224, 224, 255, 255, 255, 255,
255, 255
173, 115, 85, 73, 76, 92, 115, 145,
173, 205, 224, 224, 255, 255, 255, 255,
255, 255
},
{
166, 134, 113, 102, 101, 102, 107, 118,
125, 138, 145, 155, 166, 182, 192, 192,
205, 150
166, 134, 113, 102, 101, 102, 107, 118,
125, 138, 145, 155, 166, 182, 192, 192,
205, 150
},
{
224, 182, 134, 101, 83, 79, 85, 97,
120, 145, 173, 205, 224, 255, 255, 255,
255, 255
224, 182, 134, 101, 83, 79, 85, 97,
120, 145, 173, 205, 224, 255, 255, 255,
255, 255
},
{
255, 224, 192, 150, 120, 101, 92, 89,
93, 102, 118, 134, 160, 182, 192, 224,
224, 224
255, 224, 192, 150, 120, 101, 92, 89,
93, 102, 118, 134, 160, 182, 192, 224,
224, 224
},
{
255, 224, 224, 182, 155, 134, 118, 109,
104, 102, 106, 111, 118, 131, 145, 160,
173, 131
255, 224, 224, 182, 155, 134, 118, 109,
104, 102, 106, 111, 118, 131, 145, 160,
173, 131
}
};
const opus_uint8 silk_rate_levels_iCDF[ 2 ][ 9 ] =
{
{
241, 190, 178, 132, 87, 74, 41, 14,
0
241, 190, 178, 132, 87, 74, 41, 14,
0
},
{
223, 193, 157, 140, 106, 57, 39, 18,
0
223, 193, 157, 140, 106, 57, 39, 18,
0
}
};
const opus_uint8 silk_rate_levels_BITS_Q5[ 2 ][ 9 ] =
{
{
131, 74, 141, 79, 80, 138, 95, 104,
134
131, 74, 141, 79, 80, 138, 95, 104,
134
},
{
95, 99, 91, 125, 93, 76, 123, 115,
123
95, 99, 91, 125, 93, 76, 123, 115,
123
}
};
const opus_uint8 silk_shell_code_table0[ 152 ] = {
128, 0, 214, 42, 0, 235, 128, 21,
0, 244, 184, 72, 11, 0, 248, 214,
128, 42, 7, 0, 248, 225, 170, 80,
25, 5, 0, 251, 236, 198, 126, 54,
18, 3, 0, 250, 238, 211, 159, 82,
35, 15, 5, 0, 250, 231, 203, 168,
128, 88, 53, 25, 6, 0, 252, 238,
216, 185, 148, 108, 71, 40, 18, 4,
0, 253, 243, 225, 199, 166, 128, 90,
57, 31, 13, 3, 0, 254, 246, 233,
212, 183, 147, 109, 73, 44, 23, 10,
2, 0, 255, 250, 240, 223, 198, 166,
128, 90, 58, 33, 16, 6, 1, 0,
255, 251, 244, 231, 210, 181, 146, 110,
75, 46, 25, 12, 5, 1, 0, 255,
253, 248, 238, 221, 196, 164, 128, 92,
60, 35, 18, 8, 3, 1, 0, 255,
253, 249, 242, 229, 208, 180, 146, 110,
76, 48, 27, 14, 7, 3, 1, 0
128, 0, 214, 42, 0, 235, 128, 21,
0, 244, 184, 72, 11, 0, 248, 214,
128, 42, 7, 0, 248, 225, 170, 80,
25, 5, 0, 251, 236, 198, 126, 54,
18, 3, 0, 250, 238, 211, 159, 82,
35, 15, 5, 0, 250, 231, 203, 168,
128, 88, 53, 25, 6, 0, 252, 238,
216, 185, 148, 108, 71, 40, 18, 4,
0, 253, 243, 225, 199, 166, 128, 90,
57, 31, 13, 3, 0, 254, 246, 233,
212, 183, 147, 109, 73, 44, 23, 10,
2, 0, 255, 250, 240, 223, 198, 166,
128, 90, 58, 33, 16, 6, 1, 0,
255, 251, 244, 231, 210, 181, 146, 110,
75, 46, 25, 12, 5, 1, 0, 255,
253, 248, 238, 221, 196, 164, 128, 92,
60, 35, 18, 8, 3, 1, 0, 255,
253, 249, 242, 229, 208, 180, 146, 110,
76, 48, 27, 14, 7, 3, 1, 0
};
const opus_uint8 silk_shell_code_table1[ 152 ] = {
129, 0, 207, 50, 0, 236, 129, 20,
0, 245, 185, 72, 10, 0, 249, 213,
129, 42, 6, 0, 250, 226, 169, 87,
27, 4, 0, 251, 233, 194, 130, 62,
20, 4, 0, 250, 236, 207, 160, 99,
47, 17, 3, 0, 255, 240, 217, 182,
131, 81, 41, 11, 1, 0, 255, 254,
233, 201, 159, 107, 61, 20, 2, 1,
0, 255, 249, 233, 206, 170, 128, 86,
50, 23, 7, 1, 0, 255, 250, 238,
217, 186, 148, 108, 70, 39, 18, 6,
1, 0, 255, 252, 243, 226, 200, 166,
128, 90, 56, 30, 13, 4, 1, 0,
255, 252, 245, 231, 209, 180, 146, 110,
76, 47, 25, 11, 4, 1, 0, 255,
253, 248, 237, 219, 194, 163, 128, 93,
62, 37, 19, 8, 3, 1, 0, 255,
254, 250, 241, 226, 205, 177, 145, 111,
79, 51, 30, 15, 6, 2, 1, 0
129, 0, 207, 50, 0, 236, 129, 20,
0, 245, 185, 72, 10, 0, 249, 213,
129, 42, 6, 0, 250, 226, 169, 87,
27, 4, 0, 251, 233, 194, 130, 62,
20, 4, 0, 250, 236, 207, 160, 99,
47, 17, 3, 0, 255, 240, 217, 182,
131, 81, 41, 11, 1, 0, 255, 254,
233, 201, 159, 107, 61, 20, 2, 1,
0, 255, 249, 233, 206, 170, 128, 86,
50, 23, 7, 1, 0, 255, 250, 238,
217, 186, 148, 108, 70, 39, 18, 6,
1, 0, 255, 252, 243, 226, 200, 166,
128, 90, 56, 30, 13, 4, 1, 0,
255, 252, 245, 231, 209, 180, 146, 110,
76, 47, 25, 11, 4, 1, 0, 255,
253, 248, 237, 219, 194, 163, 128, 93,
62, 37, 19, 8, 3, 1, 0, 255,
254, 250, 241, 226, 205, 177, 145, 111,
79, 51, 30, 15, 6, 2, 1, 0
};
const opus_uint8 silk_shell_code_table2[ 152 ] = {
129, 0, 203, 54, 0, 234, 129, 23,
0, 245, 184, 73, 10, 0, 250, 215,
129, 41, 5, 0, 252, 232, 173, 86,
24, 3, 0, 253, 240, 200, 129, 56,
15, 2, 0, 253, 244, 217, 164, 94,
38, 10, 1, 0, 253, 245, 226, 189,
132, 71, 27, 7, 1, 0, 253, 246,
231, 203, 159, 105, 56, 23, 6, 1,
0, 255, 248, 235, 213, 179, 133, 85,
47, 19, 5, 1, 0, 255, 254, 243,
221, 194, 159, 117, 70, 37, 12, 2,
1, 0, 255, 254, 248, 234, 208, 171,
128, 85, 48, 22, 8, 2, 1, 0,
255, 254, 250, 240, 220, 189, 149, 107,
67, 36, 16, 6, 2, 1, 0, 255,
254, 251, 243, 227, 201, 166, 128, 90,
55, 29, 13, 5, 2, 1, 0, 255,
254, 252, 246, 234, 213, 183, 147, 109,
73, 43, 22, 10, 4, 2, 1, 0
129, 0, 203, 54, 0, 234, 129, 23,
0, 245, 184, 73, 10, 0, 250, 215,
129, 41, 5, 0, 252, 232, 173, 86,
24, 3, 0, 253, 240, 200, 129, 56,
15, 2, 0, 253, 244, 217, 164, 94,
38, 10, 1, 0, 253, 245, 226, 189,
132, 71, 27, 7, 1, 0, 253, 246,
231, 203, 159, 105, 56, 23, 6, 1,
0, 255, 248, 235, 213, 179, 133, 85,
47, 19, 5, 1, 0, 255, 254, 243,
221, 194, 159, 117, 70, 37, 12, 2,
1, 0, 255, 254, 248, 234, 208, 171,
128, 85, 48, 22, 8, 2, 1, 0,
255, 254, 250, 240, 220, 189, 149, 107,
67, 36, 16, 6, 2, 1, 0, 255,
254, 251, 243, 227, 201, 166, 128, 90,
55, 29, 13, 5, 2, 1, 0, 255,
254, 252, 246, 234, 213, 183, 147, 109,
73, 43, 22, 10, 4, 2, 1, 0
};
const opus_uint8 silk_shell_code_table3[ 152 ] = {
130, 0, 200, 58, 0, 231, 130, 26,
0, 244, 184, 76, 12, 0, 249, 214,
130, 43, 6, 0, 252, 232, 173, 87,
24, 3, 0, 253, 241, 203, 131, 56,
14, 2, 0, 254, 246, 221, 167, 94,
35, 8, 1, 0, 254, 249, 232, 193,
130, 65, 23, 5, 1, 0, 255, 251,
239, 211, 162, 99, 45, 15, 4, 1,
0, 255, 251, 243, 223, 186, 131, 74,
33, 11, 3, 1, 0, 255, 252, 245,
230, 202, 158, 105, 57, 24, 8, 2,
1, 0, 255, 253, 247, 235, 214, 179,
132, 84, 44, 19, 7, 2, 1, 0,
255, 254, 250, 240, 223, 196, 159, 112,
69, 36, 15, 6, 2, 1, 0, 255,
254, 253, 245, 231, 209, 176, 136, 93,
55, 27, 11, 3, 2, 1, 0, 255,
254, 253, 252, 239, 221, 194, 158, 117,
76, 42, 18, 4, 3, 2, 1, 0
130, 0, 200, 58, 0, 231, 130, 26,
0, 244, 184, 76, 12, 0, 249, 214,
130, 43, 6, 0, 252, 232, 173, 87,
24, 3, 0, 253, 241, 203, 131, 56,
14, 2, 0, 254, 246, 221, 167, 94,
35, 8, 1, 0, 254, 249, 232, 193,
130, 65, 23, 5, 1, 0, 255, 251,
239, 211, 162, 99, 45, 15, 4, 1,
0, 255, 251, 243, 223, 186, 131, 74,
33, 11, 3, 1, 0, 255, 252, 245,
230, 202, 158, 105, 57, 24, 8, 2,
1, 0, 255, 253, 247, 235, 214, 179,
132, 84, 44, 19, 7, 2, 1, 0,
255, 254, 250, 240, 223, 196, 159, 112,
69, 36, 15, 6, 2, 1, 0, 255,
254, 253, 245, 231, 209, 176, 136, 93,
55, 27, 11, 3, 2, 1, 0, 255,
254, 253, 252, 239, 221, 194, 158, 117,
76, 42, 18, 4, 3, 2, 1, 0
};
const opus_uint8 silk_shell_code_table_offsets[ 17 ] = {
0, 0, 2, 5, 9, 14, 20, 27,
35, 44, 54, 65, 77, 90, 104, 119,
135
0, 0, 2, 5, 9, 14, 20, 27,
35, 44, 54, 65, 77, 90, 104, 119,
135
};
const opus_uint8 silk_sign_iCDF[ 36 ] = {
49, 67, 77, 82, 93, 99, 11, 18,
24, 31, 36, 45, 46, 66, 78, 87,
94, 104, 14, 21, 32, 42, 51, 66,
94, 104, 109, 112, 115, 118, 53, 69,
80, 88, 95, 102
49, 67, 77, 82, 93, 99, 11, 18,
24, 31, 36, 45, 46, 66, 78, 87,
94, 104, 14, 21, 32, 42, 51, 66,
94, 104, 109, 112, 115, 118, 53, 69,
80, 88, 95, 102
};