Commit acc7a6c7 authored by Koen Vos's avatar Koen Vos Committed by Jean-Marc Valin
Browse files

Reformatting changes with an update to the MSVC project files

parent 2d4f6140
......@@ -43,14 +43,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define QPoly 16
#define MAX_ITERATIONS_A2NLSF_FIX 30
/* Flag for using 2x as many cosine sampling points, reduces the risk of missing a root */
#define OVERSAMPLE_COSINE_TABLE 0
/* Helper function for A2NLSF(..) */
/* Transforms polynomials from cos(n*f) to cos(f)^n */
static inline void silk_A2NLSF_trans_poly(
opus_int32 *p, /* I/O Polynomial */
const opus_int dd /* I Polynomial order (= filter order / 2 ) */
opus_int32 *p, /* I/O Polynomial */
const opus_int dd /* I Polynomial order (= filter order / 2 ) */
)
{
opus_int k, n;
......@@ -62,21 +59,21 @@ static inline void silk_A2NLSF_trans_poly(
p[ k - 2 ] -= silk_LSHIFT( p[ k ], 1 );
}
}
/* Helper function for A2NLSF(..) */
/* Polynomial evaluation */
static inline opus_int32 silk_A2NLSF_eval_poly( /* return the polynomial evaluation, in QPoly */
opus_int32 *p, /* I Polynomial, QPoly */
const opus_int32 x, /* I Evaluation point, Q12 */
const opus_int dd /* I Order */
/* Helper function for A2NLSF(..) */
/* Polynomial evaluation */
static inline opus_int32 silk_A2NLSF_eval_poly( /* return the polynomial evaluation, in QPoly */
opus_int32 *p, /* I Polynomial, QPoly */
const opus_int32 x, /* I Evaluation point, Q12 */
const opus_int dd /* I Order */
)
{
opus_int n;
opus_int32 x_Q16, y32;
y32 = p[ dd ]; /* QPoly */
y32 = p[ dd ]; /* QPoly */
x_Q16 = silk_LSHIFT( x, 4 );
for( n = dd - 1; n >= 0; n-- ) {
y32 = silk_SMLAWW( p[ n ], y32, x_Q16 ); /* QPoly */
y32 = silk_SMLAWW( p[ n ], y32, x_Q16 ); /* QPoly */
}
return y32;
}
......@@ -119,12 +116,12 @@ static inline void silk_A2NLSF_init(
silk_A2NLSF_trans_poly( Q, dd );
}
/* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filter coefficients */
/* If not all roots are found, the a_Q16 coefficients are bandwidth expanded until convergence. */
/* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filter coefficients */
/* If not all roots are found, the a_Q16 coefficients are bandwidth expanded until convergence. */
void silk_A2NLSF(
opus_int16 *NLSF, /* O Normalized Line Spectral Frequencies, Q15 (0 - (2^15-1)), [d] */
opus_int32 *a_Q16, /* I/O Monic whitening filter coefficients in Q16 [d] */
const opus_int d /* I Filter order (must be even) */
opus_int16 *NLSF, /* O Normalized Line Spectral Frequencies in Q15 (0..2^15-1) [d] */
opus_int32 *a_Q16, /* I/O Monic whitening filter coefficients in Q16 [d] */
const opus_int d /* I Filter order (must be even) */
)
{
opus_int i, k, m, dd, root_ix, ffrac;
......@@ -145,7 +142,7 @@ void silk_A2NLSF(
silk_A2NLSF_init( a_Q16, P, Q, dd );
/* Find roots, alternating between P and Q */
p = P; /* Pointer to polynomial */
p = P; /* Pointer to polynomial */
xlo = silk_LSFCosTab_FIX_Q12[ 0 ]; /* Q12*/
ylo = silk_A2NLSF_eval_poly( p, xlo, dd );
......@@ -164,13 +161,7 @@ void silk_A2NLSF(
thr = 0;
while( 1 ) {
/* Evaluate polynomial */
#if OVERSAMPLE_COSINE_TABLE
xhi = silk_LSFCosTab_FIX_Q12[ k >> 1 ] +
( ( silk_LSFCosTab_FIX_Q12[ ( k + 1 ) >> 1 ] -
silk_LSFCosTab_FIX_Q12[ k >> 1 ] ) >> 1 ); /* Q12 */
#else
xhi = silk_LSFCosTab_FIX_Q12[ k ]; /* Q12 */
#endif
yhi = silk_A2NLSF_eval_poly( p, xhi, dd );
/* Detect zero crossing */
......@@ -183,11 +174,7 @@ void silk_A2NLSF(
thr = 0;
}
/* Binary division */
#if OVERSAMPLE_COSINE_TABLE
ffrac = -128;
#else
ffrac = -256;
#endif
for( m = 0; m < BIN_DIV_STEPS_A2NLSF_FIX; m++ ) {
/* Evaluate polynomial */
xmid = silk_RSHIFT_ROUND( xlo + xhi, 1 );
......@@ -202,11 +189,7 @@ void silk_A2NLSF(
/* Increase frequency */
xlo = xmid;
ylo = ymid;
#if OVERSAMPLE_COSINE_TABLE
ffrac = silk_ADD_RSHIFT( ffrac, 64, m );
#else
ffrac = silk_ADD_RSHIFT( ffrac, 128, m );
#endif
}
}
......@@ -222,11 +205,7 @@ void silk_A2NLSF(
/* No risk of dividing by zero because abs(ylo - yhi) >= abs(ylo) >= 65536 */
ffrac += silk_DIV32( ylo, silk_RSHIFT( ylo - yhi, 8 - BIN_DIV_STEPS_A2NLSF_FIX ) );
}
#if OVERSAMPLE_COSINE_TABLE
NLSF[ root_ix ] = (opus_int16)silk_min_32( silk_LSHIFT( (opus_int32)k, 7 ) + ffrac, silk_int16_MAX );
#else
NLSF[ root_ix ] = (opus_int16)silk_min_32( silk_LSHIFT( (opus_int32)k, 8 ) + ffrac, silk_int16_MAX );
#endif
silk_assert( NLSF[ root_ix ] >= 0 );
......@@ -239,13 +218,7 @@ void silk_A2NLSF(
p = PQ[ root_ix & 1 ];
/* Evaluate polynomial */
#if OVERSAMPLE_COSINE_TABLE
xlo = silk_LSFCosTab_FIX_Q12[ ( k - 1 ) >> 1 ] +
( ( silk_LSFCosTab_FIX_Q12[ k >> 1 ] -
silk_LSFCosTab_FIX_Q12[ ( k - 1 ) >> 1 ] ) >> 1 ); /* Q12*/
#else
xlo = silk_LSFCosTab_FIX_Q12[ k - 1 ]; /* Q12*/
#endif
ylo = silk_LSHIFT( 1 - ( root_ix & 2 ), 12 );
} else {
/* Increment loop counter */
......@@ -254,11 +227,7 @@ void silk_A2NLSF(
ylo = yhi;
thr = 0;
#if OVERSAMPLE_COSINE_TABLE
if( k > 2 * LSF_COS_TAB_SZ_FIX ) {
#else
if( k > LSF_COS_TAB_SZ_FIX ) {
#endif
i++;
if( i > MAX_ITERATIONS_A2NLSF_FIX ) {
/* Set NLSFs to white spectrum and exit */
......
......@@ -43,9 +43,9 @@ extern "C"
/* Struct for TOC (Table of Contents) */
typedef struct {
opus_int VADFlag; /* Voice activity for packet */
opus_int VADFlags[ SILK_MAX_FRAMES_PER_PACKET ]; /* Voice activity for each frame in packet */
opus_int inbandFECFlag; /* Flag indicating if packet contains in-band FEC */
opus_int VADFlag; /* Voice activity for packet */
opus_int VADFlags[ SILK_MAX_FRAMES_PER_PACKET ]; /* Voice activity for each frame in packet */
opus_int inbandFECFlag; /* Flag indicating if packet contains in-band FEC */
} silk_TOC_struct;
/****************************************/
......@@ -55,24 +55,24 @@ typedef struct {
/***********************************************/
/* Get size in bytes of the Silk encoder state */
/***********************************************/
opus_int silk_Get_Encoder_Size( /* O: Returns error code */
opus_int *encSizeBytes /* O: Number of bytes in SILK encoder state */
opus_int silk_Get_Encoder_Size( /* O Returns error code */
opus_int *encSizeBytes /* O Number of bytes in SILK encoder state */
);
/*************************/
/* Init or reset encoder */
/*************************/
opus_int silk_InitEncoder( /* O: Returns error code */
void *encState, /* I/O: State */
silk_EncControlStruct *encStatus /* O: Encoder Status */
opus_int silk_InitEncoder( /* O Returns error code */
void *encState, /* I/O State */
silk_EncControlStruct *encStatus /* O Encoder Status */
);
/***************************************/
/* Read control structure from encoder */
/***************************************/
opus_int silk_QueryEncoder( /* O: Returns error code */
const void *encState, /* I: State */
silk_EncControlStruct *encStatus /* O: Encoder Status */
opus_int silk_QueryEncoder( /* O Returns error code */
const void *encState, /* I State */
silk_EncControlStruct *encStatus /* O Encoder Status */
);
/**************************/
......@@ -80,14 +80,14 @@ opus_int silk_QueryEncoder( /* O: Returns error c
/**************************/
/* 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 */
const opus_int16 *samplesIn, /* I: Speech sample input vector */
opus_int nSamplesIn, /* I: Number of samples in input vector */
ec_enc *psRangeEnc, /* I/O Compressor data structure */
opus_int *nBytesOut, /* I/O: Number of bytes in payload (input: Max bytes) */
const opus_int prefillFlag /* I: Flag to indicate prefilling buffers no coding */
opus_int silk_Encode( /* O Returns error code */
void *encState, /* I/O State */
silk_EncControlStruct *encControl, /* I Control status */
const opus_int16 *samplesIn, /* I Speech sample input vector */
opus_int nSamplesIn, /* I Number of samples in input vector */
ec_enc *psRangeEnc, /* I/O Compressor data structure */
opus_int *nBytesOut, /* I/O Number of bytes in payload (input: Max bytes) */
const opus_int prefillFlag /* I Flag to indicate prefilling buffers no coding */
);
/****************************************/
......@@ -97,38 +97,38 @@ opus_int silk_Encode( /* O: Returns error c
/***********************************************/
/* Get size in bytes of the Silk decoder state */
/***********************************************/
opus_int silk_Get_Decoder_Size( /* O: Returns error code */
opus_int *decSizeBytes /* O: Number of bytes in SILK decoder state */
opus_int silk_Get_Decoder_Size( /* O Returns error code */
opus_int *decSizeBytes /* O Number of bytes in SILK decoder state */
);
/*************************/
/* Init or Reset decoder */
/*************************/
opus_int silk_InitDecoder( /* O: Returns error code */
void *decState /* I/O: State */
opus_int silk_InitDecoder( /* O Returns error code */
void *decState /* I/O State */
);
/******************/
/* Decode a frame */
/******************/
opus_int silk_Decode( /* O: Returns error code */
void* decState, /* I/O: State */
silk_DecControlStruct* decControl, /* I/O: Control Structure */
opus_int lostFlag, /* I: 0: no loss, 1 loss, 2 decode fec */
opus_int newPacketFlag, /* I: Indicates first decoder call for this packet */
ec_dec *psRangeDec, /* I/O Compressor data structure */
opus_int16 *samplesOut, /* O: Decoded output speech vector */
opus_int32 *nSamplesOut /* O: Number of samples decoded */
opus_int silk_Decode( /* O Returns error code */
void* decState, /* I/O State */
silk_DecControlStruct* decControl, /* I/O Control Structure */
opus_int lostFlag, /* I 0: no loss, 1 loss, 2 decode fec */
opus_int newPacketFlag, /* I Indicates first decoder call for this packet */
ec_dec *psRangeDec, /* I/O Compressor data structure */
opus_int16 *samplesOut, /* O Decoded output speech vector */
opus_int32 *nSamplesOut /* O Number of samples decoded */
);
/**************************************/
/* Get table of contents for a packet */
/**************************************/
opus_int silk_get_TOC(
const opus_uint8 *payload, /* I Payload data */
const opus_int nBytesIn, /* I: Number of input bytes */
const opus_int nFramesPerPayload, /* I: Number of SILK frames per payload */
silk_TOC_struct *Silk_TOC /* O: Type of content */
const opus_uint8 *payload, /* I Payload data */
const opus_int nBytesIn, /* I Number of input bytes */
const opus_int nFramesPerPayload, /* I Number of SILK frames per payload */
silk_TOC_struct *Silk_TOC /* O Type of content */
);
#ifdef __cplusplus
......
......@@ -60,7 +60,7 @@ static inline void silk_CNG_exc(
}
void silk_CNG_Reset(
silk_decoder_state *psDec /* I/O Decoder state */
silk_decoder_state *psDec /* I/O Decoder state */
)
{
opus_int i, NLSF_step_Q15, NLSF_acc_Q15;
......@@ -77,10 +77,10 @@ void silk_CNG_Reset(
/* Updates CNG estimate, and applies the CNG when packet was lost */
void silk_CNG(
silk_decoder_state *psDec, /* I/O Decoder state */
silk_decoder_control *psDecCtrl, /* I/O Decoder control */
opus_int16 frame[], /* I/O Signal data */
opus_int length /* I Length of residual */
silk_decoder_state *psDec, /* I/O Decoder state */
silk_decoder_control *psDecCtrl, /* I/O Decoder control */
opus_int16 frame[], /* I/O Signal */
opus_int length /* I Length of residual */
)
{
opus_int i, j, subfr;
......
......@@ -37,7 +37,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* High-pass filter with cutoff frequency adaptation based on pitch lag statistics */
void silk_HP_variable_cutoff(
silk_encoder_state_Fxx state_Fxx[] /* I/O Encoder states */
silk_encoder_state_Fxx state_Fxx[] /* I/O Encoder states */
)
{
opus_int quality_Q15;
......
......@@ -38,7 +38,7 @@ extern "C"
#endif
/* count leading zeros of opus_int64 */
static inline opus_int32 silk_CLZ64(opus_int64 in)
static inline opus_int32 silk_CLZ64( opus_int64 in )
{
opus_int32 in_upper;
......@@ -53,9 +53,11 @@ static inline opus_int32 silk_CLZ64(opus_int64 in)
}
/* get number of leading zeros and fractional part (the bits right after the leading one */
static inline void silk_CLZ_FRAC(opus_int32 in, /* I: input */
opus_int32 *lz, /* O: number of leading zeros */
opus_int32 *frac_Q7) /* O: the 7 bits right after the leading one */
static inline void silk_CLZ_FRAC(
opus_int32 in, /* I input */
opus_int32 *lz, /* O number of leading zeros */
opus_int32 *frac_Q7 /* O the 7 bits right after the leading one */
)
{
opus_int32 lzeros = silk_CLZ32(in);
......@@ -66,7 +68,7 @@ static inline void silk_CLZ_FRAC(opus_int32 in, /* I: input */
/* Approximation of square root */
/* Accuracy: < +/- 10% for output values > 15 */
/* < +/- 2.5% for output values > 120 */
static inline opus_int32 silk_SQRT_APPROX(opus_int32 x)
static inline opus_int32 silk_SQRT_APPROX( opus_int32 x )
{
opus_int32 y, lz, frac_Q7;
......@@ -92,10 +94,10 @@ static inline opus_int32 silk_SQRT_APPROX(opus_int32 x)
}
/* Divide two int32 values and return result as int32 in a given Q-domain */
static inline opus_int32 silk_DIV32_varQ( /* O returns a good approximation of "(a32 << Qres) / b32" */
const opus_int32 a32, /* I numerator (Q0) */
const opus_int32 b32, /* I denominator (Q0) */
const opus_int Qres /* I Q-domain of result (>= 0) */
static inline opus_int32 silk_DIV32_varQ( /* O returns a good approximation of "(a32 << Qres) / b32" */
const opus_int32 a32, /* I numerator (Q0) */
const opus_int32 b32, /* I denominator (Q0) */
const opus_int Qres /* I Q-domain of result (>= 0) */
)
{
opus_int a_headrm, b_headrm, lshift;
......@@ -106,22 +108,22 @@ static inline opus_int32 silk_DIV32_varQ( /* O returns a good approximatio
/* Compute number of bits head room and normalize inputs */
a_headrm = silk_CLZ32( silk_abs(a32) ) - 1;
a32_nrm = silk_LSHIFT(a32, a_headrm); /* Q: a_headrm */
a32_nrm = silk_LSHIFT(a32, a_headrm); /* Q: a_headrm */
b_headrm = silk_CLZ32( silk_abs(b32) ) - 1;
b32_nrm = silk_LSHIFT(b32, b_headrm); /* Q: b_headrm */
b32_nrm = silk_LSHIFT(b32, b_headrm); /* Q: b_headrm */
/* Inverse of b32, with 14 bits of precision */
b32_inv = silk_DIV32_16( silk_int32_MAX >> 2, silk_RSHIFT(b32_nrm, 16) ); /* Q: 29 + 16 - b_headrm */
b32_inv = silk_DIV32_16( silk_int32_MAX >> 2, silk_RSHIFT(b32_nrm, 16) ); /* Q: 29 + 16 - b_headrm */
/* First approximation */
result = silk_SMULWB(a32_nrm, b32_inv); /* Q: 29 + a_headrm - b_headrm */
result = silk_SMULWB(a32_nrm, b32_inv); /* Q: 29 + a_headrm - b_headrm */
/* Compute residual by subtracting product of denominator and first approximation */
/* It's OK to overflow because the final value of a32_nrm should always be small */
a32_nrm = silk_SUB32_ovflw(a32_nrm, silk_LSHIFT_ovflw( silk_SMMUL(b32_nrm, result), 3 )); /* Q: a_headrm */
a32_nrm = silk_SUB32_ovflw(a32_nrm, silk_LSHIFT_ovflw( silk_SMMUL(b32_nrm, result), 3 )); /* Q: a_headrm */
/* Refinement */
result = silk_SMLAWB(result, a32_nrm, b32_inv); /* Q: 29 + a_headrm - b_headrm */
result = silk_SMLAWB(result, a32_nrm, b32_inv); /* Q: 29 + a_headrm - b_headrm */
/* Convert to Qres domain */
lshift = 29 + a_headrm - b_headrm - Qres;
......@@ -138,9 +140,9 @@ static inline opus_int32 silk_DIV32_varQ( /* O returns a good approximatio
}
/* Invert int32 value and return result as int32 in a given Q-domain */
static inline opus_int32 silk_INVERSE32_varQ( /* O returns a good approximation of "(1 << Qres) / b32" */
const opus_int32 b32, /* I denominator (Q0) */
const opus_int Qres /* I Q-domain of result (> 0) */
static inline opus_int32 silk_INVERSE32_varQ( /* O returns a good approximation of "(1 << Qres) / b32" */
const opus_int32 b32, /* I denominator (Q0) */
const opus_int Qres /* I Q-domain of result (> 0) */
)
{
opus_int b_headrm, lshift;
......@@ -151,19 +153,19 @@ static inline opus_int32 silk_INVERSE32_varQ( /* O returns a good approxim
/* Compute number of bits head room and normalize input */
b_headrm = silk_CLZ32( silk_abs(b32) ) - 1;
b32_nrm = silk_LSHIFT(b32, b_headrm); /* Q: b_headrm */
b32_nrm = silk_LSHIFT(b32, b_headrm); /* Q: b_headrm */
/* Inverse of b32, with 14 bits of precision */
b32_inv = silk_DIV32_16( silk_int32_MAX >> 2, silk_RSHIFT(b32_nrm, 16) ); /* Q: 29 + 16 - b_headrm */
b32_inv = silk_DIV32_16( silk_int32_MAX >> 2, silk_RSHIFT(b32_nrm, 16) ); /* Q: 29 + 16 - b_headrm */
/* First approximation */
result = silk_LSHIFT(b32_inv, 16); /* Q: 61 - b_headrm */
result = silk_LSHIFT(b32_inv, 16); /* Q: 61 - b_headrm */
/* Compute residual by subtracting product of denominator and first approximation from one */
err_Q32 = silk_LSHIFT( (1<<29) - silk_SMULWB(b32_nrm, b32_inv), 3 ); /* Q32 */
err_Q32 = silk_LSHIFT( (1<<29) - silk_SMULWB(b32_nrm, b32_inv), 3 ); /* Q32 */
/* Refinement */
result = silk_SMLAWW(result, err_Q32, b32_inv); /* Q: 61 - b_headrm */
result = silk_SMLAWW(result, err_Q32, b32_inv); /* Q: 61 - b_headrm */
/* Convert to Qres domain */
lshift = 61 - b_headrm - Qres;
......
......@@ -39,11 +39,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*******************************************/
void silk_LPC_analysis_filter(
opus_int16 *out, /* O: Output signal */
const opus_int16 *in, /* I: Input signal */
const opus_int16 *B, /* I: MA prediction coefficients, Q12 [order] */
const opus_int32 len, /* I: Signal length */
const opus_int32 d /* I: Filter order */
opus_int16 *out, /* O Output signal */
const opus_int16 *in, /* I Input signal */
const opus_int16 *B, /* I MA prediction coefficients, Q12 [order] */
const opus_int32 len, /* I Signal length */
const opus_int32 d /* I Filter order */
)
{
opus_int ix, j;
......@@ -54,10 +54,10 @@ void silk_LPC_analysis_filter(
silk_assert( (d & 1) == 0 );
silk_assert( d <= len );
for ( ix = d; ix < len; ix++) {
for( ix = d; ix < len; ix++ ) {
in_ptr = &in[ ix - 1 ];
out32_Q12 = silk_SMULBB( in_ptr[ 0 ], B[ 0 ] );
out32_Q12 = silk_SMULBB( in_ptr[ 0 ], B[ 0 ] );
/* Allowing wrap around so that two wraps can cancel each other. The rare
cases where the result wraps around can only be triggered by invalid streams*/
out32_Q12 = silk_SMLABB_ovflw( out32_Q12, in_ptr[ -1 ], B[ 1 ] );
......
......@@ -31,18 +31,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SigProc_FIX.h"
#define QA 24
#define A_LIMIT SILK_FIX_CONST( 0.99975, QA )
#define QA 24
#define A_LIMIT SILK_FIX_CONST( 0.99975, QA )
#define MUL32_FRAC_Q(a32, b32, Q) ((opus_int32)(silk_RSHIFT_ROUND64(silk_SMULL(a32, b32), Q)))
#define MUL32_FRAC_Q(a32, b32, Q) ((opus_int32)(silk_RSHIFT_ROUND64(silk_SMULL(a32, b32), Q)))
/* Compute inverse of LPC prediction gain, and */
/* test if LPC coefficients are stable (all poles within unit circle) */
static opus_int LPC_inverse_pred_gain_QA( /* O: Returns 1 if unstable, otherwise 0 */
opus_int32 *invGain_Q30, /* O: Inverse prediction gain, Q30 energy domain */
opus_int32 A_QA[ 2 ][ SILK_MAX_ORDER_LPC ],
/* I: Prediction coefficients */
const opus_int order /* I: Prediction order */
static opus_int LPC_inverse_pred_gain_QA( /* O Returns 1 if unstable, otherwise 0 */
opus_int32 *invGain_Q30, /* O Inverse prediction gain, Q30 energy domain */
opus_int32 A_QA[ 2 ][ SILK_MAX_ORDER_LPC ], /* I Prediction coefficients */
const opus_int order /* I Prediction order */
)
{
opus_int k, n, mult2Q;
......@@ -108,10 +107,10 @@ static opus_int LPC_inverse_pred_gain_QA( /* O: Returns 1 if unstable,
}
/* For input in Q12 domain */
opus_int silk_LPC_inverse_pred_gain( /* O: Returns 1 if unstable, otherwise 0 */
opus_int32 *invGain_Q30, /* O: Inverse prediction gain, Q30 energy domain */
const opus_int16 *A_Q12, /* I: Prediction coefficients, Q12 [order] */
const opus_int order /* I: Prediction order */
opus_int silk_LPC_inverse_pred_gain( /* O Returns 1 if unstable, otherwise 0 */
opus_int32 *invGain_Q30, /* O Inverse prediction gain, Q30 energy domain */
const opus_int16 *A_Q12, /* I Prediction coefficients, Q12 [order] */
const opus_int order /* I Prediction order */
)
{
opus_int k;
......@@ -127,17 +126,17 @@ opus_int silk_LPC_inverse_pred_gain( /* O: Returns 1 if unstable,
Anew_QA[ k ] = silk_LSHIFT( (opus_int32)A_Q12[ k ], QA - 12 );
}
/* If the DC is unstable, we don't even need to do the full calculations */
if ( DC_resp >= 4096 ) {
if( DC_resp >= 4096 ) {
return 1;
}
return LPC_inverse_pred_gain_QA( invGain_Q30, Atmp_QA, order );
}
/* For input in Q24 domain */
opus_int silk_LPC_inverse_pred_gain_Q24( /* O: Returns 1 if unstable, otherwise 0 */
opus_int32 *invGain_Q30, /* O: Inverse prediction gain, Q30 energy domain */
const opus_int32 *A_Q24, /* I: Prediction coefficients, Q24 [order] */
const opus_int order /* I: Prediction order */
opus_int silk_LPC_inverse_pred_gain_Q24( /* O Returns 1 if unstable, otherwise 0 */
opus_int32 *invGain_Q30, /* O Inverse prediction gain, Q30 energy domain */
const opus_int32 *A_Q24, /* I Prediction coefficients, Q24 [order] */
const opus_int order /* I Prediction order */
)
{
opus_int k;
......
......@@ -30,12 +30,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif
/*
Elliptic/Cauer filters designed with 0.1 dB passband ripple,
80 dB minimum stopband attenuation, and
[0.95 : 0.15 : 0.35] normalized cut off frequencies.
80 dB minimum stopband attenuation, and
[0.95 : 0.15 : 0.35] normalized cut off frequencies.
*/
#include "main.h"
/* Helper function, interpolates the filter taps */
......@@ -99,9 +98,9 @@ static inline void silk_LP_interpolate_filter_taps(
/* Start by setting psEncC->mode <> 0; */
/* Deactivate by setting psEncC->mode = 0; */
void silk_LP_variable_cutoff(
silk_LP_state *psLP, /* I/O LP filter state */
opus_int16 *frame, /* I/O Low-pass filtered output */
const opus_int frame_length /* I Frame length */
silk_LP_state *psLP, /* I/O LP filter state */
opus_int16 *frame, /* I/O Low-pass filtered output signal */
const opus_int frame_length /* I Frame length */
)
{
opus_int32 B_Q28[ TRANSITION_NB ], A_Q28[ TRANSITION_NA ], fac_Q16 = 0;
......
......@@ -33,7 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if 0 && defined (_DEBUG) && !defined (silk_MACRO_COUNT)
#undef silk_ADD16
#undef silk_ADD16
static inline opus_int16 silk_ADD16(opus_int16 a, opus_int16 b){
opus_int16 ret;
......@@ -42,7 +42,7 @@ static inline opus_int16 silk_ADD16(opus_int16 a, opus_int16 b){
return ret;
}
#undef silk_ADD32
#undef silk_ADD32
static inline opus_int32 silk_ADD32(opus_int32 a, opus_int32 b){
opus_int32 ret;
......@@ -51,7 +51,7 @@ static inline opus_int32 silk_ADD32(opus_int32 a, opus_int32 b){
return ret;
}
#undef silk_ADD64
#undef silk_ADD64
static inline opus_int64 silk_ADD64(opus_int64 a, opus_int64 b){
opus_int64 ret;
......@@ -60,7 +60,7 @@ static inline opus_int64 silk_ADD64(opus_int64 a, opus_int64 b){
return ret;
}
#undef silk_SUB16
#undef silk_SUB16
static inline opus_int16 silk_SUB16(opus_int16 a, opus_int16 b){
opus_int16 ret;
......@@ -69,7 +69,7 @@ static inline opus_int16 silk_SUB16(opus_int16 a, opus_int16 b){
return ret;
}
#undef silk_SUB32
#undef silk_SUB32
static inline opus_int32 silk_SUB32(opus_int32 a, opus_int32 b){
opus_int32 ret;
......@@ -78,7 +78,7 @@ static inline opus_int32 silk_SUB32(opus_int32 a, opus_int32 b){
return ret;
}
#undef silk_SUB64
#undef silk_SUB64
static inline opus_int64 silk_SUB64(opus_int64 a, opus_int64 b){
opus_int64 ret;
......@@ -175,6 +175,7 @@ static inline opus_uint32 silk_MUL_uint(opus_uint32 a32, opus_uint32 b32){
silk_assert((opus_uint64)ret == (opus_uint64)a32 * (opus_uint64)b32); /* Check output overflow */
return ret;
}
#undef silk_MLA
static inline opus_int32 silk_MLA(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
......@@ -191,14 +192,15 @@ static inline opus_int32 silk_MLA_uint(opus_uint32 a32, opus_uint32 b32, opus_ui
return ret;
}
#undef silk_SMULWB
#undef silk_SMULWB
static inline opus_int32 silk_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);
silk_assert((opus_int64)ret == ((opus_int64)a32 * (opus_int16)b32) >> 16);
return ret;
}
#undef silk_SMLAWB
#undef silk_SMLAWB
static inline opus_int32 silk_SMLAWB(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
ret = silk_ADD32( a32, silk_SMULWB( b32, c32 ) );
......@@ -213,6 +215,7 @@ static inline opus_int32 silk_SMULWT(opus_int32 a32, opus_int32 b32){
silk_assert((opus_int64)ret == ((opus_int64)a32 * (b32 >> 16)) >> 16);
return ret;
}
#undef silk_SMLAWT
static inline opus_int32 silk_SMLAWT(opus_int32 a32, opus_int32 b32, opus_int32 c32){
opus_int32 ret;
......@@ -234,7 +237,7 @@ static inline opus_int64 silk_SMULL(opus_int64 a64, opus_int64 b64){
}