mirror of
https://github.com/xiph/opus.git
synced 2025-05-29 06:39:15 +00:00
Reformatting changes with an update to the MSVC project files
This commit is contained in:
parent
2d4f614091
commit
acc7a6c78b
151 changed files with 3736 additions and 4091 deletions
|
@ -43,9 +43,6 @@ 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(
|
||||
|
@ -122,7 +119,7 @@ static inline void silk_A2NLSF_init(
|
|||
/* 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_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) */
|
||||
)
|
||||
|
@ -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 */
|
||||
|
|
58
silk/API.h
58
silk/API.h
|
@ -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 */
|
||||
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 *nBytesOut, /* I/O Number of bytes in payload (input: Max bytes) */
|
||||
const opus_int prefillFlag /* I Flag to indicate prefilling buffers no coding */
|
||||
);
|
||||
|
||||
/****************************************/
|
||||
|
@ -97,28 +97,28 @@ 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 */
|
||||
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_int16 *samplesOut, /* O Decoded output speech vector */
|
||||
opus_int32 *nSamplesOut /* O Number of samples decoded */
|
||||
);
|
||||
|
||||
/**************************************/
|
||||
|
@ -126,9 +126,9 @@ opus_int silk_Decode( /* O: Returns error c
|
|||
/**************************************/
|
||||
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_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
|
||||
|
|
|
@ -79,7 +79,7 @@ void silk_CNG_Reset(
|
|||
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_int16 frame[], /* I/O Signal */
|
||||
opus_int length /* I Length of residual */
|
||||
)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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,7 +54,7 @@ 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 ] );
|
||||
|
|
|
@ -38,11 +38,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* 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.
|
||||
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
|
||||
/* Helper function, interpolates the filter taps */
|
||||
|
@ -100,7 +99,7 @@ static inline void silk_LP_interpolate_filter_taps(
|
|||
/* 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 */
|
||||
opus_int16 *frame, /* I/O Low-pass filtered output signal */
|
||||
const opus_int frame_length /* I Frame length */
|
||||
)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
@ -198,6 +199,7 @@ static inline opus_int32 silk_SMULWB(opus_int32 a32, opus_int32 b32){
|
|||
silk_assert((opus_int64)ret == ((opus_int64)a32 * (opus_int16)b32) >> 16);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef silk_SMLAWB
|
||||
static inline opus_int32 silk_SMLAWB(opus_int32 a32, opus_int32 b32, opus_int32 c32){
|
||||
opus_int32 ret;
|
||||
|
@ -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;
|
||||
|
@ -325,6 +328,7 @@ static inline opus_int32 silk_DIV32_16(opus_int32 a32, opus_int32 b32){
|
|||
no checking needed for silk_ADD_POS_SAT16
|
||||
no checking needed for silk_ADD_POS_SAT32
|
||||
no checking needed for silk_ADD_POS_SAT64 */
|
||||
|
||||
#undef silk_LSHIFT8
|
||||
static inline opus_int8 silk_LSHIFT8(opus_int8 a, opus_int32 shift){
|
||||
opus_int8 ret;
|
||||
|
@ -334,6 +338,7 @@ static inline opus_int8 silk_LSHIFT8(opus_int8 a, opus_int32 shift){
|
|||
silk_assert((opus_int64)ret == ((opus_int64)a) << shift);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef silk_LSHIFT16
|
||||
static inline opus_int16 silk_LSHIFT16(opus_int16 a, opus_int32 shift){
|
||||
opus_int16 ret;
|
||||
|
@ -343,6 +348,7 @@ static inline opus_int16 silk_LSHIFT16(opus_int16 a, opus_int32 shift){
|
|||
silk_assert((opus_int64)ret == ((opus_int64)a) << shift);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef silk_LSHIFT32
|
||||
static inline opus_int32 silk_LSHIFT32(opus_int32 a, opus_int32 shift){
|
||||
opus_int32 ret;
|
||||
|
@ -352,6 +358,7 @@ static inline opus_int32 silk_LSHIFT32(opus_int32 a, opus_int32 shift){
|
|||
silk_assert((opus_int64)ret == ((opus_int64)a) << shift);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef silk_LSHIFT64
|
||||
static inline opus_int64 silk_LSHIFT64(opus_int64 a, opus_int shift){
|
||||
silk_assert(shift >= 0);
|
||||
|
@ -380,18 +387,21 @@ static inline opus_int8 silk_RSHIFT8(opus_int8 a, opus_int32 shift){
|
|||
silk_assert(shift < 8);
|
||||
return a >> shift;
|
||||
}
|
||||
|
||||
#undef silk_RSHIFT16
|
||||
static inline opus_int16 silk_RSHIFT16(opus_int16 a, opus_int32 shift){
|
||||
silk_assert(shift >= 0);
|
||||
silk_assert(shift < 16);
|
||||
return a >> shift;
|
||||
}
|
||||
|
||||
#undef silk_RSHIFT32
|
||||
static inline opus_int32 silk_RSHIFT32(opus_int32 a, opus_int32 shift){
|
||||
silk_assert(shift >= 0);
|
||||
silk_assert(shift < 32);
|
||||
return a >> shift;
|
||||
}
|
||||
|
||||
#undef silk_RSHIFT64
|
||||
static inline opus_int64 silk_RSHIFT64(opus_int64 a, opus_int64 shift){
|
||||
silk_assert(shift >= 0);
|
||||
|
@ -415,6 +425,7 @@ static inline opus_int32 silk_ADD_LSHIFT(opus_int32 a, opus_int32 b, opus_int32
|
|||
silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift));
|
||||
return ret; /* shift >= 0 */
|
||||
}
|
||||
|
||||
#undef silk_ADD_LSHIFT32
|
||||
static inline opus_int32 silk_ADD_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
|
||||
opus_int32 ret;
|
||||
|
@ -424,6 +435,7 @@ static inline opus_int32 silk_ADD_LSHIFT32(opus_int32 a, opus_int32 b, opus_int3
|
|||
silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift));
|
||||
return ret; /* shift >= 0 */
|
||||
}
|
||||
|
||||
#undef silk_ADD_LSHIFT_uint
|
||||
static inline opus_uint32 silk_ADD_LSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){
|
||||
opus_uint32 ret;
|
||||
|
@ -433,6 +445,7 @@ static inline opus_uint32 silk_ADD_LSHIFT_uint(opus_uint32 a, opus_uint32 b, opu
|
|||
silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift));
|
||||
return ret; /* shift >= 0 */
|
||||
}
|
||||
|
||||
#undef silk_ADD_RSHIFT
|
||||
static inline opus_int32 silk_ADD_RSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){
|
||||
opus_int32 ret;
|
||||
|
@ -442,6 +455,7 @@ static inline opus_int32 silk_ADD_RSHIFT(opus_int32 a, opus_int32 b, opus_int32
|
|||
silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift));
|
||||
return ret; /* shift > 0 */
|
||||
}
|
||||
|
||||
#undef silk_ADD_RSHIFT32
|
||||
static inline opus_int32 silk_ADD_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
|
||||
opus_int32 ret;
|
||||
|
@ -451,6 +465,7 @@ static inline opus_int32 silk_ADD_RSHIFT32(opus_int32 a, opus_int32 b, opus_int3
|
|||
silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift));
|
||||
return ret; /* shift > 0 */
|
||||
}
|
||||
|
||||
#undef silk_ADD_RSHIFT_uint
|
||||
static inline opus_uint32 silk_ADD_RSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){
|
||||
opus_uint32 ret;
|
||||
|
@ -460,6 +475,7 @@ static inline opus_uint32 silk_ADD_RSHIFT_uint(opus_uint32 a, opus_uint32 b, opu
|
|||
silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift));
|
||||
return ret; /* shift > 0 */
|
||||
}
|
||||
|
||||
#undef silk_SUB_LSHIFT32
|
||||
static inline opus_int32 silk_SUB_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
|
||||
opus_int32 ret;
|
||||
|
@ -469,6 +485,7 @@ static inline opus_int32 silk_SUB_LSHIFT32(opus_int32 a, opus_int32 b, opus_int3
|
|||
silk_assert((opus_int64)ret == (opus_int64)a - (((opus_int64)b) << shift));
|
||||
return ret; /* shift >= 0 */
|
||||
}
|
||||
|
||||
#undef silk_SUB_RSHIFT32
|
||||
static inline opus_int32 silk_SUB_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
|
||||
opus_int32 ret;
|
||||
|
|
|
@ -40,9 +40,9 @@ Signal Processing, pp. 641-644, 1991.
|
|||
|
||||
/* Laroia low complexity NLSF weights */
|
||||
void silk_NLSF_VQ_weights_laroia(
|
||||
opus_int16 *pNLSFW_Q_OUT, /* O: Pointer to input vector weights [D x 1] */
|
||||
const opus_int16 *pNLSF_Q15, /* I: Pointer to input vector [D x 1] */
|
||||
const opus_int D /* I: Input vector dimension (even) */
|
||||
opus_int16 *pNLSFW_Q_OUT, /* O Pointer to input vector weights [D] */
|
||||
const opus_int16 *pNLSF_Q15, /* I Pointer to input vector [D] */
|
||||
const opus_int D /* I Input vector dimension (even) */
|
||||
)
|
||||
{
|
||||
opus_int k;
|
||||
|
|
|
@ -31,8 +31,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "main.h"
|
||||
|
||||
#define STORE_LSF_DATA_FOR_TRAINING 0
|
||||
|
||||
/***********************/
|
||||
/* NLSF vector encoder */
|
||||
/***********************/
|
||||
|
@ -61,15 +59,6 @@ opus_int32 silk_NLSF_encode( /* O Returns RD
|
|||
opus_int16 ec_ix[ MAX_LPC_ORDER ];
|
||||
const opus_uint8 *pCB_element, *iCDF_ptr;
|
||||
|
||||
#if STORE_LSF_DATA_FOR_TRAINING
|
||||
opus_int16 pNLSF_Q15_orig[MAX_LPC_ORDER ];
|
||||
DEBUG_STORE_DATA( NLSF.dat, pNLSF_Q15, psNLSF_CB->order * sizeof( opus_int16 ) );
|
||||
DEBUG_STORE_DATA( WNLSF.dat, pW_Q5, psNLSF_CB->order * sizeof( opus_int16 ) );
|
||||
DEBUG_STORE_DATA( NLSF_mu.dat, &NLSF_mu_Q20, sizeof( opus_int ) );
|
||||
DEBUG_STORE_DATA( sigType.dat, &signalType, sizeof( opus_int ) );
|
||||
silk_memcpy(pNLSF_Q15_orig, pNLSF_Q15, sizeof( pNLSF_Q15_orig ));
|
||||
#endif
|
||||
|
||||
silk_assert( nSurvivors <= NLSF_VQ_MAX_SURVIVORS );
|
||||
silk_assert( signalType >= 0 && signalType <= 2 );
|
||||
silk_assert( NLSF_mu_Q20 <= 32767 && NLSF_mu_Q20 >= 0 );
|
||||
|
@ -135,53 +124,5 @@ opus_int32 silk_NLSF_encode( /* O Returns RD
|
|||
/* Decode */
|
||||
silk_NLSF_decode( pNLSF_Q15, NLSFIndices, psNLSF_CB );
|
||||
|
||||
#if STORE_LSF_DATA_FOR_TRAINING
|
||||
{
|
||||
/* 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 );
|
||||
|
||||
pCB_element = &psNLSF_CB->CB1_NLSF_Q8[ ind1 * psNLSF_CB->order ];
|
||||
for( i = 0; i < psNLSF_CB->order; i++ ) {
|
||||
NLSF_tmp_Q15[ i ] = silk_LSHIFT16( ( opus_int16 )pCB_element[ i ], 7 );
|
||||
}
|
||||
silk_NLSF_VQ_weights_laroia( W_tmp_QW, NLSF_tmp_Q15, psNLSF_CB->order );
|
||||
for( i = 0; i < psNLSF_CB->order; i++ ) {
|
||||
W_tmp_Q9 = silk_SQRT_APPROX( silk_LSHIFT( ( opus_int32 )W_tmp_QW[ i ], 18 - NLSF_W_Q ) );
|
||||
res_Q15[ i ] = pNLSF_Q15_orig[ i ] - NLSF_tmp_Q15[ i ];
|
||||
res_Q10[ i ] = (opus_int16)silk_RSHIFT( silk_SMULBB( res_Q15[ i ], W_tmp_Q9 ), 14 );
|
||||
DEBUG_STORE_DATA( NLSF_res_q10.dat, &res_Q10[ i ], sizeof( opus_int16 ) );
|
||||
res_Q15[ i ] = pNLSF_Q15[ i ] - NLSF_tmp_Q15[ i ];
|
||||
res_Q10[ i ] = (opus_int16)silk_RSHIFT( silk_SMULBB( res_Q15[ i ], W_tmp_Q9 ), 14 );
|
||||
DEBUG_STORE_DATA( NLSF_resq_q10.dat, &res_Q10[ i ], sizeof( opus_int16 ) );
|
||||
}
|
||||
|
||||
Dist_Q22_dec = 0;
|
||||
for( i = 0; i < psNLSF_CB->order; i++ ) {
|
||||
diff_Q15 = pNLSF_Q15_orig[ i ] - pNLSF_Q15[ i ];
|
||||
Dist_Q22_dec += ( ( (diff_Q15 >> 5) * (diff_Q15 >> 5) ) * pW_Q5[ i ] ) >> 3;
|
||||
}
|
||||
iCDF_ptr = &psNLSF_CB->CB1_iCDF[ ( signalType >> 1 ) * psNLSF_CB->nVectors ];
|
||||
if( ind1 == 0 ) {
|
||||
prob_Q8 = 256 - iCDF_ptr[ ind1 ];
|
||||
} else {
|
||||
prob_Q8 = iCDF_ptr[ ind1 - 1 ] - iCDF_ptr[ ind1 ];
|
||||
}
|
||||
Rate_Q7 = ( 8 << 7 ) - silk_lin2log( prob_Q8 );
|
||||
for( i = 0; i < psNLSF_CB->order; i++ ) {
|
||||
Rate_Q7 += ((int)psNLSF_CB->ec_Rates_Q5[ ec_ix[ i ] + silk_LIMIT( NLSFIndices[ i + 1 ] + NLSF_QUANT_MAX_AMPLITUDE, 0, 2 * NLSF_QUANT_MAX_AMPLITUDE ) ] ) << 2;
|
||||
if( silk_abs( NLSFIndices[ i + 1 ] ) >= NLSF_QUANT_MAX_AMPLITUDE ) {
|
||||
Rate_Q7 += 128 << ( silk_abs( NLSFIndices[ i + 1 ] ) - NLSF_QUANT_MAX_AMPLITUDE );
|
||||
}
|
||||
}
|
||||
RD_dec_Q22 = Dist_Q22_dec + Rate_Q7 * NLSF_mu_Q20 >> 5;
|
||||
DEBUG_STORE_DATA( dec_dist_q22.dat, &Dist_Q22_dec, sizeof( opus_int32 ) );
|
||||
DEBUG_STORE_DATA( dec_rate_q7.dat, &Rate_Q7, sizeof( opus_int32 ) );
|
||||
DEBUG_STORE_DATA( dec_rd_q22.dat, &RD_dec_Q22, sizeof( opus_int32 ) );
|
||||
}
|
||||
DEBUG_STORE_DATA( NLSF_ind.dat, NLSFIndices, (psNLSF_CB->order+1) * sizeof( opus_int8 ) );
|
||||
#endif
|
||||
|
||||
return RD_Q25[ 0 ];
|
||||
}
|
||||
|
|
|
@ -45,9 +45,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* NLSF stabilizer, for a single input data vector */
|
||||
void silk_NLSF_stabilize(
|
||||
opus_int16 *NLSF_Q15, /* I/O: Unstable/stabilized normalized LSF vector in Q15 [L] */
|
||||
const opus_int16 *NDeltaMin_Q15, /* I: Normalized delta min vector in Q15, NDeltaMin_Q15[L] must be >= 1 [L+1] */
|
||||
const opus_int L /* I: Number of NLSF parameters in the input vector */
|
||||
opus_int16 *NLSF_Q15, /* I/O Unstable/stabilized normalized LSF vector in Q15 [L] */
|
||||
const opus_int16 *NDeltaMin_Q15, /* I Min distance vector, NDeltaMin_Q15[L] must be >= 1 [L+1] */
|
||||
const opus_int L /* I Number of NLSF parameters in the input vector */
|
||||
)
|
||||
{
|
||||
opus_int i, I=0, k, loops;
|
||||
|
@ -82,7 +82,7 @@ void silk_NLSF_stabilize(
|
|||
/***************************************************/
|
||||
/* Now check if the smallest distance non-negative */
|
||||
/***************************************************/
|
||||
if (min_diff_Q15 >= 0) {
|
||||
if( min_diff_Q15 >= 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
25
silk/NSQ.c
25
silk/NSQ.c
|
@ -71,17 +71,17 @@ void silk_NSQ(
|
|||
const silk_encoder_state *psEncC, /* I/O Encoder State */
|
||||
silk_nsq_state *NSQ, /* I/O NSQ state */
|
||||
SideInfoIndices *psIndices, /* I/O Quantization Indices */
|
||||
const opus_int16 x[], /* I prefiltered input signal */
|
||||
opus_int8 pulses[], /* O quantized qulse signal */
|
||||
const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefficients */
|
||||
const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefficients */
|
||||
const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I */
|
||||
const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int16 x[], /* I Prefiltered input signal */
|
||||
opus_int8 pulses[], /* O Quantized pulse signal */
|
||||
const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */
|
||||
const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */
|
||||
const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */
|
||||
const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */
|
||||
const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */
|
||||
const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int pitchL[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int Lambda_Q10, /* I */
|
||||
const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I Low frequency shaping coefs */
|
||||
const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I Quantization step sizes */
|
||||
const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lags */
|
||||
const opus_int Lambda_Q10, /* I Rate/distortion tradeoff */
|
||||
const opus_int LTP_scale_Q14 /* I LTP state scaling */
|
||||
)
|
||||
{
|
||||
|
@ -159,11 +159,6 @@ void silk_NSQ(
|
|||
/* Save quantized speech and noise shaping signals */
|
||||
silk_memmove( NSQ->xq, &NSQ->xq[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( opus_int16 ) );
|
||||
silk_memmove( NSQ->sLTP_shp_Q10, &NSQ->sLTP_shp_Q10[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( opus_int32 ) );
|
||||
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
DEBUG_STORE_DATA( xq.dat, &pxq[ -psEncC->frame_length ], psEncC->frame_length * sizeof( opus_int16 ) );
|
||||
DEBUG_STORE_DATA( q.dat, &pulses[ -psEncC->frame_length ], psEncC->frame_length * sizeof( opus_int8 ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
/***********************************/
|
||||
|
|
|
@ -109,15 +109,15 @@ void silk_NSQ_del_dec(
|
|||
SideInfoIndices *psIndices, /* I/O Quantization Indices */
|
||||
const opus_int16 x[], /* I Prefiltered input signal */
|
||||
opus_int8 pulses[], /* O Quantized pulse signal */
|
||||
const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Prediction coefs */
|
||||
const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I LT prediction coefs */
|
||||
const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I */
|
||||
const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */
|
||||
const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */
|
||||
const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */
|
||||
const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */
|
||||
const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */
|
||||
const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int pitchL[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int Lambda_Q10, /* I */
|
||||
const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I Low frequency shaping coefs */
|
||||
const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I Quantization step sizes */
|
||||
const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lags */
|
||||
const opus_int Lambda_Q10, /* I Rate/distortion tradeoff */
|
||||
const opus_int LTP_scale_Q14 /* I LTP state scaling */
|
||||
)
|
||||
{
|
||||
|
@ -285,11 +285,6 @@ void silk_NSQ_del_dec(
|
|||
/* Save quantized speech and noise shaping signals */
|
||||
silk_memmove( NSQ->xq, &NSQ->xq[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( opus_int16 ) );
|
||||
silk_memmove( NSQ->sLTP_shp_Q10, &NSQ->sLTP_shp_Q10[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( opus_int32 ) );
|
||||
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
DEBUG_STORE_DATA( xq.dat, &pxq[ -psEncC->frame_length ], psEncC->frame_length * sizeof( opus_int16 ) );
|
||||
DEBUG_STORE_DATA( q.dat, &pulses[ -psEncC->frame_length ], psEncC->frame_length * sizeof( opus_int8 ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
/******************************************/
|
||||
|
|
16
silk/PLC.c
16
silk/PLC.c
|
@ -57,9 +57,9 @@ void silk_PLC_Reset(
|
|||
}
|
||||
|
||||
void silk_PLC(
|
||||
silk_decoder_state *psDec, /* I Decoder state */
|
||||
silk_decoder_control *psDecCtrl, /* I Decoder control */
|
||||
opus_int16 frame[], /* O Concealed signal */
|
||||
silk_decoder_state *psDec, /* I/O Decoder state */
|
||||
silk_decoder_control *psDecCtrl, /* I/O Decoder control */
|
||||
opus_int16 frame[], /* I/O signal */
|
||||
opus_int lost /* I Loss flag */
|
||||
)
|
||||
{
|
||||
|
@ -88,8 +88,8 @@ void silk_PLC(
|
|||
/* Update state of PLC */
|
||||
/**************************************************/
|
||||
static inline void silk_PLC_update(
|
||||
silk_decoder_state *psDec, /* (I/O) Decoder state */
|
||||
silk_decoder_control *psDecCtrl /* (I/O) Decoder control */
|
||||
silk_decoder_state *psDec, /* I/O Decoder state */
|
||||
silk_decoder_control *psDecCtrl /* I/O Decoder control */
|
||||
)
|
||||
{
|
||||
opus_int32 LTP_Gain_Q14, temp_LTP_Gain_Q14;
|
||||
|
@ -104,7 +104,7 @@ static inline void silk_PLC_update(
|
|||
if( psDec->indices.signalType == TYPE_VOICED ) {
|
||||
/* Find the parameters for the last subframe which contains a pitch pulse */
|
||||
for( j = 0; j * psDec->subfr_length < psDecCtrl->pitchL[ psDec->nb_subfr - 1 ]; j++ ) {
|
||||
if( j == psDec->nb_subfr ){
|
||||
if( j == psDec->nb_subfr ) {
|
||||
break;
|
||||
}
|
||||
temp_LTP_Gain_Q14 = 0;
|
||||
|
@ -162,7 +162,7 @@ static inline void silk_PLC_update(
|
|||
static inline void silk_PLC_conceal(
|
||||
silk_decoder_state *psDec, /* I/O Decoder state */
|
||||
silk_decoder_control *psDecCtrl, /* I/O Decoder control */
|
||||
opus_int16 frame[] /* O concealed signal */
|
||||
opus_int16 frame[] /* O LPC residual signal */
|
||||
)
|
||||
{
|
||||
opus_int i, j, k;
|
||||
|
@ -346,7 +346,7 @@ static inline void silk_PLC_conceal(
|
|||
void silk_PLC_glue_frames(
|
||||
silk_decoder_state *psDec, /* I/O decoder state */
|
||||
opus_int16 frame[], /* I/O signal */
|
||||
opus_int length /* I length of residual */
|
||||
opus_int length /* I length of signal */
|
||||
)
|
||||
{
|
||||
opus_int i, energy_shift;
|
||||
|
|
|
@ -37,7 +37,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#define SA_THRES_Q8 50
|
||||
#define USE_SINGLE_TAP 1
|
||||
#define RAND_BUF_SIZE 128
|
||||
#define RAND_BUF_MASK (RAND_BUF_SIZE - 1)
|
||||
#define RAND_BUF_MASK ( RAND_BUF_SIZE - 1 )
|
||||
#define LOG2_INV_LPC_GAIN_HIGH_THRES 3 /* 2^3 = 8 dB LPC gain */
|
||||
#define LOG2_INV_LPC_GAIN_LOW_THRES 8 /* 2^8 = 24 dB LPC gain */
|
||||
#define PITCH_DRIFT_FAC_Q16 655 /* 0.01 in Q16 */
|
||||
|
@ -49,13 +49,13 @@ void silk_PLC_Reset(
|
|||
void silk_PLC(
|
||||
silk_decoder_state *psDec, /* I/O Decoder state */
|
||||
silk_decoder_control *psDecCtrl, /* I/O Decoder control */
|
||||
opus_int16 signal[], /* I/O signal */
|
||||
opus_int16 frame[], /* I/O signal */
|
||||
opus_int lost /* I Loss flag */
|
||||
);
|
||||
|
||||
void silk_PLC_glue_frames(
|
||||
silk_decoder_state *psDec, /* I/O decoder state */
|
||||
opus_int16 signal[], /* I/O signal */
|
||||
opus_int16 frame[], /* I/O signal */
|
||||
opus_int length /* I length of signal */
|
||||
);
|
||||
|
||||
|
|
|
@ -52,39 +52,39 @@ 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) */
|
||||
);
|
||||
|
||||
/*!
|
||||
* 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 */
|
||||
);
|
||||
|
||||
/*!
|
||||
* Downsample 2x, mediocre quality
|
||||
*/
|
||||
void silk_resampler_down2(
|
||||
opus_int32 *S, /* I/O: State vector [ 2 ] */
|
||||
opus_int16 *out, /* O: Output signal [ len ] */
|
||||
const opus_int16 *in, /* I: Input signal [ floor(len/2) ] */
|
||||
opus_int32 inLen /* I: Number of input samples */
|
||||
opus_int32 *S, /* I/O State vector [ 2 ] */
|
||||
opus_int16 *out, /* O Output signal [ len ] */
|
||||
const opus_int16 *in, /* I Input signal [ floor(len/2) ] */
|
||||
opus_int32 inLen /* I Number of input samples */
|
||||
);
|
||||
|
||||
/*!
|
||||
* Downsample by a factor 2/3, low quality
|
||||
*/
|
||||
void silk_resampler_down2_3(
|
||||
opus_int32 *S, /* I/O: State vector [ 6 ] */
|
||||
opus_int16 *out, /* O: Output signal [ floor(2*inLen/3) ] */
|
||||
const opus_int16 *in, /* I: Input signal [ inLen ] */
|
||||
opus_int32 inLen /* I: Number of input samples */
|
||||
opus_int32 *S, /* I/O State vector [ 6 ] */
|
||||
opus_int16 *out, /* O Output signal [ floor(2*inLen/3) ] */
|
||||
const opus_int16 *in, /* I Input signal [ inLen ] */
|
||||
opus_int32 inLen /* I Number of input samples */
|
||||
);
|
||||
|
||||
/*!
|
||||
|
@ -93,22 +93,22 @@ void silk_resampler_down2_3(
|
|||
* can handle (slowly) varying coefficients
|
||||
*/
|
||||
void silk_biquad_alt(
|
||||
const opus_int16 *in, /* I: input signal */
|
||||
const opus_int32 *B_Q28, /* I: MA coefficients [3] */
|
||||
const opus_int32 *A_Q28, /* I: AR coefficients [2] */
|
||||
opus_int32 *S, /* I/O: State vector [2] */
|
||||
opus_int16 *out, /* O: output signal */
|
||||
const opus_int32 len, /* I: signal length (must be even) */
|
||||
opus_int stride /* I: Operate on interleaved signal if > 1 */
|
||||
const opus_int16 *in, /* I input signal */
|
||||
const opus_int32 *B_Q28, /* I MA coefficients [3] */
|
||||
const opus_int32 *A_Q28, /* I AR coefficients [2] */
|
||||
opus_int32 *S, /* I/O State vector [2] */
|
||||
opus_int16 *out, /* O output signal */
|
||||
const opus_int32 len, /* I signal length (must be even) */
|
||||
opus_int stride /* I Operate on interleaved signal if > 1 */
|
||||
);
|
||||
|
||||
/* Variable order MA prediction error filter. */
|
||||
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 Order /* 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 */
|
||||
);
|
||||
|
||||
/* Chirp (bandwidth expand) LP AR filter */
|
||||
|
@ -127,41 +127,47 @@ void silk_bwexpander_32(
|
|||
|
||||
/* Compute inverse of LPC prediction gain, and */
|
||||
/* test if LPC coefficients are stable (all poles within unit circle) */
|
||||
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 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 */
|
||||
);
|
||||
|
||||
/* split signal in two decimated bands using first-order allpass filters */
|
||||
/* Split signal in two decimated bands using first-order allpass filters */
|
||||
void silk_ana_filt_bank_1(
|
||||
const opus_int16 *in, /* I: Input signal [N] */
|
||||
opus_int32 *S, /* I/O: State vector [2] */
|
||||
opus_int16 *outL, /* O: Low band [N/2] */
|
||||
opus_int16 *outH, /* O: High band [N/2] */
|
||||
const opus_int32 N /* I: Number of input samples */
|
||||
const opus_int16 *in, /* I Input signal [N] */
|
||||
opus_int32 *S, /* I/O State vector [2] */
|
||||
opus_int16 *outL, /* O Low band [N/2] */
|
||||
opus_int16 *outH, /* O High band [N/2] */
|
||||
const opus_int32 N /* I Number of input samples */
|
||||
);
|
||||
|
||||
/********************************************************************/
|
||||
/* SCALAR FUNCTIONS */
|
||||
/********************************************************************/
|
||||
|
||||
/* approximation of 128 * log2() (exact inverse of approx 2^() below) */
|
||||
/* convert input to a log scale */
|
||||
opus_int32 silk_lin2log(const opus_int32 inLin); /* I: input in linear scale */
|
||||
/* Approximation of 128 * log2() (exact inverse of approx 2^() below) */
|
||||
/* Convert input to a log scale */
|
||||
opus_int32 silk_lin2log(
|
||||
const opus_int32 inLin /* I input in linear scale */
|
||||
);
|
||||
|
||||
/* Approximation of a sigmoid function */
|
||||
opus_int silk_sigm_Q15(opus_int in_Q5);
|
||||
opus_int silk_sigm_Q15(
|
||||
opus_int in_Q5 /* I */
|
||||
);
|
||||
|
||||
/* approximation of 2^() (exact inverse of approx log2() above) */
|
||||
/* convert input to a linear scale */
|
||||
opus_int32 silk_log2lin(const opus_int32 inLog_Q7); /* I: input on log scale */
|
||||
/* Approximation of 2^() (exact inverse of approx log2() above) */
|
||||
/* Convert input to a linear scale */
|
||||
opus_int32 silk_log2lin(
|
||||
const opus_int32 inLog_Q7 /* I input on log scale */
|
||||
);
|
||||
|
||||
/* Function that returns the maximum absolut value of the input vector */
|
||||
opus_int16 silk_int16_array_maxabs( /* O Maximum absolute value, max: 2^15-1 */
|
||||
|
@ -181,33 +187,33 @@ void silk_sum_sqr_shift(
|
|||
/* Calculates the reflection coefficients from the correlation sequence */
|
||||
/* Faster than schur64(), but much less accurate. */
|
||||
/* uses SMLAWB(), requiring armv5E and higher. */
|
||||
opus_int32 silk_schur( /* O: Returns residual energy */
|
||||
opus_int16 *rc_Q15, /* O: reflection coefficients [order] Q15 */
|
||||
const opus_int32 *c, /* I: correlations [order+1] */
|
||||
const opus_int32 order /* I: prediction order */
|
||||
opus_int32 silk_schur( /* O Returns residual energy */
|
||||
opus_int16 *rc_Q15, /* O reflection coefficients [order] Q15 */
|
||||
const opus_int32 *c, /* I correlations [order+1] */
|
||||
const opus_int32 order /* I prediction order */
|
||||
);
|
||||
|
||||
/* Calculates the reflection coefficients from the correlation sequence */
|
||||
/* Slower than schur(), but more accurate. */
|
||||
/* Uses SMULL(), available on armv4 */
|
||||
opus_int32 silk_schur64( /* O: returns residual energy */
|
||||
opus_int32 rc_Q16[], /* O: Reflection coefficients [order] Q16 */
|
||||
const opus_int32 c[], /* I: Correlations [order+1] */
|
||||
opus_int32 order /* I: Prediction order */
|
||||
opus_int32 silk_schur64( /* O returns residual energy */
|
||||
opus_int32 rc_Q16[], /* O Reflection coefficients [order] Q16 */
|
||||
const opus_int32 c[], /* I Correlations [order+1] */
|
||||
opus_int32 order /* I Prediction order */
|
||||
);
|
||||
|
||||
/* Step up function, converts reflection coefficients to prediction coefficients */
|
||||
void silk_k2a(
|
||||
opus_int32 *A_Q24, /* O: Prediction coefficients [order] Q24 */
|
||||
const opus_int16 *rc_Q15, /* I: Reflection coefficients [order] Q15 */
|
||||
const opus_int32 order /* I: Prediction order */
|
||||
opus_int32 *A_Q24, /* O Prediction coefficients [order] Q24 */
|
||||
const opus_int16 *rc_Q15, /* I Reflection coefficients [order] Q15 */
|
||||
const opus_int32 order /* I Prediction order */
|
||||
);
|
||||
|
||||
/* Step up function, converts reflection coefficients to prediction coefficients */
|
||||
void silk_k2a_Q16(
|
||||
opus_int32 *A_Q24, /* O: Prediction coefficients [order] Q24 */
|
||||
const opus_int32 *rc_Q16, /* I: Reflection coefficients [order] Q16 */
|
||||
const opus_int32 order /* I: Prediction order */
|
||||
opus_int32 *A_Q24, /* O Prediction coefficients [order] Q24 */
|
||||
const opus_int32 *rc_Q16, /* I Reflection coefficients [order] Q16 */
|
||||
const opus_int32 order /* I Prediction order */
|
||||
);
|
||||
|
||||
/* Apply sine window to signal vector. */
|
||||
|
@ -231,11 +237,6 @@ void silk_autocorr(
|
|||
const opus_int correlationCount /* I Number of correlation taps to compute */
|
||||
);
|
||||
|
||||
/* Pitch estimator */
|
||||
#define SILK_PE_MIN_COMPLEX 0
|
||||
#define SILK_PE_MID_COMPLEX 1
|
||||
#define SILK_PE_MAX_COMPLEX 2
|
||||
|
||||
void silk_decode_pitch(
|
||||
opus_int16 lagIndex, /* I */
|
||||
opus_int8 contourIndex, /* O */
|
||||
|
@ -245,7 +246,7 @@ void silk_decode_pitch(
|
|||
);
|
||||
|
||||
opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 unvoiced */
|
||||
const opus_int16 *signal, /* I Signal of length PE_FRAME_LENGTH_MS*Fs_kHz */
|
||||
const opus_int16 *frame, /* I Signal of length PE_FRAME_LENGTH_MS*Fs_kHz */
|
||||
opus_int *pitch_out, /* O 4 pitch lag values */
|
||||
opus_int16 *lagIndex, /* O Lag Index */
|
||||
opus_int8 *contourIndex, /* O Pitch contour Index */
|
||||
|
@ -261,7 +262,7 @@ opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1
|
|||
/* 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_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) */
|
||||
);
|
||||
|
@ -275,69 +276,69 @@ void silk_NLSF2A(
|
|||
|
||||
void silk_insertion_sort_increasing(
|
||||
opus_int32 *a, /* I/O Unsorted / Sorted vector */
|
||||
opus_int *idx, /* O: Index vector for the sorted elements */
|
||||
const opus_int L, /* I: Vector length */
|
||||
const opus_int K /* I: Number of correctly sorted positions */
|
||||
opus_int *idx, /* O Index vector for the sorted elements */
|
||||
const opus_int L, /* I Vector length */
|
||||
const opus_int K /* I Number of correctly sorted positions */
|
||||
);
|
||||
|
||||
void silk_insertion_sort_decreasing_int16(
|
||||
opus_int16 *a, /* I/O: Unsorted / Sorted vector */
|
||||
opus_int *idx, /* O: Index vector for the sorted elements */
|
||||
const opus_int L, /* I: Vector length */
|
||||
const opus_int K /* I: Number of correctly sorted positions */
|
||||
opus_int16 *a, /* I/O Unsorted / Sorted vector */
|
||||
opus_int *idx, /* O Index vector for the sorted elements */
|
||||
const opus_int L, /* I Vector length */
|
||||
const opus_int K /* I Number of correctly sorted positions */
|
||||
);
|
||||
|
||||
void silk_insertion_sort_increasing_all_values_int16(
|
||||
opus_int16 *a, /* I/O: Unsorted / Sorted vector */
|
||||
const opus_int L /* I: Vector length */
|
||||
opus_int16 *a, /* I/O Unsorted / Sorted vector */
|
||||
const opus_int L /* I Vector length */
|
||||
);
|
||||
|
||||
/* NLSF stabilizer, for a single input data vector */
|
||||
void silk_NLSF_stabilize(
|
||||
opus_int16 *NLSF_Q15, /* I/O: Unstable/stabilized normalized LSF vector in Q15 [L] */
|
||||
const opus_int16 *NDeltaMin_Q15, /* I: Normalized delta min vector in Q15, NDeltaMin_Q15[L] must be >= 1 [L+1] */
|
||||
const opus_int L /* I: Number of NLSF parameters in the input vector */
|
||||
opus_int16 *NLSF_Q15, /* I/O Unstable/stabilized normalized LSF vector in Q15 [L] */
|
||||
const opus_int16 *NDeltaMin_Q15, /* I Min distance vector, NDeltaMin_Q15[L] must be >= 1 [L+1] */
|
||||
const opus_int L /* I Number of NLSF parameters in the input vector */
|
||||
);
|
||||
|
||||
/* Laroia low complexity NLSF weights */
|
||||
void silk_NLSF_VQ_weights_laroia(
|
||||
opus_int16 *pNLSFW_Q_OUT, /* O: Pointer to input vector weights [D x 1] */
|
||||
const opus_int16 *pNLSF_Q15, /* I: Pointer to input vector [D x 1] */
|
||||
const opus_int D /* I: Input vector dimension (even) */
|
||||
opus_int16 *pNLSFW_Q_OUT, /* O Pointer to input vector weights [D] */
|
||||
const opus_int16 *pNLSF_Q15, /* I Pointer to input vector [D] */
|
||||
const opus_int D /* I Input vector dimension (even) */
|
||||
);
|
||||
|
||||
/* Compute reflection coefficients from input signal */
|
||||
void silk_burg_modified(
|
||||
opus_int32 *res_nrg, /* O residual energy */
|
||||
opus_int *res_nrgQ, /* O residual energy Q value */
|
||||
opus_int32 A_Q16[], /* O prediction coefficients (length order) */
|
||||
const opus_int16 x[], /* I input signal, length: nb_subfr * ( D + subfr_length ) */
|
||||
const opus_int subfr_length, /* I input signal subframe length (including D preceeding samples) */
|
||||
const opus_int nb_subfr, /* I number of subframes stacked in x */
|
||||
const opus_int32 WhiteNoiseFrac_Q32, /* I fraction added to zero-lag autocorrelation */
|
||||
const opus_int D /* I order */
|
||||
opus_int32 *res_nrg, /* O Residual energy */
|
||||
opus_int *res_nrg_Q, /* O Residual energy Q value */
|
||||
opus_int32 A_Q16[], /* O Prediction coefficients (length order) */
|
||||
const opus_int16 x[], /* I Input signal, length: nb_subfr * ( D + subfr_length ) */
|
||||
const opus_int subfr_length, /* I Input signal subframe length (incl. D preceeding samples) */
|
||||
const opus_int nb_subfr, /* I Number of subframes stacked in x */
|
||||
const opus_int32 WhiteNoiseFrac_Q32, /* I Fraction added to zero-lag autocorrelation */
|
||||
const opus_int D /* I Order */
|
||||
);
|
||||
|
||||
/* Copy and multiply a vector by a constant */
|
||||
void silk_scale_copy_vector16(
|
||||
opus_int16 *data_out,
|
||||
const opus_int16 *data_in,
|
||||
opus_int32 gain_Q16, /* I: gain in Q16 */
|
||||
const opus_int dataSize /* I: length */
|
||||
opus_int32 gain_Q16, /* I Gain in Q16 */
|
||||
const opus_int dataSize /* I Length */
|
||||
);
|
||||
|
||||
/* Some for the LTP related function requires Q26 to work.*/
|
||||
void silk_scale_vector32_Q26_lshift_18(
|
||||
opus_int32 *data1, /* I/O: Q0/Q18 */
|
||||
opus_int32 gain_Q26, /* I: Q26 */
|
||||
opus_int dataSize /* I: length */
|
||||
opus_int32 *data1, /* I/O Q0/Q18 */
|
||||
opus_int32 gain_Q26, /* I Q26 */
|
||||
opus_int dataSize /* I length */
|
||||
);
|
||||
|
||||
/********************************************************************/
|
||||
/* INLINE ARM MATH */
|
||||
/********************************************************************/
|
||||
|
||||
/* return sum(inVec1[i]*inVec2[i]) */
|
||||
/* return sum( inVec1[i] * inVec2[i] ) */
|
||||
opus_int32 silk_inner_prod_aligned(
|
||||
const opus_int16 *const inVec1, /* I input vector 1 */
|
||||
const opus_int16 *const inVec2, /* I input vector 2 */
|
||||
|
@ -370,12 +371,13 @@ static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot )
|
|||
opus_uint32 x = (opus_uint32) a32;
|
||||
opus_uint32 r = (opus_uint32) rot;
|
||||
opus_uint32 m = (opus_uint32) -rot;
|
||||
if (rot==0)
|
||||
if( rot == 0 ) {
|
||||
return a32;
|
||||
else if(rot < 0)
|
||||
} else if( rot < 0 ) {
|
||||
return (opus_int32) ((x << m) | (x >> (32 - m)));
|
||||
else
|
||||
} else {
|
||||
return (opus_int32) ((x << (32 - r)) | (x >> r));
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate opus_int16 alligned to 4-byte memory address */
|
||||
|
@ -389,7 +391,8 @@ static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot )
|
|||
#define silk_memcpy(a, b, c) memcpy((a), (b), (c)) /* Dest, Src, ByteCount */
|
||||
#define silk_memset(a, b, c) memset((a), (b), (c)) /* Dest, value, ByteCount */
|
||||
#define silk_memmove(a, b, c) memmove((a), (b), (c)) /* Dest, Src, ByteCount */
|
||||
/* fixed point macros */
|
||||
|
||||
/* Fixed point macros */
|
||||
|
||||
/* (a32 * b32) output have to be 32bit int */
|
||||
#define silk_MUL(a32, b32) ((a32) * (b32))
|
||||
|
@ -421,14 +424,9 @@ static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot )
|
|||
(just standard two's complement implementation-specific behaviour) */
|
||||
#define silk_SUB32_ovflw(a, b) ((opus_int32)((opus_uint32)(a) - (opus_uint32)(b)))
|
||||
|
||||
/* a32 + (opus_int32)((opus_int16)(b32)) * (opus_int32)((opus_int16)(c32)) output have to be 32bit int */
|
||||
#define silk_SMLABB_ovflw(a32, b32, c32) (silk_ADD32_ovflw((a32) , ((opus_int32)((opus_int16)(b32))) * (opus_int32)((opus_int16)(c32))))
|
||||
|
||||
/* Multiply-accumulate macros that allow overflow in the addition (ie, no asserts in debug mode)*/
|
||||
/* Multiply-accumulate macros that allow overflow in the addition (ie, no asserts in debug mode) */
|
||||
#define silk_MLA_ovflw(a32, b32, c32) silk_ADD32_ovflw((a32), (opus_uint32)(b32) * (opus_uint32)(c32))
|
||||
#ifndef silk_SMLABB_ovflw
|
||||
# define silk_SMLABB_ovflw(a32, b32, c32) silk_ADD32_ovflw((a32), (opus_int32)((opus_int16)(b32)) * (opus_int32)((opus_int16)(c32)))
|
||||
#endif
|
||||
#define silk_SMLABB_ovflw(a32, b32, c32) (silk_ADD32_ovflw((a32) , ((opus_int32)((opus_int16)(b32))) * (opus_int32)((opus_int16)(c32))))
|
||||
|
||||
#define silk_DIV32_16(a32, b16) ((opus_int32)((a32) / (b16)))
|
||||
#define silk_DIV32(a32, b32) ((opus_int32)((a32) / (b32)))
|
||||
|
@ -490,9 +488,9 @@ static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot )
|
|||
#define silk_LSHIFT_SAT32(a, shift) (silk_LSHIFT32( silk_LIMIT( (a), silk_RSHIFT32( silk_int32_MIN, (shift) ), \
|
||||
silk_RSHIFT32( silk_int32_MAX, (shift) ) ), (shift) ))
|
||||
|
||||
#define silk_LSHIFT_ovflw(a, shift) ((opus_int32)((opus_uint32)(a)<<(shift))) /* shift >= 0, allowed to overflow */
|
||||
#define silk_LSHIFT_uint(a, shift) ((a)<<(shift)) /* shift >= 0 */
|
||||
#define silk_RSHIFT_uint(a, shift) ((a)>>(shift)) /* shift >= 0 */
|
||||
#define silk_LSHIFT_ovflw(a, shift) ((opus_int32)((opus_uint32)(a) << (shift))) /* shift >= 0, allowed to overflow */
|
||||
#define silk_LSHIFT_uint(a, shift) ((a) << (shift)) /* shift >= 0 */
|
||||
#define silk_RSHIFT_uint(a, shift) ((a) >> (shift)) /* shift >= 0 */
|
||||
|
||||
#define silk_ADD_LSHIFT(a, b, shift) ((a) + silk_LSHIFT((b), (shift))) /* shift >= 0 */
|
||||
#define silk_ADD_LSHIFT32(a, b, shift) silk_ADD32((a), silk_LSHIFT32((b), (shift))) /* shift >= 0 */
|
||||
|
@ -561,8 +559,6 @@ static inline opus_int64 silk_max_64(opus_int64 a, opus_int64 b)
|
|||
#define silk_LIMIT_16 silk_LIMIT
|
||||
#define silk_LIMIT_32 silk_LIMIT
|
||||
|
||||
/*#define silk_non_neg(a) ((a) & ((-(a)) >> (8 * sizeof(a) - 1)))*/ /* doesn't seem faster than silk_max(0, a);*/
|
||||
|
||||
#define silk_abs(a) (((a) > 0) ? (a) : -(a)) /* Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN */
|
||||
#define silk_abs_int(a) (((a) ^ ((a) >> (8 * sizeof(a) - 1))) - ((a) >> (8 * sizeof(a) - 1)))
|
||||
#define silk_abs_int32(a) (((a) ^ ((a) >> 31)) - ((a) >> 31))
|
||||
|
|
|
@ -34,12 +34,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
/* Entropy constrained matrix-weighted VQ, hard-coded to 5-element vectors, for a single input data vector */
|
||||
void silk_VQ_WMat_EC(
|
||||
opus_int8 *ind, /* O index of best codebook vector */
|
||||
opus_int32 *rate_dist_Q14, /* O best weighted quantization error + mu * rate*/
|
||||
opus_int32 *rate_dist_Q14, /* O best weighted quant error + mu * rate */
|
||||
const opus_int16 *in_Q14, /* I input vector to be quantized */
|
||||
const opus_int32 *W_Q18, /* I weighting matrix */
|
||||
const opus_int8 *cb_Q7, /* I codebook */
|
||||
const opus_uint8 *cl_Q5, /* I code length for each codebook vector */
|
||||
const opus_int mu_Q9, /* I tradeoff between weighted error and rate */
|
||||
const opus_int mu_Q9, /* I tradeoff betw. weighted error and rate */
|
||||
opus_int L /* I number of vectors in codebook */
|
||||
)
|
||||
{
|
||||
|
|
|
@ -37,11 +37,11 @@ static opus_int16 A_fb1_21 = -24290; /* (opus_int16)(20623 << 1) */
|
|||
|
||||
/* Split signal into two decimated bands using first-order allpass filters */
|
||||
void silk_ana_filt_bank_1(
|
||||
const opus_int16 *in, /* I: Input signal [N] */
|
||||
opus_int32 *S, /* I/O: State vector [2] */
|
||||
opus_int16 *outL, /* O: Low band [N/2] */
|
||||
opus_int16 *outH, /* O: High band [N/2] */
|
||||
const opus_int32 N /* I: Number of input samples */
|
||||
const opus_int16 *in, /* I Input signal [N] */
|
||||
opus_int32 *S, /* I/O State vector [2] */
|
||||
opus_int16 *outL, /* O Low band [N/2] */
|
||||
opus_int16 *outH, /* O High band [N/2] */
|
||||
const opus_int32 N /* I Number of input samples */
|
||||
)
|
||||
{
|
||||
opus_int k, N2 = silk_RSHIFT( N, 1 );
|
||||
|
|
|
@ -38,16 +38,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "SigProc_FIX.h"
|
||||
|
||||
|
||||
/* Second order ARMA filter, alternative implementation */
|
||||
void silk_biquad_alt(
|
||||
const opus_int16 *in, /* I: Input signal */
|
||||
const opus_int32 *B_Q28, /* I: MA coefficients [3] */
|
||||
const opus_int32 *A_Q28, /* I: AR coefficients [2] */
|
||||
opus_int32 *S, /* I/O: State vector [2] */
|
||||
opus_int16 *out, /* O: Output signal */
|
||||
const opus_int32 len, /* I: Signal length (must be even) */
|
||||
opus_int stride /* I: Operate on interleaved signal if > 1 */
|
||||
const opus_int16 *in, /* I input signal */
|
||||
const opus_int32 *B_Q28, /* I MA coefficients [3] */
|
||||
const opus_int32 *A_Q28, /* I AR coefficients [2] */
|
||||
opus_int32 *S, /* I/O State vector [2] */
|
||||
opus_int16 *out, /* O output signal */
|
||||
const opus_int32 len, /* I signal length (must be even) */
|
||||
opus_int stride /* I Operate on interleaved signal if > 1 */
|
||||
)
|
||||
{
|
||||
/* DIRECT FORM II TRANSPOSED (uses 2 element state vector) */
|
||||
|
|
|
@ -35,7 +35,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* Check encoder control struct */
|
||||
opus_int check_control_input(
|
||||
silk_EncControlStruct *encControl /* I: Control structure */
|
||||
silk_EncControlStruct *encControl /* I Control structure */
|
||||
)
|
||||
{
|
||||
silk_assert( encControl != NULL );
|
||||
|
|
|
@ -35,7 +35,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
/* Control internal sampling rate */
|
||||
opus_int silk_control_audio_bandwidth(
|
||||
silk_encoder_state *psEncC, /* I/O Pointer to Silk encoder state */
|
||||
silk_EncControlStruct *encControl /* I: Control structure */
|
||||
silk_EncControlStruct *encControl /* I Control structure */
|
||||
)
|
||||
{
|
||||
opus_int fs_kHz;
|
||||
|
@ -71,7 +71,7 @@ opus_int silk_control_audio_bandwidth(
|
|||
/* Reset transition filter state */
|
||||
silk_memset( psEncC->sLP.In_LP_State, 0, sizeof( psEncC->sLP.In_LP_State ) );
|
||||
}
|
||||
if (encControl->opusCanSwitch) {
|
||||
if( encControl->opusCanSwitch ) {
|
||||
/* Stop transition phase */
|
||||
psEncC->sLP.mode = 0;
|
||||
|
||||
|
@ -91,7 +91,7 @@ opus_int silk_control_audio_bandwidth(
|
|||
if( silk_SMULBB( psEncC->fs_kHz, 1000 ) < psEncC->desiredInternal_fs_Hz )
|
||||
{
|
||||
/* Switch up */
|
||||
if (encControl->opusCanSwitch) {
|
||||
if( encControl->opusCanSwitch ) {
|
||||
/* Switch to a higher sample frequency */
|
||||
fs_kHz = psEncC->fs_kHz == 8 ? 12 : 16;
|
||||
|
||||
|
@ -115,9 +115,5 @@ opus_int silk_control_audio_bandwidth(
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef FORCE_INTERNAL_FS_KHZ
|
||||
fs_kHz = FORCE_INTERNAL_FS_KHZ;
|
||||
#endif
|
||||
|
||||
return fs_kHz;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#define silk_encoder_state_Fxx silk_encoder_state_FLP
|
||||
#endif
|
||||
#include "tuning_parameters.h"
|
||||
|
||||
#include "pitch_est_defines.h"
|
||||
|
||||
static const opus_int enc_delay_matrix[3][5] = {
|
||||
/*SILK API 8 12 16 24 48 */
|
||||
|
@ -70,7 +70,7 @@ static inline opus_int silk_setup_LBRR(
|
|||
/* Control encoder */
|
||||
opus_int silk_control_encoder(
|
||||
silk_encoder_state_Fxx *psEnc, /* I/O Pointer to Silk encoder state */
|
||||
silk_EncControlStruct *encControl, /* I: Control structure */
|
||||
silk_EncControlStruct *encControl, /* I Control structure */
|
||||
const opus_int32 TargetRate_bps, /* I Target max bitrate (bps) */
|
||||
const opus_int allow_bw_switch, /* I Flag to allow switching audio bandwidth */
|
||||
const opus_int channelNb, /* I Channel number */
|
||||
|
@ -105,8 +105,9 @@ opus_int silk_control_encoder(
|
|||
/* Determine internal sampling rate */
|
||||
/********************************************/
|
||||
fs_kHz = silk_control_audio_bandwidth( &psEnc->sCmn, encControl );
|
||||
if (force_fs_kHz)
|
||||
if( force_fs_kHz ) {
|
||||
fs_kHz = force_fs_kHz;
|
||||
}
|
||||
/********************************************/
|
||||
/* Prepare resampler and buffered data */
|
||||
/********************************************/
|
||||
|
|
|
@ -31,7 +31,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "main.h"
|
||||
|
||||
|
||||
/************************/
|
||||
/* Init Decoder State */
|
||||
/************************/
|
||||
|
|
|
@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
unsigned long silk_GetHighResolutionTime(void) /* O: time in usec*/
|
||||
unsigned long silk_GetHighResolutionTime(void) /* O time in usec*/
|
||||
{
|
||||
/* Returns a time counter in microsec */
|
||||
/* the resolution is platform dependent */
|
||||
|
@ -54,7 +54,7 @@ unsigned long silk_GetHighResolutionTime(void) /* O: time in usec*/
|
|||
return (unsigned long)((1000000*(lpPerformanceCount.QuadPart)) / lpFrequency.QuadPart);
|
||||
}
|
||||
#else /* Linux or Mac*/
|
||||
unsigned long GetHighResolutionTime(void) /* O: time in usec*/
|
||||
unsigned long GetHighResolutionTime(void) /* O time in usec*/
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, 0);
|
||||
|
|
28
silk/debug.h
28
silk/debug.h
|
@ -41,7 +41,7 @@ extern "C"
|
|||
{
|
||||
#endif
|
||||
|
||||
unsigned long GetHighResolutionTime(void); /* O: time in usec*/
|
||||
unsigned long GetHighResolutionTime(void); /* O time in usec*/
|
||||
|
||||
/* make SILK_DEBUG dependent on compiler's _DEBUG */
|
||||
#if defined _WIN32
|
||||
|
@ -64,6 +64,7 @@ unsigned long GetHighResolutionTime(void); /* O: time in usec*/
|
|||
/* Flag for using timers */
|
||||
#define SILK_TIC_TOC 0
|
||||
|
||||
|
||||
#if SILK_TIC_TOC
|
||||
|
||||
#if (defined(_WIN32) || defined(_WINCE))
|
||||
|
@ -238,35 +239,12 @@ extern opus_int64 silk_Timer_depth[silk_NUM_TIMERS_MAX];
|
|||
#endif /* SILK_TIC_TOC */
|
||||
|
||||
|
||||
|
||||
#if SILK_DEBUG
|
||||
/************************************/
|
||||
/* write data to file for debugging */
|
||||
/************************************/
|
||||
/* opens an empty file if this file has not yet been open, then writes to the file and closes it */
|
||||
/* if file has been open previously it is opened again and the fwrite is appending, finally it is closed */
|
||||
#define SAVE_DATA( FILE_NAME, DATA_PTR, N_BYTES ) { \
|
||||
static opus_int32 init = 0; \
|
||||
FILE *fp; \
|
||||
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); \
|
||||
}
|
||||
|
||||
/* Example: DEBUG_STORE_DATA(testfile.pcm, &RIN[0], 160*sizeof(opus_int16)); */
|
||||
|
||||
#if 0
|
||||
/* Ensure that everything is written to files when an assert breaks */
|
||||
#define DEBUG_STORE_DATA(FILE_NAME, DATA_PTR, N_BYTES) SAVE_DATA(FILE_NAME, DATA_PTR, N_BYTES)
|
||||
#define SILK_DEBUG_STORE_CLOSE_FILES
|
||||
|
||||
#else
|
||||
|
||||
#define silk_NUM_STORES_MAX 100
|
||||
extern FILE *silk_debug_store_fp[ silk_NUM_STORES_MAX ];
|
||||
extern int silk_debug_store_count;
|
||||
|
@ -290,7 +268,6 @@ extern int silk_debug_store_count;
|
|||
fclose( silk_debug_store_fp[ i ] ); \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
/* micro sec */
|
||||
#define silk_GETTIME(void) time = (opus_int64) silk_GetHighResolutionTime();
|
||||
|
@ -299,7 +276,6 @@ extern int silk_debug_store_count;
|
|||
|
||||
/* define macros as empty strings */
|
||||
#define DEBUG_STORE_DATA(FILE_NAME, DATA_PTR, N_BYTES)
|
||||
#define SAVE_DATA(FILE_NAME, DATA_PTR, N_BYTES)
|
||||
#define SILK_DEBUG_STORE_CLOSE_FILES
|
||||
|
||||
#endif /* SILK_DEBUG */
|
||||
|
|
|
@ -46,7 +46,9 @@ typedef struct {
|
|||
/* Decoder functions */
|
||||
/*********************/
|
||||
|
||||
opus_int silk_Get_Decoder_Size( int *decSizeBytes )
|
||||
opus_int silk_Get_Decoder_Size( /* O Returns error code */
|
||||
opus_int *decSizeBytes /* O Number of bytes in SILK decoder state */
|
||||
)
|
||||
{
|
||||
opus_int ret = SILK_NO_ERROR;
|
||||
|
||||
|
@ -56,8 +58,8 @@ opus_int silk_Get_Decoder_Size( int *decSizeBytes )
|
|||
}
|
||||
|
||||
/* Reset decoder state */
|
||||
opus_int silk_InitDecoder(
|
||||
void* decState /* I/O: State */
|
||||
opus_int silk_InitDecoder( /* O Returns error code */
|
||||
void *decState /* I/O State */
|
||||
)
|
||||
{
|
||||
opus_int n, ret = SILK_NO_ERROR;
|
||||
|
@ -71,14 +73,14 @@ opus_int silk_InitDecoder(
|
|||
}
|
||||
|
||||
/* Decode a frame */
|
||||
opus_int silk_Decode(
|
||||
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 */
|
||||
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_int16 *samplesOut, /* O Decoded output speech vector */
|
||||
opus_int32 *nSamplesOut /* O Number of samples decoded */
|
||||
)
|
||||
{
|
||||
opus_int i, n, delay, decode_only_middle = 0, ret = SILK_NO_ERROR;
|
||||
|
@ -237,7 +239,7 @@ opus_int silk_Decode(
|
|||
psDec->channel_state[ 1 ].first_frame_after_reset = 1;
|
||||
}
|
||||
|
||||
if (lostFlag == FLAG_DECODE_NORMAL) {
|
||||
if( lostFlag == FLAG_DECODE_NORMAL ) {
|
||||
has_side = !decode_only_middle;
|
||||
} else {
|
||||
has_side = !psDec->prev_decode_only_middle
|
||||
|
@ -318,7 +320,7 @@ opus_int silk_Decode(
|
|||
decControl->prevPitchLag = 0;
|
||||
}
|
||||
|
||||
if ( lostFlag != FLAG_PACKET_LOST ) {
|
||||
if( lostFlag != FLAG_PACKET_LOST ) {
|
||||
psDec->prev_decode_only_middle = decode_only_middle;
|
||||
}
|
||||
return ret;
|
||||
|
@ -327,9 +329,9 @@ opus_int silk_Decode(
|
|||
/* Getting 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_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 */
|
||||
)
|
||||
{
|
||||
opus_int i, flags, ret = SILK_NO_ERROR;
|
||||
|
|
|
@ -77,10 +77,6 @@ void silk_decode_core(
|
|||
rand_seed = silk_ADD32_ovflw(rand_seed, pulses[ i ]);
|
||||
}
|
||||
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
DEBUG_STORE_DATA( dec_q.dat, pulses, psDec->frame_length * sizeof( opus_int ) );
|
||||
#endif
|
||||
|
||||
/* Copy LPC state */
|
||||
silk_memcpy( sLPC_Q14, psDec->sLPC_Q14_buf, MAX_LPC_ORDER * sizeof( opus_int32 ) );
|
||||
|
||||
|
@ -187,11 +183,6 @@ void silk_decode_core(
|
|||
pres_Q10 = pexc_Q10;
|
||||
}
|
||||
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
DEBUG_STORE_DATA( dec_exc_Q10.dat, pexc_Q10, psDec->subfr_length * sizeof( opus_int32 ) );
|
||||
DEBUG_STORE_DATA( dec_res_Q10.dat, pres_Q10, psDec->subfr_length * sizeof( opus_int32 ) );
|
||||
#endif
|
||||
|
||||
for( i = 0; i < psDec->subfr_length; i++ ) {
|
||||
/* Partially unrolled */
|
||||
LPC_pred_Q10 = silk_SMULWB( sLPC_Q14[ MAX_LPC_ORDER + i - 1 ], A_Q12_tmp[ 0 ] );
|
||||
|
@ -223,9 +214,4 @@ void silk_decode_core(
|
|||
|
||||
/* Save LPC state */
|
||||
silk_memcpy( psDec->sLPC_Q14_buf, sLPC_Q14, MAX_LPC_ORDER * sizeof( opus_int32 ) );
|
||||
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
DEBUG_STORE_DATA( dec_sLTP_Q16.dat, &sLTP_Q16[ psDec->ltp_mem_length ], psDec->frame_length * sizeof( opus_int32 ));
|
||||
DEBUG_STORE_DATA( dec_xq.dat, xq, psDec->frame_length * sizeof( opus_int16 ) );
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -48,8 +48,6 @@ opus_int silk_decode_frame(
|
|||
opus_int L, mv_len, ret = 0;
|
||||
opus_int pulses[ MAX_FRAME_LENGTH ];
|
||||
|
||||
TIC(DECODE_FRAME)
|
||||
|
||||
L = psDec->frame_length;
|
||||
sDecCtrl.LTP_scale_Q14 = 0;
|
||||
|
||||
|
@ -62,24 +60,18 @@ TIC(DECODE_FRAME)
|
|||
/*********************************************/
|
||||
/* Decode quantization indices of side info */
|
||||
/*********************************************/
|
||||
TIC(decode_indices)
|
||||
silk_decode_indices( psDec, psRangeDec, psDec->nFramesDecoded, lostFlag, condCoding );
|
||||
TOC(decode_indices)
|
||||
|
||||
/*********************************************/
|
||||
/* Decode quantization indices of excitation */
|
||||
/*********************************************/
|
||||
TIC(decode_pulses)
|
||||
silk_decode_pulses( psRangeDec, pulses, psDec->indices.signalType,
|
||||
psDec->indices.quantOffsetType, psDec->frame_length );
|
||||
TOC(decode_pulses)
|
||||
|
||||
/********************************************/
|
||||
/* Decode parameters and pulse signal */
|
||||
/********************************************/
|
||||
TIC(decode_params)
|
||||
silk_decode_parameters( psDec, &sDecCtrl, condCoding );
|
||||
TOC(decode_params)
|
||||
|
||||
/* Update length. Sampling frequency may have changed */
|
||||
L = psDec->frame_length;
|
||||
|
@ -87,9 +79,7 @@ TOC(decode_params)
|
|||
/********************************************************/
|
||||
/* Run inverse NSQ */
|
||||
/********************************************************/
|
||||
TIC(decode_core)
|
||||
silk_decode_core( psDec, &sDecCtrl, pOut, pulses );
|
||||
TOC(decode_core)
|
||||
|
||||
/********************************************************/
|
||||
/* Update PLC state */
|
||||
|
@ -131,7 +121,5 @@ TOC(decode_core)
|
|||
/* Set output frame length */
|
||||
*pN = L;
|
||||
|
||||
TOC(DECODE_FRAME)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
void silk_decode_pitch(
|
||||
opus_int16 lagIndex, /* I */
|
||||
opus_int8 contourIndex, /* O */
|
||||
opus_int pitch_lags[], /* O pitch values */
|
||||
opus_int pitch_lags[], /* O 4 pitch values */
|
||||
const opus_int Fs_kHz, /* I sampling frequency (kHz) */
|
||||
const opus_int nb_subfr /* I number of sub frames */
|
||||
)
|
||||
|
|
|
@ -55,7 +55,7 @@ void silk_decode_pulses(
|
|||
/* Calculate number of shell blocks */
|
||||
silk_assert( 1 << LOG2_SHELL_CODEC_FRAME_LENGTH == SHELL_CODEC_FRAME_LENGTH );
|
||||
iter = silk_RSHIFT( frame_length, LOG2_SHELL_CODEC_FRAME_LENGTH );
|
||||
if( iter * SHELL_CODEC_FRAME_LENGTH < frame_length ){
|
||||
if( iter * SHELL_CODEC_FRAME_LENGTH < frame_length ) {
|
||||
silk_assert( frame_length == 12 * 10 ); /* Make sure only happens for 10 ms @ 12 kHz */
|
||||
iter++;
|
||||
}
|
||||
|
@ -73,7 +73,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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ extern "C"
|
|||
#define NB_SPEECH_FRAMES_BEFORE_DTX 10 /* eq 200 ms */
|
||||
#define MAX_CONSECUTIVE_DTX 20 /* eq 400 ms */
|
||||
|
||||
/* Maximum sampling frequency, should be 16 for embedded */
|
||||
/* Maximum sampling frequency */
|
||||
#define MAX_FS_KHZ 16
|
||||
#define MAX_API_FS_KHZ 48
|
||||
|
||||
|
|
|
@ -44,7 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
/* Encoder functions */
|
||||
/****************************************/
|
||||
|
||||
opus_int silk_Get_Encoder_Size( opus_int *encSizeBytes )
|
||||
opus_int silk_Get_Encoder_Size( /* O Returns error code */
|
||||
opus_int *encSizeBytes /* O Number of bytes in SILK encoder state */
|
||||
)
|
||||
{
|
||||
opus_int ret = SILK_NO_ERROR;
|
||||
|
||||
|
@ -56,9 +58,9 @@ opus_int silk_Get_Encoder_Size( opus_int *encSizeBytes )
|
|||
/*************************/
|
||||
/* Init or Reset encoder */
|
||||
/*************************/
|
||||
opus_int silk_InitEncoder(
|
||||
void *encState, /* I/O: State */
|
||||
silk_EncControlStruct *encStatus /* O: Control structure */
|
||||
opus_int silk_InitEncoder( /* O Returns error code */
|
||||
void *encState, /* I/O State */
|
||||
silk_EncControlStruct *encStatus /* O Encoder Status */
|
||||
)
|
||||
{
|
||||
silk_encoder *psEnc;
|
||||
|
@ -88,9 +90,9 @@ opus_int silk_InitEncoder(
|
|||
/***************************************/
|
||||
/* Read control structure from encoder */
|
||||
/***************************************/
|
||||
opus_int silk_QueryEncoder(
|
||||
const void *encState, /* I: State Vector */
|
||||
silk_EncControlStruct *encStatus /* O: Control Structure */
|
||||
opus_int silk_QueryEncoder( /* O Returns error code */
|
||||
const void *encState, /* I State */
|
||||
silk_EncControlStruct *encStatus /* O Encoder Status */
|
||||
)
|
||||
{
|
||||
opus_int ret = SILK_NO_ERROR;
|
||||
|
@ -123,14 +125,16 @@ opus_int silk_QueryEncoder(
|
|||
/**************************/
|
||||
/* Encode frame with Silk */
|
||||
/**************************/
|
||||
opus_int silk_Encode(
|
||||
void *encState, /* I/O: State */
|
||||
silk_EncControlStruct *encControl, /* I: Control structure */
|
||||
const opus_int16 *samplesIn, /* I: Speech sample input vector */
|
||||
opus_int nSamplesIn, /* I: Number of samples in input vector */
|
||||
/* 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 *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 n, i, nBits, flags, tmp_payloadSize_ms = 0, tmp_complexity = 0, ret = 0;
|
||||
|
@ -270,17 +274,18 @@ opus_int silk_Encode(
|
|||
buf[ n + delay ] = (opus_int16)silk_RSHIFT_ROUND( samplesIn[ 2 * n ] + samplesIn[ 2 * n + 1 ], 1 );
|
||||
}
|
||||
if(psEnc->nPrevChannelsInternal == 2 && psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded==0) {
|
||||
for ( n = 0; n<MAX_ENCODER_DELAY; n++ )
|
||||
for( n = 0; n<MAX_ENCODER_DELAY; n++ ) {
|
||||
psEnc->state_Fxx[ 0 ].sCmn.delayBuf[ n ] = silk_RSHIFT(psEnc->state_Fxx[ 0 ].sCmn.delayBuf[ n ]+(opus_int32)psEnc->state_Fxx[ 1 ].sCmn.delayBuf[ n ], 1);
|
||||
}
|
||||
}
|
||||
silk_memcpy(buf, &psEnc->state_Fxx[ 0 ].sCmn.delayBuf[ MAX_ENCODER_DELAY - delay ], delay * sizeof(opus_int16));
|
||||
ret += silk_resampler( &psEnc->state_Fxx[ 0 ].sCmn.resampler_state,
|
||||
&psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ psEnc->state_Fxx[ 0 ].sCmn.inputBufIx + 2 ], buf, nSamplesFromInput );
|
||||
/* On the first mono frame, average the results for the two resampler states */
|
||||
if (psEnc->nPrevChannelsInternal == 2 && psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded==0) {
|
||||
if( psEnc->nPrevChannelsInternal == 2 && psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded == 0 ) {
|
||||
ret += silk_resampler( &psEnc->state_Fxx[ 1 ].sCmn.resampler_state,
|
||||
&psEnc->state_Fxx[ 1 ].sCmn.inputBuf[ psEnc->state_Fxx[ 1 ].sCmn.inputBufIx + 2 ], buf, nSamplesFromInput );
|
||||
for ( n = 0; n < psEnc->state_Fxx[ 0 ].sCmn.frame_length; n++ ) {
|
||||
for( n = 0; n < psEnc->state_Fxx[ 0 ].sCmn.frame_length; n++ ) {
|
||||
psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ psEnc->state_Fxx[ 0 ].sCmn.inputBufIx+n+2 ] =
|
||||
silk_RSHIFT(psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ psEnc->state_Fxx[ 0 ].sCmn.inputBufIx+n+2 ]
|
||||
+ psEnc->state_Fxx[ 1 ].sCmn.inputBuf[ psEnc->state_Fxx[ 1 ].sCmn.inputBufIx+n+2 ], 1);
|
||||
|
@ -367,8 +372,9 @@ opus_int silk_Encode(
|
|||
/* Total target bits for packet */
|
||||
nBits = silk_DIV32_16( silk_MUL( encControl->bitRate, encControl->payloadSize_ms ), 1000 );
|
||||
/* Subtract half of the bits already used */
|
||||
if (!prefillFlag)
|
||||
if( !prefillFlag ) {
|
||||
nBits -= ec_tell( psRangeEnc ) >> 1;
|
||||
}
|
||||
/* Divide by number of uncoded frames left in packet */
|
||||
nBits = silk_DIV32_16( nBits, psEnc->state_Fxx[ 0 ].sCmn.nFramesPerPacket - psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded );
|
||||
/* Convert to bits/second */
|
||||
|
|
|
@ -45,10 +45,6 @@ void silk_encode_indices(
|
|||
opus_int16 ec_ix[ MAX_LPC_ORDER ];
|
||||
opus_uint8 pred_Q8[ MAX_LPC_ORDER ];
|
||||
const SideInfoIndices *psIndices;
|
||||
#if SAVE_ALL_INTERNAL_DATA
|
||||
opus_int nBytes_lagIndex, nBytes_contourIndex, nBytes_LTP;
|
||||
opus_int nBytes_after, nBytes_before;
|
||||
#endif
|
||||
|
||||
if( encode_LBRR ) {
|
||||
psIndices = &psEncC->indices_LBRR[ FrameIndex ];
|
||||
|
@ -71,9 +67,6 @@ void silk_encode_indices(
|
|||
/****************/
|
||||
/* Encode gains */
|
||||
/****************/
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
nBytes_before = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
|
||||
#endif
|
||||
/* first subframe */
|
||||
if( condCoding == CODE_CONDITIONALLY ) {
|
||||
/* conditional coding */
|
||||
|
@ -92,18 +85,9 @@ void silk_encode_indices(
|
|||
ec_enc_icdf( psRangeEnc, psIndices->GainsIndices[ i ], silk_delta_gain_iCDF, 8 );
|
||||
}
|
||||
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
nBytes_after = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
|
||||
nBytes_after -= nBytes_before; /* bytes just added*/
|
||||
DEBUG_STORE_DATA( nBytes_gains.dat, &nBytes_after, sizeof( opus_int ) );
|
||||
#endif
|
||||
|
||||
/****************/
|
||||
/* Encode NLSFs */
|
||||
/****************/
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
nBytes_before = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
|
||||
#endif
|
||||
ec_enc_icdf( psRangeEnc, psIndices->NLSFIndices[ 0 ], &psEncC->psNLSF_CB->CB1_iCDF[ ( psIndices->signalType >> 1 ) * psEncC->psNLSF_CB->nVectors ], 8 );
|
||||
silk_NLSF_unpack( ec_ix, pred_Q8, psEncC->psNLSF_CB, psIndices->NLSFIndices[ 0 ] );
|
||||
silk_assert( psEncC->psNLSF_CB->order == psEncC->predictLPCOrder );
|
||||
|
@ -125,21 +109,11 @@ void silk_encode_indices(
|
|||
ec_enc_icdf( psRangeEnc, psIndices->NLSFInterpCoef_Q2, silk_NLSF_interpolation_factor_iCDF, 8 );
|
||||
}
|
||||
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
DEBUG_STORE_DATA( lsf_interpol.dat, &psIndices->NLSFInterpCoef_Q2, sizeof(int) );
|
||||
nBytes_after = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
|
||||
nBytes_after -= nBytes_before; /* bytes just added*/
|
||||
DEBUG_STORE_DATA( nBytes_LSF.dat, &nBytes_after, sizeof( opus_int ) );
|
||||
#endif
|
||||
|
||||
if( psIndices->signalType == TYPE_VOICED )
|
||||
{
|
||||
/*********************/
|
||||
/* Encode pitch lags */
|
||||
/*********************/
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
nBytes_before = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
|
||||
#endif
|
||||
/* lag index */
|
||||
encode_absolute_lagIndex = 1;
|
||||
if( condCoding == CODE_CONDITIONALLY && psEncC->ec_prevSignalType == TYPE_VOICED ) {
|
||||
|
@ -166,14 +140,6 @@ void silk_encode_indices(
|
|||
}
|
||||
psEncC->ec_prevLagIndex = psIndices->lagIndex;
|
||||
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
nBytes_after = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
|
||||
nBytes_lagIndex = nBytes_after - nBytes_before; /* bytes just added*/
|
||||
#endif
|
||||
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
nBytes_before = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
|
||||
#endif
|
||||
/* Countour index */
|
||||
silk_assert( psIndices->contourIndex >= 0 );
|
||||
silk_assert( ( psIndices->contourIndex < 34 && psEncC->fs_kHz > 8 && psEncC->nb_subfr == 4 ) ||
|
||||
|
@ -181,18 +147,10 @@ void silk_encode_indices(
|
|||
( psIndices->contourIndex < 12 && psEncC->fs_kHz > 8 && psEncC->nb_subfr == 2 ) ||
|
||||
( psIndices->contourIndex < 3 && psEncC->fs_kHz == 8 && psEncC->nb_subfr == 2 ) );
|
||||
ec_enc_icdf( psRangeEnc, psIndices->contourIndex, psEncC->pitch_contour_iCDF, 8 );
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
nBytes_after = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
|
||||
nBytes_contourIndex = nBytes_after - nBytes_before; /* bytes just added*/
|
||||
#endif
|
||||
|
||||
/********************/
|
||||
/* Encode LTP gains */
|
||||
/********************/
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
nBytes_before = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
|
||||
#endif
|
||||
|
||||
/* PERIndex value */
|
||||
silk_assert( psIndices->PERIndex >= 0 && psIndices->PERIndex < 3 );
|
||||
ec_enc_icdf( psRangeEnc, psIndices->PERIndex, silk_LTP_per_index_iCDF, 8 );
|
||||
|
@ -211,30 +169,10 @@ void silk_encode_indices(
|
|||
ec_enc_icdf( psRangeEnc, psIndices->LTP_scaleIndex, silk_LTPscale_iCDF, 8 );
|
||||
}
|
||||
silk_assert( !condCoding || psIndices->LTP_scaleIndex == 0 );
|
||||
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
nBytes_after = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
|
||||
nBytes_LTP = nBytes_after - nBytes_before; /* bytes just added*/
|
||||
#endif
|
||||
}
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
else {
|
||||
/* Unvoiced speech*/
|
||||
nBytes_lagIndex = 0;
|
||||
nBytes_contourIndex = 0;
|
||||
nBytes_LTP = 0;
|
||||
}
|
||||
DEBUG_STORE_DATA( nBytes_lagIndex.dat, &nBytes_lagIndex, sizeof( opus_int ) );
|
||||
DEBUG_STORE_DATA( nBytes_contourIndex.dat, &nBytes_contourIndex, sizeof( opus_int ) );
|
||||
DEBUG_STORE_DATA( nBytes_LTP.dat, &nBytes_LTP, sizeof( opus_int ) );
|
||||
#endif
|
||||
|
||||
psEncC->ec_prevSignalType = psIndices->signalType;
|
||||
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
nBytes_before = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
|
||||
#endif
|
||||
|
||||
/***************/
|
||||
/* Encode seed */
|
||||
/***************/
|
||||
|
|
|
@ -58,7 +58,7 @@ static inline opus_int combine_and_check( /* return ok */
|
|||
/* Encode quantization indices of excitation */
|
||||
void silk_encode_pulses(
|
||||
ec_enc *psRangeEnc, /* I/O compressor data structure */
|
||||
const opus_int signalType, /* I Sigtype */
|
||||
const opus_int signalType, /* I Signal type */
|
||||
const opus_int quantOffsetType, /* I quantOffsetType */
|
||||
opus_int8 pulses[], /* I quantization indices */
|
||||
const opus_int frame_length /* I Frame length */
|
||||
|
@ -83,7 +83,7 @@ void silk_encode_pulses(
|
|||
/* Calculate number of shell blocks */
|
||||
silk_assert( 1 << LOG2_SHELL_CODEC_FRAME_LENGTH == SHELL_CODEC_FRAME_LENGTH );
|
||||
iter = silk_RSHIFT( frame_length, LOG2_SHELL_CODEC_FRAME_LENGTH );
|
||||
if( iter * SHELL_CODEC_FRAME_LENGTH < frame_length ){
|
||||
if( iter * SHELL_CODEC_FRAME_LENGTH < frame_length ) {
|
||||
silk_assert( frame_length == 12 * 10 ); /* Make sure only happens for 10 ms @ 12 kHz */
|
||||
iter++;
|
||||
silk_memset( &pulses[ frame_length ], 0, SHELL_CODEC_FRAME_LENGTH * sizeof(opus_int8));
|
||||
|
|
|
@ -32,14 +32,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "main_FIX.h"
|
||||
|
||||
void silk_LTP_analysis_filter_FIX(
|
||||
opus_int16 *LTP_res, /* O: LTP residual signal of length MAX_NB_SUBFR * ( pre_length + subfr_length ) */
|
||||
const opus_int16 *x, /* I: Pointer to input signal with at least max( pitchL ) preceeding samples */
|
||||
const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],/* I: LTP_ORDER LTP coefficients for each MAX_NB_SUBFR subframe */
|
||||
const opus_int pitchL[ MAX_NB_SUBFR ], /* I: Pitch lag, one for each subframe */
|
||||
const opus_int32 invGains_Q16[ MAX_NB_SUBFR ], /* I: Inverse quantization gains, one for each subframe */
|
||||
const opus_int subfr_length, /* I: Length of each subframe */
|
||||
const opus_int nb_subfr, /* I: Number of subframes */
|
||||
const opus_int pre_length /* I: Length of the preceeding samples starting at &x[0] for each subframe */
|
||||
opus_int16 *LTP_res, /* O LTP residual signal of length MAX_NB_SUBFR * ( pre_length + subfr_length ) */
|
||||
const opus_int16 *x, /* I Pointer to input signal with at least max( pitchL ) preceeding samples */
|
||||
const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],/* I LTP_ORDER LTP coefficients for each MAX_NB_SUBFR subframe */
|
||||
const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lag, one for each subframe */
|
||||
const opus_int32 invGains_Q16[ MAX_NB_SUBFR ], /* I Inverse quantization gains, one for each subframe */
|
||||
const opus_int subfr_length, /* I Length of each subframe */
|
||||
const opus_int nb_subfr, /* I Number of subframes */
|
||||
const opus_int pre_length /* I Length of the preceeding samples starting at &x[0] for each subframe */
|
||||
)
|
||||
{
|
||||
const opus_int16 *x_ptr, *x_lag_ptr;
|
||||
|
|
|
@ -31,9 +31,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "main_FIX.h"
|
||||
|
||||
/* Calculation of LTP state scaling */
|
||||
void silk_LTP_scale_ctrl_FIX(
|
||||
silk_encoder_state_FIX *psEnc, /* I/O encoder state FIX */
|
||||
silk_encoder_control_FIX *psEncCtrl, /* I/O encoder control FIX */
|
||||
silk_encoder_state_FIX *psEnc, /* I/O encoder state */
|
||||
silk_encoder_control_FIX *psEncCtrl, /* I/O encoder control */
|
||||
opus_int condCoding /* I The type of conditional coding to use */
|
||||
)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "SigProc_FIX.h"
|
||||
|
||||
#define MAX_FRAME_SIZE 384 /* subfr_length * nb_subfr = ( 0.005 * 16000 + 16 ) * 4 = 384*/
|
||||
#define MAX_FRAME_SIZE 384 /* subfr_length * nb_subfr = ( 0.005 * 16000 + 16 ) * 4 = 384 */
|
||||
#define MAX_NB_SUBFR 4
|
||||
|
||||
#define QA 25
|
||||
|
@ -41,14 +41,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* Compute reflection coefficients from input signal */
|
||||
void silk_burg_modified(
|
||||
opus_int32 *res_nrg, /* O residual energy */
|
||||
opus_int *res_nrg_Q, /* O residual energy Q value */
|
||||
opus_int32 A_Q16[], /* O prediction coefficients (length order) */
|
||||
const opus_int16 x[], /* I input signal, length: nb_subfr * ( D + subfr_length ) */
|
||||
const opus_int subfr_length, /* I input signal subframe length (including D preceeding samples) */
|
||||
const opus_int nb_subfr, /* I number of subframes stacked in x */
|
||||
const opus_int32 WhiteNoiseFrac_Q32, /* I fraction added to zero-lag autocorrelation */
|
||||
const opus_int D /* I order */
|
||||
opus_int32 *res_nrg, /* O Residual energy */
|
||||
opus_int *res_nrg_Q, /* O Residual energy Q value */
|
||||
opus_int32 A_Q16[], /* O Prediction coefficients (length order) */
|
||||
const opus_int16 x[], /* I Input signal, length: nb_subfr * ( D + subfr_length ) */
|
||||
const opus_int subfr_length, /* I Input signal subframe length (incl. D preceeding samples) */
|
||||
const opus_int nb_subfr, /* I Number of subframes stacked in x */
|
||||
const opus_int32 WhiteNoiseFrac_Q32, /* I Fraction added to zero-lag autocorrelation */
|
||||
const opus_int D /* I Order */
|
||||
)
|
||||
{
|
||||
opus_int k, n, s, lz, rshifts, rshifts_extra;
|
||||
|
@ -153,7 +153,7 @@ void silk_burg_modified(
|
|||
CAf[ k ] = silk_SMLAWW( CAf[ k ], tmp1,
|
||||
silk_LSHIFT32( (opus_int32)x_ptr[ n - k ], -rshifts - 1 ) ); /* Q( -rshift )*/
|
||||
CAb[ k ] = silk_SMLAWW( CAb[ k ], tmp2,
|
||||
silk_LSHIFT32( (opus_int32)x_ptr[ subfr_length - n + k - 1 ], -rshifts - 1 ) );/* Q( -rshift )*/
|
||||
silk_LSHIFT32( (opus_int32)x_ptr[ subfr_length - n + k - 1 ], -rshifts - 1 ) ); /* Q( -rshift )*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
/* Calculates correlation vector X'*t */
|
||||
void silk_corrVector_FIX(
|
||||
const opus_int16 *x, /* I x vector [L + order - 1] used to form data matrix X */
|
||||
const opus_int16 *t, /* I target vector [L] */
|
||||
const opus_int16 *t, /* I Target vector [L] */
|
||||
const opus_int L, /* I Length of vectors */
|
||||
const opus_int order, /* I Max lag for correlation */
|
||||
opus_int32 *Xt, /* O Pointer to X'*t correlation vector [order] */
|
||||
|
@ -77,7 +77,7 @@ void silk_corrMatrix_FIX(
|
|||
const opus_int L, /* I Length of vectors */
|
||||
const opus_int order, /* I Max lag for correlation */
|
||||
const opus_int head_room, /* I Desired headroom */
|
||||
opus_int32 *XX, /* O Pointer to X'*X correlation matrix [ order x order ]*/
|
||||
opus_int32 *XX, /* O Pointer to X'*X correlation matrix [ order x order ] */
|
||||
opus_int *rshifts /* I/O Right shifts of correlations */
|
||||
)
|
||||
{
|
||||
|
|
|
@ -41,15 +41,13 @@ static inline void silk_LBRR_encode_FIX(
|
|||
);
|
||||
|
||||
void silk_encode_do_VAD_FIX(
|
||||
silk_encoder_state_FIX *psEnc /* I/O Encoder state FIX */
|
||||
silk_encoder_state_FIX *psEnc /* I/O Pointer to Silk FIX encoder state */
|
||||
)
|
||||
{
|
||||
/****************************/
|
||||
/* Voice Activity Detection */
|
||||
/****************************/
|
||||
TIC(VAD)
|
||||
silk_VAD_GetSA_Q8( &psEnc->sCmn, psEnc->sCmn.inputBuf + 1 );
|
||||
TOC(VAD)
|
||||
|
||||
/**************************************************/
|
||||
/* Convert speech activity into VAD and DTX flags */
|
||||
|
@ -76,8 +74,8 @@ TOC(VAD)
|
|||
/* Encode frame */
|
||||
/****************/
|
||||
opus_int silk_encode_frame_FIX(
|
||||
silk_encoder_state_FIX *psEnc, /* I/O Encoder state FIX */
|
||||
opus_int32 *pnBytesOut, /* O Number of payload bytes */
|
||||
silk_encoder_state_FIX *psEnc, /* I/O Pointer to Silk FIX encoder state */
|
||||
opus_int32 *pnBytesOut, /* O Pointer to number of payload bytes; */
|
||||
ec_enc *psRangeEnc, /* I/O compressor data structure */
|
||||
opus_int condCoding, /* I The type of conditional coding to use */
|
||||
opus_int maxBits, /* I If > 0: maximum number of output bits */
|
||||
|
@ -99,10 +97,7 @@ opus_int silk_encode_frame_FIX(
|
|||
opus_int8 LastGainIndex_copy2;
|
||||
opus_uint8 ec_buf_copy[ 1275 ];
|
||||
|
||||
TIC(ENCODE_FRAME)
|
||||
|
||||
/* This is totally unnecessary but many compilers (including gcc) are too dumb
|
||||
to realise it */
|
||||
/* This is totally unnecessary but many compilers (including gcc) are too dumb to realise it */
|
||||
LastGainIndex_copy2 = nBits_lower = nBits_upper = gainMult_lower = gainMult_upper = 0;
|
||||
|
||||
psEnc->sCmn.indices.Seed = psEnc->sCmn.frameCounter++ & 3;
|
||||
|
@ -127,47 +122,34 @@ TIC(ENCODE_FRAME)
|
|||
/*****************************************/
|
||||
/* Find pitch lags, initial LPC analysis */
|
||||
/*****************************************/
|
||||
TIC(FIND_PITCH)
|
||||
silk_find_pitch_lags_FIX( psEnc, &sEncCtrl, res_pitch, x_frame );
|
||||
TOC(FIND_PITCH)
|
||||
|
||||
/************************/
|
||||
/* Noise shape analysis */
|
||||
/************************/
|
||||
TIC(NOISE_SHAPE_ANALYSIS)
|
||||
silk_noise_shape_analysis_FIX( psEnc, &sEncCtrl, res_pitch_frame, x_frame );
|
||||
TOC(NOISE_SHAPE_ANALYSIS)
|
||||
|
||||
/***************************************************/
|
||||
/* Find linear prediction coefficients (LPC + LTP) */
|
||||
/***************************************************/
|
||||
TIC(FIND_PRED_COEF)
|
||||
silk_find_pred_coefs_FIX( psEnc, &sEncCtrl, res_pitch, x_frame, condCoding );
|
||||
TOC(FIND_PRED_COEF)
|
||||
|
||||
/****************************************/
|
||||
/* Process gains */
|
||||
/****************************************/
|
||||
TIC(PROCESS_GAINS)
|
||||
silk_process_gains_FIX( psEnc, &sEncCtrl, condCoding );
|
||||
TOC(PROCESS_GAINS)
|
||||
|
||||
/*****************************************/
|
||||
/* Prefiltering for noise shaper */
|
||||
/*****************************************/
|
||||
TIC(PREFILTER)
|
||||
silk_prefilter_FIX( psEnc, &sEncCtrl, xfw, x_frame );
|
||||
TOC(PREFILTER)
|
||||
|
||||
/****************************************/
|
||||
/* Low Bitrate Redundant Encoding */
|
||||
/****************************************/
|
||||
TIC(LBRR)
|
||||
silk_LBRR_encode_FIX( psEnc, &sEncCtrl, xfw, condCoding );
|
||||
TOC(LBRR)
|
||||
|
||||
if( psEnc->sCmn.prefillFlag ) {
|
||||
TIC(NSQ)
|
||||
if( psEnc->sCmn.nStatesDelayedDecision > 1 || psEnc->sCmn.warping_Q16 > 0 ) {
|
||||
silk_NSQ_del_dec( &psEnc->sCmn, &psEnc->sCmn.sNSQ, &psEnc->sCmn.indices, xfw, psEnc->sCmn.pulses,
|
||||
sEncCtrl.PredCoef_Q12[ 0 ], sEncCtrl.LTPCoef_Q14, sEncCtrl.AR2_Q13, sEncCtrl.HarmShapeGain_Q14,
|
||||
|
@ -177,7 +159,6 @@ TIC(NSQ)
|
|||
sEncCtrl.PredCoef_Q12[ 0 ], sEncCtrl.LTPCoef_Q14, sEncCtrl.AR2_Q13, sEncCtrl.HarmShapeGain_Q14,
|
||||
sEncCtrl.Tilt_Q14, sEncCtrl.LF_shp_Q14, sEncCtrl.Gains_Q16, sEncCtrl.pitchL, sEncCtrl.Lambda_Q10, sEncCtrl.LTP_scale_Q14 );
|
||||
}
|
||||
TOC(NSQ)
|
||||
} else {
|
||||
/* Loop over quantizer and entropy coding to control bitrate */
|
||||
maxIter = 5;
|
||||
|
@ -211,7 +192,6 @@ TOC(NSQ)
|
|||
/*****************************************/
|
||||
/* Noise shaping quantization */
|
||||
/*****************************************/
|
||||
TIC(NSQ)
|
||||
if( psEnc->sCmn.nStatesDelayedDecision > 1 || psEnc->sCmn.warping_Q16 > 0 ) {
|
||||
silk_NSQ_del_dec( &psEnc->sCmn, &psEnc->sCmn.sNSQ, &psEnc->sCmn.indices, xfw, psEnc->sCmn.pulses,
|
||||
sEncCtrl.PredCoef_Q12[ 0 ], sEncCtrl.LTPCoef_Q14, sEncCtrl.AR2_Q13, sEncCtrl.HarmShapeGain_Q14,
|
||||
|
@ -221,22 +201,17 @@ TIC(NSQ)
|
|||
sEncCtrl.PredCoef_Q12[ 0 ], sEncCtrl.LTPCoef_Q14, sEncCtrl.AR2_Q13, sEncCtrl.HarmShapeGain_Q14,
|
||||
sEncCtrl.Tilt_Q14, sEncCtrl.LF_shp_Q14, sEncCtrl.Gains_Q16, sEncCtrl.pitchL, sEncCtrl.Lambda_Q10, sEncCtrl.LTP_scale_Q14 );
|
||||
}
|
||||
TOC(NSQ)
|
||||
|
||||
/****************************************/
|
||||
/* Encode Parameters */
|
||||
/****************************************/
|
||||
TIC(ENCODE_PARAMS)
|
||||
silk_encode_indices( &psEnc->sCmn, psRangeEnc, psEnc->sCmn.nFramesEncoded, 0, condCoding );
|
||||
TOC(ENCODE_PARAMS)
|
||||
|
||||
/****************************************/
|
||||
/* Encode Excitation Signal */
|
||||
/****************************************/
|
||||
TIC(ENCODE_PULSES)
|
||||
silk_encode_pulses( psRangeEnc, psEnc->sCmn.indices.signalType, psEnc->sCmn.indices.quantOffsetType,
|
||||
psEnc->sCmn.pulses, psEnc->sCmn.frame_length );
|
||||
TOC(ENCODE_PULSES)
|
||||
|
||||
nBits = ec_tell( psRangeEnc );
|
||||
|
||||
|
@ -344,55 +319,11 @@ TOC(ENCODE_PULSES)
|
|||
/* Payload size */
|
||||
*pnBytesOut = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
|
||||
|
||||
TOC(ENCODE_FRAME)
|
||||
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
{
|
||||
silk_float tmp[ MAX_NB_SUBFR * LTP_ORDER ];
|
||||
int i;
|
||||
DEBUG_STORE_DATA( xf.dat, x_frame + LA_SHAPE_MS * psEnc->sCmn.fs_kHz, psEnc->sCmn.frame_length * sizeof( opus_int16 ) );
|
||||
DEBUG_STORE_DATA( xfw.dat, xfw, psEnc->sCmn.frame_length * sizeof( opus_int16 ) );
|
||||
DEBUG_STORE_DATA( pitchL.dat, sEncCtrl.pitchL, psEnc->sCmn.nb_subfr * sizeof( opus_int ) );
|
||||
for( i = 0; i < psEnc->sCmn.nb_subfr * LTP_ORDER; i++ ) {
|
||||
tmp[ i ] = (silk_float)sEncCtrl.LTPCoef_Q14[ i ] / 16384.0f;
|
||||
}
|
||||
DEBUG_STORE_DATA( pitchG_quantized.dat, tmp, psEnc->sCmn.nb_subfr * LTP_ORDER * sizeof( silk_float ) );
|
||||
for( i = 0; i <psEnc->sCmn.predictLPCOrder; i++ ) {
|
||||
tmp[ i ] = (silk_float)sEncCtrl.PredCoef_Q12[ 1 ][ i ] / 4096.0f;
|
||||
}
|
||||
DEBUG_STORE_DATA( PredCoef.dat, tmp, psEnc->sCmn.predictLPCOrder * sizeof( silk_float ) );
|
||||
|
||||
tmp[ 0 ] = (silk_float)sEncCtrl.LTPredCodGain_Q7 / 128.0f;
|
||||
DEBUG_STORE_DATA( LTPredCodGain.dat, tmp, sizeof( silk_float ) );
|
||||
tmp[ 0 ] = (silk_float)psEnc->LTPCorr_Q15 / 32768.0f;
|
||||
DEBUG_STORE_DATA( LTPcorr.dat, tmp, sizeof( silk_float ) );
|
||||
tmp[ 0 ] = (silk_float)psEnc->sCmn.input_tilt_Q15 / 32768.0f;
|
||||
DEBUG_STORE_DATA( tilt.dat, tmp, sizeof( silk_float ) );
|
||||
for( i = 0; i < psEnc->sCmn.nb_subfr; i++ ) {
|
||||
tmp[ i ] = (silk_float)sEncCtrl.Gains_Q16[ i ] / 65536.0f;
|
||||
}
|
||||
DEBUG_STORE_DATA( gains.dat, tmp, psEnc->sCmn.nb_subfr * sizeof( silk_float ) );
|
||||
DEBUG_STORE_DATA( gains_indices.dat, &psEnc->sCmn.indices.GainsIndices, psEnc->sCmn.nb_subfr * sizeof( opus_int ) );
|
||||
tmp[ 0 ] = (silk_float)sEncCtrl.current_SNR_dB_Q7 / 128.0f;
|
||||
DEBUG_STORE_DATA( current_SNR_db.dat, tmp, sizeof( silk_float ) );
|
||||
DEBUG_STORE_DATA( quantOffsetType.dat, &psEnc->sCmn.indices.quantOffsetType, sizeof( opus_int ) );
|
||||
tmp[ 0 ] = (silk_float)psEnc->sCmn.speech_activity_Q8 / 256.0f;
|
||||
DEBUG_STORE_DATA( speech_activity.dat, tmp, sizeof( silk_float ) );
|
||||
for( i = 0; i < VAD_N_BANDS; i++ ) {
|
||||
tmp[ i ] = (silk_float)psEnc->sCmn.input_quality_bands_Q15[ i ] / 32768.0f;
|
||||
}
|
||||
DEBUG_STORE_DATA( input_quality_bands.dat, tmp, VAD_N_BANDS * sizeof( silk_float ) );
|
||||
DEBUG_STORE_DATA( signalType.dat, &psEnc->sCmn.indices.signalType, sizeof( opus_int8) );
|
||||
DEBUG_STORE_DATA( lag_index.dat, &psEnc->sCmn.indices.lagIndex, sizeof( opus_int16 ) );
|
||||
DEBUG_STORE_DATA( contour_index.dat, &psEnc->sCmn.indices.contourIndex, sizeof( opus_int8 ) );
|
||||
DEBUG_STORE_DATA( per_index.dat, &psEnc->sCmn.indices.PERIndex, sizeof( opus_int8) );
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Low-Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode excitation at lower bitrate */
|
||||
void silk_LBRR_encode_FIX(
|
||||
static inline void silk_LBRR_encode_FIX(
|
||||
silk_encoder_state_FIX *psEnc, /* I/O Pointer to Silk FIX encoder state */
|
||||
silk_encoder_control_FIX *psEncCtrl, /* I/O Pointer to Silk FIX encoder control struct */
|
||||
const opus_int16 xfw[], /* I Input signal */
|
||||
|
|
|
@ -42,7 +42,7 @@ void silk_find_LPC_FIX(
|
|||
const opus_int LPC_order, /* I LPC order */
|
||||
const opus_int16 x[], /* I Input signal */
|
||||
const opus_int subfr_length, /* I Input signal subframe length including preceeding samples */
|
||||
const opus_int nb_subfr /* I: Number of subframes */
|
||||
const opus_int nb_subfr /* I Number of subframes */
|
||||
)
|
||||
{
|
||||
opus_int k;
|
||||
|
|
|
@ -44,7 +44,7 @@ void silk_find_LTP_FIX(
|
|||
opus_int16 b_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* O LTP coefs */
|
||||
opus_int32 WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* O Weight for LTP quantization */
|
||||
opus_int *LTPredCodGain_Q7, /* O LTP coding gain */
|
||||
const opus_int16 r_lpc[] , /* I residual signal after LPC signal + state for first 10 ms */
|
||||
const opus_int16 r_lpc[], /* I residual signal after LPC signal + state for first 10 ms */
|
||||
const opus_int lag[ MAX_NB_SUBFR ], /* I LTP lags */
|
||||
const opus_int32 Wght_Q15[ MAX_NB_SUBFR ], /* I weights */
|
||||
const opus_int subfr_length, /* I subframe length */
|
||||
|
@ -229,7 +229,6 @@ void silk_find_LTP_FIX(
|
|||
}
|
||||
b_Q14_ptr += LTP_ORDER;
|
||||
}
|
||||
TOC(find_LTP_FIX)
|
||||
}
|
||||
|
||||
void silk_fit_LTP(
|
||||
|
|
|
@ -112,16 +112,12 @@ void silk_find_pred_coefs_FIX(
|
|||
}
|
||||
|
||||
/* LPC_in_pre contains the LTP-filtered input for voiced, and the unfiltered input for unvoiced */
|
||||
TIC(FIND_LPC)
|
||||
silk_find_LPC_FIX( NLSF_Q15, &psEnc->sCmn.indices.NLSFInterpCoef_Q2, psEnc->sCmn.prev_NLSFq_Q15,
|
||||
psEnc->sCmn.useInterpolatedNLSFs, psEnc->sCmn.first_frame_after_reset, psEnc->sCmn.predictLPCOrder,
|
||||
LPC_in_pre, psEnc->sCmn.subfr_length + psEnc->sCmn.predictLPCOrder, psEnc->sCmn.nb_subfr );
|
||||
TOC(FIND_LPC)
|
||||
|
||||
/* Quantize LSFs */
|
||||
TIC(PROCESS_LSFS)
|
||||
silk_process_NLSFs( &psEnc->sCmn, psEncCtrl->PredCoef_Q12, NLSF_Q15, psEnc->sCmn.prev_NLSFq_Q15 );
|
||||
TOC(PROCESS_LSFS)
|
||||
|
||||
/* Calculate residual energy using quantized LPC coefficients */
|
||||
silk_residual_energy_FIX( psEncCtrl->ResNrg, psEncCtrl->ResNrgQ, LPC_in_pre, psEncCtrl->PredCoef_Q12, local_gains,
|
||||
|
|
|
@ -33,9 +33,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* Step up function, converts reflection coefficients to prediction coefficients */
|
||||
void silk_k2a(
|
||||
opus_int32 *A_Q24, /* O: Prediction coefficients [order] Q24 */
|
||||
const opus_int16 *rc_Q15, /* I: Reflection coefficients [order] Q15 */
|
||||
const opus_int32 order /* I: Prediction order */
|
||||
opus_int32 *A_Q24, /* O Prediction coefficients [order] Q24 */
|
||||
const opus_int16 *rc_Q15, /* I Reflection coefficients [order] Q15 */
|
||||
const opus_int32 order /* I Prediction order */
|
||||
)
|
||||
{
|
||||
opus_int k, n;
|
||||
|
|
|
@ -33,9 +33,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* Step up function, converts reflection coefficients to prediction coefficients */
|
||||
void silk_k2a_Q16(
|
||||
opus_int32 *A_Q24, /* O: Prediction coefficients [order] Q24 */
|
||||
const opus_int32 *rc_Q16, /* I: Reflection coefficients [order] Q16 */
|
||||
const opus_int32 order /* I: Prediction order */
|
||||
opus_int32 *A_Q24, /* O Prediction coefficients [order] Q24 */
|
||||
const opus_int32 *rc_Q16, /* I Reflection coefficients [order] Q16 */
|
||||
const opus_int32 order /* I Prediction order */
|
||||
)
|
||||
{
|
||||
opus_int k, n;
|
||||
|
|
|
@ -73,13 +73,13 @@ opus_int silk_encode_frame_FIX(
|
|||
|
||||
/* Initializes the Silk encoder state */
|
||||
opus_int silk_init_encoder(
|
||||
silk_encoder_state_FIX *psEnc /* I/O Pointer to Silk FIX encoder state */
|
||||
silk_encoder_state_Fxx *psEnc /* I/O Pointer to Silk FIX encoder state */
|
||||
);
|
||||
|
||||
/* Control the Silk encoder */
|
||||
opus_int silk_control_encoder(
|
||||
silk_encoder_state_FIX *psEnc, /* I/O Pointer to Silk encoder state */
|
||||
silk_EncControlStruct *encControl, /* I: Control structure */
|
||||
silk_encoder_state_Fxx *psEnc, /* I/O Pointer to Silk encoder state */
|
||||
silk_EncControlStruct *encControl, /* I Control structure */
|
||||
const opus_int32 TargetRate_bps, /* I Target max bitrate (bps) */
|
||||
const opus_int allow_bw_switch, /* I Flag to allow switching audio bandwidth */
|
||||
const opus_int channelNb, /* I Channel number */
|
||||
|
@ -154,7 +154,7 @@ void silk_find_LPC_FIX(
|
|||
const opus_int LPC_order, /* I LPC order */
|
||||
const opus_int16 x[], /* I Input signal */
|
||||
const opus_int subfr_length, /* I Input signal subframe length including preceeding samples */
|
||||
const opus_int nb_subfr /* I: Number of subframes */
|
||||
const opus_int nb_subfr /* I Number of subframes */
|
||||
);
|
||||
|
||||
/* LTP analysis */
|
||||
|
@ -172,14 +172,14 @@ void silk_find_LTP_FIX(
|
|||
);
|
||||
|
||||
void silk_LTP_analysis_filter_FIX(
|
||||
opus_int16 *LTP_res, /* O: LTP residual signal of length MAX_NB_SUBFR * ( pre_length + subfr_length ) */
|
||||
const opus_int16 *x, /* I: Pointer to input signal with at least max( pitchL ) preceeding samples */
|
||||
const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],/* I: LTP_ORDER LTP coefficients for each MAX_NB_SUBFR subframe */
|
||||
const opus_int pitchL[ MAX_NB_SUBFR ], /* I: Pitch lag, one for each subframe */
|
||||
const opus_int32 invGains_Q16[ MAX_NB_SUBFR ], /* I: Inverse quantization gains, one for each subframe */
|
||||
const opus_int subfr_length, /* I: Length of each subframe */
|
||||
const opus_int nb_subfr, /* I: Number of subframes */
|
||||
const opus_int pre_length /* I: Length of the preceeding samples starting at &x[0] for each subframe */
|
||||
opus_int16 *LTP_res, /* O LTP residual signal of length MAX_NB_SUBFR * ( pre_length + subfr_length ) */
|
||||
const opus_int16 *x, /* I Pointer to input signal with at least max( pitchL ) preceeding samples */
|
||||
const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],/* I LTP_ORDER LTP coefficients for each MAX_NB_SUBFR subframe */
|
||||
const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lag, one for each subframe */
|
||||
const opus_int32 invGains_Q16[ MAX_NB_SUBFR ], /* I Inverse quantization gains, one for each subframe */
|
||||
const opus_int subfr_length, /* I Length of each subframe */
|
||||
const opus_int nb_subfr, /* I Number of subframes */
|
||||
const opus_int pre_length /* I Length of the preceeding samples starting at &x[0] for each subframe */
|
||||
);
|
||||
|
||||
/* Calculates residual energies of input subframes where all subframes have LPC_order */
|
||||
|
@ -221,7 +221,7 @@ void silk_corrMatrix_FIX(
|
|||
const opus_int L, /* I Length of vectors */
|
||||
const opus_int order, /* I Max lag for correlation */
|
||||
const opus_int head_room, /* I Desired headroom */
|
||||
opus_int32 *XX, /* O Pointer to X'*X correlation matrix [ order x order ]*/
|
||||
opus_int32 *XX, /* O Pointer to X'*X correlation matrix [ order x order ] */
|
||||
opus_int *rshifts /* I/O Right shifts of correlations */
|
||||
);
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1
|
|||
if( Fs_kHz == 16 ) {
|
||||
silk_memset( filt_state, 0, 2 * sizeof( opus_int32 ) );
|
||||
silk_resampler_down2( filt_state, frame_8kHz, frame, frame_length );
|
||||
} else if ( Fs_kHz == 12 ) {
|
||||
} else if( Fs_kHz == 12 ) {
|
||||
silk_memset( filt_state, 0, 6 * sizeof( opus_int32 ) );
|
||||
silk_resampler_down2_3( filt_state, frame_8kHz, frame, frame_length );
|
||||
} else {
|
||||
|
@ -429,7 +429,7 @@ opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1
|
|||
CCmax_new_b -= prev_lag_bias_Q15; /* Q15 */
|
||||
}
|
||||
|
||||
if ( CCmax_new_b > CCmax_b && /* Find maximum biased correlation */
|
||||
if( CCmax_new_b > CCmax_b && /* Find maximum biased correlation */
|
||||
CCmax_new > corr_thres_Q15 && /* Correlation needs to be high enough to be voiced */
|
||||
silk_CB_lags_stage2[ 0 ][ CBimax_new ] <= min_lag_8kHz /* Lag must be in range */
|
||||
) {
|
||||
|
@ -450,10 +450,9 @@ opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1
|
|||
}
|
||||
|
||||
if( Fs_kHz > 8 ) {
|
||||
|
||||
/******************************************************************************
|
||||
** Scale input signal down to avoid correlations measures from overflowing
|
||||
*******************************************************************************/
|
||||
/***************************************************************************/
|
||||
/* Scale input signal down to avoid correlations measures from overflowing */
|
||||
/***************************************************************************/
|
||||
/* find scaling as max scaling for each subframe */
|
||||
shift = silk_P_Ana_find_scaling( frame, frame_length, sf_length );
|
||||
if( shift > 0 ) {
|
||||
|
@ -466,7 +465,6 @@ opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1
|
|||
} else {
|
||||
input_frame_ptr = (opus_int16*)frame;
|
||||
}
|
||||
/*********************************************************************************/
|
||||
|
||||
/* Search in original signal */
|
||||
|
||||
|
@ -600,7 +598,7 @@ void silk_P_Ana_calc_corr_st3(
|
|||
silk_assert( complexity >= SILK_PE_MIN_COMPLEX );
|
||||
silk_assert( complexity <= SILK_PE_MAX_COMPLEX );
|
||||
|
||||
if( nb_subfr == PE_MAX_NB_SUBFR ){
|
||||
if( nb_subfr == PE_MAX_NB_SUBFR ) {
|
||||
Lag_range_ptr = &silk_Lag_range_stage3[ complexity ][ 0 ][ 0 ];
|
||||
Lag_CB_ptr = &silk_CB_lags_stage3[ 0 ][ 0 ];
|
||||
nb_cbk_search = silk_nb_cbk_searchs_stage3[ complexity ];
|
||||
|
@ -666,7 +664,7 @@ void silk_P_Ana_calc_energy_st3(
|
|||
silk_assert( complexity >= SILK_PE_MIN_COMPLEX );
|
||||
silk_assert( complexity <= SILK_PE_MAX_COMPLEX );
|
||||
|
||||
if( nb_subfr == PE_MAX_NB_SUBFR ){
|
||||
if( nb_subfr == PE_MAX_NB_SUBFR ) {
|
||||
Lag_range_ptr = &silk_Lag_range_stage3[ complexity ][ 0 ][ 0 ];
|
||||
Lag_CB_ptr = &silk_CB_lags_stage3[ 0 ][ 0 ];
|
||||
nb_cbk_search = silk_nb_cbk_searchs_stage3[ complexity ];
|
||||
|
|
|
@ -32,14 +32,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "main_FIX.h"
|
||||
#include "tuning_parameters.h"
|
||||
|
||||
/* silk_prefilter. Prefilter for finding Quantizer input signal */
|
||||
/* Prefilter for finding Quantizer input signal */
|
||||
static inline void silk_prefilt_FIX(
|
||||
silk_prefilter_state_FIX *P, /* I/O state */
|
||||
opus_int32 st_res_Q12[], /* I short term residual signal */
|
||||
opus_int16 xw[], /* O prefiltered signal */
|
||||
opus_int32 HarmShapeFIRPacked_Q12, /* I Harmonic shaping coeficients */
|
||||
opus_int Tilt_Q14, /* I Tilt shaping coeficient */
|
||||
opus_int32 LF_shp_Q14, /* I Low-frequancy shaping coeficients*/
|
||||
opus_int32 LF_shp_Q14, /* I Low-frequancy shaping coeficients */
|
||||
opus_int lag, /* I Lag for harmonic shaping */
|
||||
opus_int length /* I Length of signals */
|
||||
);
|
||||
|
@ -86,8 +86,8 @@ void silk_warped_LPC_analysis_filter_FIX(
|
|||
}
|
||||
|
||||
void silk_prefilter_FIX(
|
||||
silk_encoder_state_FIX *psEnc, /* I/O Encoder state FIX */
|
||||
const silk_encoder_control_FIX *psEncCtrl, /* I Encoder control FIX */
|
||||
silk_encoder_state_FIX *psEnc, /* I/O Encoder state */
|
||||
const silk_encoder_control_FIX *psEncCtrl, /* I Encoder control */
|
||||
opus_int16 xw[], /* O Weighted signal */
|
||||
const opus_int16 x[] /* I Speech signal */
|
||||
)
|
||||
|
@ -151,14 +151,14 @@ void silk_prefilter_FIX(
|
|||
P->lagPrev = psEncCtrl->pitchL[ MAX_NB_SUBFR - 1 ];
|
||||
}
|
||||
|
||||
/* silk_prefilter. Prefilter for finding Quantizer input signal */
|
||||
/* Prefilter for finding Quantizer input signal */
|
||||
static inline void silk_prefilt_FIX(
|
||||
silk_prefilter_state_FIX *P, /* I/O state */
|
||||
opus_int32 st_res_Q12[], /* I short term residual signal */
|
||||
opus_int16 xw[], /* O prefiltered signal */
|
||||
opus_int32 HarmShapeFIRPacked_Q12, /* I Harmonic shaping coeficients */
|
||||
opus_int Tilt_Q14, /* I Tilt shaping coeficient */
|
||||
opus_int32 LF_shp_Q14, /* I Low-frequancy shaping coeficients*/
|
||||
opus_int32 LF_shp_Q14, /* I Low-frequancy shaping coeficients */
|
||||
opus_int lag, /* I Lag for harmonic shaping */
|
||||
opus_int length /* I Length of signals */
|
||||
)
|
||||
|
|
|
@ -34,9 +34,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* Processing of gains */
|
||||
void silk_process_gains_FIX(
|
||||
silk_encoder_state_FIX *psEnc, /* I/O Encoder state_FIX */
|
||||
silk_encoder_control_FIX *psEncCtrl, /* I/O Encoder control_FIX */
|
||||
opus_int condCoding /* The type of conditional coding to use */
|
||||
silk_encoder_state_FIX *psEnc, /* I/O Encoder state */
|
||||
silk_encoder_control_FIX *psEncCtrl, /* I/O Encoder control */
|
||||
opus_int condCoding /* I The type of conditional coding to use */
|
||||
)
|
||||
{
|
||||
silk_shape_state_FIX *psShapeSt = &psEnc->sShape;
|
||||
|
|
|
@ -33,10 +33,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* Slower than schur(), but more accurate. */
|
||||
/* Uses SMULL(), available on armv4 */
|
||||
opus_int32 silk_schur64( /* O: Returns residual energy */
|
||||
opus_int32 rc_Q16[], /* O: Reflection coefficients [order] Q16 */
|
||||
const opus_int32 c[], /* I: Correlations [order+1] */
|
||||
opus_int32 order /* I: Prediction order */
|
||||
opus_int32 silk_schur64( /* O returns residual energy */
|
||||
opus_int32 rc_Q16[], /* O Reflection coefficients [order] Q16 */
|
||||
const opus_int32 c[], /* I Correlations [order+1] */
|
||||
opus_int32 order /* I Prediction order */
|
||||
)
|
||||
{
|
||||
opus_int k, n;
|
||||
|
|
|
@ -33,10 +33,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* Faster than schur64(), but much less accurate. */
|
||||
/* uses SMLAWB(), requiring armv5E and higher. */
|
||||
opus_int32 silk_schur( /* O: Returns residual energy */
|
||||
opus_int16 *rc_Q15, /* O: reflection coefficients [order] Q15 */
|
||||
const opus_int32 *c, /* I: correlations [order+1] */
|
||||
const opus_int32 order /* I: prediction order */
|
||||
opus_int32 silk_schur( /* O Returns residual energy */
|
||||
opus_int16 *rc_Q15, /* O reflection coefficients [order] Q15 */
|
||||
const opus_int32 *c, /* I correlations [order+1] */
|
||||
const opus_int32 order /* I prediction order */
|
||||
)
|
||||
{
|
||||
opus_int k, n, lz;
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../;../../win32;../../celt</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../;../../win32;../../celt;../../include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -70,7 +70,7 @@
|
|||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../;../../win32;../../celt</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../;../../win32;../../celt;../../include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -113,6 +113,7 @@
|
|||
<ClCompile Include="schur64_FIX.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\opus_types.h" />
|
||||
<ClInclude Include="..\..\win32\config.h" />
|
||||
<ClInclude Include="..\SigProc_FIX.h" />
|
||||
<ClInclude Include="main_FIX.h" />
|
||||
|
|
|
@ -107,5 +107,8 @@
|
|||
<ClInclude Include="structs_FIX.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\opus_types.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -110,7 +110,7 @@ void silk_solve_LDL_FIX(
|
|||
}
|
||||
|
||||
static inline void silk_LDL_factorize_FIX(
|
||||
opus_int32 *A, /* I Pointer to Symetric Square Matrix */
|
||||
opus_int32 *A, /* I/O Pointer to Symetric Square Matrix */
|
||||
opus_int M, /* I Size of Matrix */
|
||||
opus_int32 *L_Q16, /* I/O Pointer to Square Upper triangular Matrix */
|
||||
inv_D_t *inv_D /* I/O Pointer to vector holding inverted diagonal elements of D */
|
||||
|
@ -184,7 +184,7 @@ static inline void silk_LDL_factorize_FIX(
|
|||
static inline void silk_LS_divide_Q16_FIX(
|
||||
opus_int32 T[], /* I/O Numenator vector */
|
||||
inv_D_t *inv_D, /* I 1 / D vector */
|
||||
opus_int M /* I Order */
|
||||
opus_int M /* I dimension */
|
||||
)
|
||||
{
|
||||
opus_int i;
|
||||
|
|
|
@ -35,8 +35,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
void silk_scale_copy_vector16(
|
||||
opus_int16 *data_out,
|
||||
const opus_int16 *data_in,
|
||||
opus_int32 gain_Q16, /* (I): gain in Q16 */
|
||||
const opus_int dataSize /* (I): length */
|
||||
opus_int32 gain_Q16, /* I Gain in Q16 */
|
||||
const opus_int dataSize /* I Length */
|
||||
)
|
||||
{
|
||||
opus_int i;
|
||||
|
@ -50,24 +50,23 @@ void silk_scale_copy_vector16(
|
|||
|
||||
/* Multiply a vector by a constant */
|
||||
void silk_scale_vector32_Q26_lshift_18(
|
||||
opus_int32 *data1, /* (I/O): Q0/Q18 */
|
||||
opus_int32 gain_Q26, /* (I): Q26 */
|
||||
opus_int dataSize /* (I): length */
|
||||
opus_int32 *data1, /* I/O Q0/Q18 */
|
||||
opus_int32 gain_Q26, /* I Q26 */
|
||||
opus_int dataSize /* I length */
|
||||
)
|
||||
{
|
||||
opus_int i;
|
||||
|
||||
for( i = 0; i < dataSize; i++ ) {
|
||||
data1[ i ] = (opus_int32)silk_CHECK_FIT32( silk_RSHIFT64( silk_SMULL( data1[ i ], gain_Q26 ), 8 ) );/* OUTPUT: Q18*/
|
||||
data1[ i ] = (opus_int32)silk_CHECK_FIT32( silk_RSHIFT64( silk_SMULL( data1[ i ], gain_Q26 ), 8 ) ); /* OUTPUT: Q18 */
|
||||
}
|
||||
}
|
||||
|
||||
/* sum= for(i=0;i<len;i++)inVec1[i]*inVec2[i]; --- inner product */
|
||||
/* sum = for(i=0;i<len;i++)inVec1[i]*inVec2[i]; --- inner product */
|
||||
/* Note for ARM asm: */
|
||||
/* * inVec1 and inVec2 should be at least 2 byte aligned. (Or defined as short/int16) */
|
||||
/* * inVec1 and inVec2 should be at least 2 byte aligned. */
|
||||
/* * len should be positive 16bit integer. */
|
||||
/* * only when len>6, memory access can be reduced by half. */
|
||||
|
||||
opus_int32 silk_inner_prod_aligned(
|
||||
const opus_int16 *const inVec1, /* I input vector 1 */
|
||||
const opus_int16 *const inVec2, /* I input vector 2 */
|
||||
|
@ -116,7 +115,7 @@ opus_int16 silk_int16_array_maxabs( /* O Maximum absolute value, max
|
|||
}
|
||||
|
||||
/* Do not return 32768, as it will not fit in an int16 so may lead to problems later on */
|
||||
if( max >= 1073676289 ) { /* (2^15-1)^2 = 1073676289*/
|
||||
if( max >= 1073676289 ) { /* (2^15-1)^2 = 1073676289 */
|
||||
return( silk_int16_MAX );
|
||||
} else {
|
||||
if( vec[ ind ] < 0 ) {
|
||||
|
|
|
@ -51,7 +51,7 @@ static inline void silk_LPC_analysis_filter16_FLP(
|
|||
silk_float LPC_pred;
|
||||
const silk_float *s_ptr;
|
||||
|
||||
for ( ix = 16; ix < length; ix++) {
|
||||
for( ix = 16; ix < length; ix++ ) {
|
||||
s_ptr = &s[ix - 1];
|
||||
|
||||
/* short-term prediction */
|
||||
|
@ -89,7 +89,7 @@ static inline void silk_LPC_analysis_filter14_FLP(
|
|||
silk_float LPC_pred;
|
||||
const silk_float *s_ptr;
|
||||
|
||||
for ( ix = 14; ix < length; ix++) {
|
||||
for( ix = 14; ix < length; ix++ ) {
|
||||
s_ptr = &s[ix - 1];
|
||||
|
||||
/* short-term prediction */
|
||||
|
@ -125,7 +125,7 @@ static inline void silk_LPC_analysis_filter12_FLP(
|
|||
silk_float LPC_pred;
|
||||
const silk_float *s_ptr;
|
||||
|
||||
for ( ix = 12; ix < length; ix++) {
|
||||
for( ix = 12; ix < length; ix++ ) {
|
||||
s_ptr = &s[ix - 1];
|
||||
|
||||
/* short-term prediction */
|
||||
|
@ -159,7 +159,7 @@ static inline void silk_LPC_analysis_filter10_FLP(
|
|||
silk_float LPC_pred;
|
||||
const silk_float *s_ptr;
|
||||
|
||||
for ( ix = 10; ix < length; ix++) {
|
||||
for( ix = 10; ix < length; ix++ ) {
|
||||
s_ptr = &s[ix - 1];
|
||||
|
||||
/* short-term prediction */
|
||||
|
@ -191,7 +191,7 @@ static inline void silk_LPC_analysis_filter8_FLP(
|
|||
silk_float LPC_pred;
|
||||
const silk_float *s_ptr;
|
||||
|
||||
for ( ix = 8; ix < length; ix++) {
|
||||
for( ix = 8; ix < length; ix++ ) {
|
||||
s_ptr = &s[ix - 1];
|
||||
|
||||
/* short-term prediction */
|
||||
|
@ -221,7 +221,7 @@ static inline void silk_LPC_analysis_filter6_FLP(
|
|||
silk_float LPC_pred;
|
||||
const silk_float *s_ptr;
|
||||
|
||||
for ( ix = 6; ix < length; ix++) {
|
||||
for( ix = 6; ix < length; ix++ ) {
|
||||
s_ptr = &s[ix - 1];
|
||||
|
||||
/* short-term prediction */
|
||||
|
@ -243,7 +243,6 @@ static inline void silk_LPC_analysis_filter6_FLP(
|
|||
/* filter always starts with zero state */
|
||||
/* first Order output samples are set to zero */
|
||||
/************************************************/
|
||||
|
||||
void silk_LPC_analysis_filter_FLP(
|
||||
silk_float r_LPC[], /* O LPC residual signal */
|
||||
const silk_float PredCoef[], /* I LPC coefficients */
|
||||
|
|
|
@ -37,10 +37,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
/* compute inverse of LPC prediction gain, and */
|
||||
/* test if LPC coefficients are stable (all poles within unit circle) */
|
||||
/* this code is based on silk_a2k_FLP() */
|
||||
opus_int silk_LPC_inverse_pred_gain_FLP( /* O: returns 1 if unstable, otherwise 0 */
|
||||
silk_float *invGain, /* O: inverse prediction gain, energy domain */
|
||||
const silk_float *A, /* I: prediction coefficients [order] */
|
||||
opus_int32 order /* I: prediction order */
|
||||
opus_int silk_LPC_inverse_pred_gain_FLP( /* O returns 1 if unstable, otherwise 0 */
|
||||
silk_float *invGain, /* O inverse prediction gain, energy domain */
|
||||
const silk_float *A, /* I prediction coefficients [order] */
|
||||
opus_int32 order /* I prediction order */
|
||||
)
|
||||
{
|
||||
opus_int k, n;
|
||||
|
@ -54,7 +54,7 @@ opus_int silk_LPC_inverse_pred_gain_FLP( /* O: returns 1 if unstable, otherw
|
|||
*invGain = 1.0f;
|
||||
for( k = order - 1; k > 0; k-- ) {
|
||||
rc = -Anew[ k ];
|
||||
if (rc > RC_THRESHOLD || rc < -RC_THRESHOLD) {
|
||||
if( rc > RC_THRESHOLD || rc < -RC_THRESHOLD ) {
|
||||
return 1;
|
||||
}
|
||||
rc_mult1 = 1.0f - rc * rc;
|
||||
|
@ -68,7 +68,7 @@ opus_int silk_LPC_inverse_pred_gain_FLP( /* O: returns 1 if unstable, otherw
|
|||
}
|
||||
}
|
||||
rc = -Anew[ 0 ];
|
||||
if ( rc > RC_THRESHOLD || rc < -RC_THRESHOLD ) {
|
||||
if( rc > RC_THRESHOLD || rc < -RC_THRESHOLD ) {
|
||||
return 1;
|
||||
}
|
||||
rc_mult1 = 1.0f - rc * rc;
|
||||
|
|
|
@ -42,18 +42,18 @@ extern "C"
|
|||
|
||||
/* Chirp (bw expand) LP AR filter */
|
||||
void silk_bwexpander_FLP(
|
||||
silk_float *ar, /* io AR filter to be expanded (without leading 1) */
|
||||
const opus_int d, /* i length of ar */
|
||||
const silk_float chirp /* i chirp factor (typically in range (0..1) ) */
|
||||
silk_float *ar, /* I/O AR filter to be expanded (without leading 1) */
|
||||
const opus_int d, /* I length of ar */
|
||||
const silk_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() */
|
||||
opus_int silk_LPC_inverse_pred_gain_FLP( /* O: returns 1 if unstable, otherwise 0 */
|
||||
silk_float *invGain, /* O: inverse prediction gain, energy domain */
|
||||
const silk_float *A, /* I: prediction coefficients [order] */
|
||||
opus_int32 order /* I: prediction order */
|
||||
opus_int silk_LPC_inverse_pred_gain_FLP( /* O returns 1 if unstable, otherwise 0 */
|
||||
silk_float *invGain, /* O inverse prediction gain, energy domain */
|
||||
const silk_float *A, /* I prediction coefficients [order] */
|
||||
opus_int32 order /* I prediction order */
|
||||
);
|
||||
|
||||
silk_float silk_schur_FLP( /* O returns residual energy */
|
||||
|
@ -63,9 +63,9 @@ silk_float silk_schur_FLP( /* O returns residual energy
|
|||
);
|
||||
|
||||
void silk_k2a_FLP(
|
||||
silk_float *A, /* O: prediction coefficients [order] */
|
||||
const silk_float *rc, /* I: reflection coefficients [order] */
|
||||
opus_int32 order /* I: prediction order */
|
||||
silk_float *A, /* O prediction coefficients [order] */
|
||||
const silk_float *rc, /* I reflection coefficients [order] */
|
||||
opus_int32 order /* I prediction order */
|
||||
);
|
||||
|
||||
/* Solve the normal equations using the Levinson-Durbin recursion */
|
||||
|
@ -77,45 +77,38 @@ silk_float silk_levinsondurbin_FLP( /* O prediction error energy
|
|||
|
||||
/* compute autocorrelation */
|
||||
void silk_autocorrelation_FLP(
|
||||
silk_float *results, /* o result (length correlationCount) */
|
||||
const silk_float *inputData, /* i input data to correlate */
|
||||
opus_int inputDataSize, /* i length of input */
|
||||
opus_int correlationCount /* i number of correlation taps to compute */
|
||||
silk_float *results, /* O result (length correlationCount) */
|
||||
const silk_float *inputData, /* I input data to correlate */
|
||||
opus_int inputDataSize, /* I length of input */
|
||||
opus_int correlationCount /* I number of correlation taps to compute */
|
||||
);
|
||||
|
||||
/* Pitch estimator */
|
||||
#define SigProc_PE_MIN_COMPLEX 0
|
||||
#define SigProc_PE_MID_COMPLEX 1
|
||||
#define SigProc_PE_MAX_COMPLEX 2
|
||||
|
||||
opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoiced */
|
||||
const silk_float *signal, /* I signal of length PE_FRAME_LENGTH_MS*Fs_kHz */
|
||||
opus_int *pitch_out, /* O 4 pitch lag values */
|
||||
opus_int16 *lagIndex, /* O lag Index */
|
||||
opus_int8 *contourIndex, /* O pitch contour Index */
|
||||
silk_float *LTPCorr, /* I/O normalized correlation; input: value from previous frame */
|
||||
opus_int prevLag, /* I last lag of previous frame; set to zero is unvoiced */
|
||||
const silk_float search_thres1, /* I first stage threshold for lag candidates 0 - 1 */
|
||||
const silk_float search_thres2, /* I final threshold for lag candidates 0 - 1 */
|
||||
opus_int silk_pitch_analysis_core_FLP( /* O Voicing estimate: 0 voiced, 1 unvoiced */
|
||||
const silk_float *frame, /* I Signal of length PE_FRAME_LENGTH_MS*Fs_kHz */
|
||||
opus_int *pitch_out, /* O Pitch lag values [nb_subfr] */
|
||||
opus_int16 *lagIndex, /* O Lag Index */
|
||||
opus_int8 *contourIndex, /* O Pitch contour Index */
|
||||
silk_float *LTPCorr, /* I/O Normalized correlation; input: value from previous frame */
|
||||
opus_int prevLag, /* I Last lag of previous frame; set to zero is unvoiced */
|
||||
const silk_float search_thres1, /* I First stage threshold for lag candidates 0 - 1 */
|
||||
const silk_float search_thres2, /* I Final threshold for lag candidates 0 - 1 */
|
||||
const opus_int Fs_kHz, /* I sample frequency (kHz) */
|
||||
const opus_int complexity, /* I Complexity setting, 0-2, where 2 is highest */
|
||||
const opus_int nb_subfr /* I number of 5 ms subframes */
|
||||
const opus_int nb_subfr /* I Number of 5 ms subframes */
|
||||
);
|
||||
|
||||
#define PI (3.1415926536f)
|
||||
|
||||
void silk_insertion_sort_decreasing_FLP(
|
||||
silk_float *a, /* I/O: Unsorted / Sorted vector */
|
||||
opus_int *idx, /* O: Index vector for the sorted elements */
|
||||
const opus_int L, /* I: Vector length */
|
||||
const opus_int K /* I: Number of correctly sorted positions */
|
||||
silk_float *a, /* I/O Unsorted / Sorted vector */
|
||||
opus_int *idx, /* O Index vector for the sorted elements */
|
||||
const opus_int L, /* I Vector length */
|
||||
const opus_int K /* I Number of correctly sorted positions */
|
||||
);
|
||||
|
||||
/* Compute reflection coefficients from input signal */
|
||||
silk_float silk_burg_modified_FLP( /* O returns residual energy */
|
||||
silk_float A[], /* O prediction coefficients (length order) */
|
||||
const silk_float x[], /* I input signal, length: nb_subfr*(D+L_sub) */
|
||||
const opus_int subfr_length, /* I input signal subframe length (including D preceeding samples) */
|
||||
const opus_int subfr_length, /* I input signal subframe length (incl. D preceeding samples) */
|
||||
const opus_int nb_subfr, /* I number of subframes stacked in x */
|
||||
const silk_float WhiteNoiseFrac, /* I fraction added to zero-lag autocorrelation */
|
||||
const opus_int D /* I order */
|
||||
|
@ -153,21 +146,23 @@ double silk_energy_FLP(
|
|||
/* MACROS */
|
||||
/********************************************************************/
|
||||
|
||||
#define silk_min_float(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define silk_max_float(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define silk_abs_float(a) ((silk_float)fabs(a))
|
||||
#define PI (3.1415926536f)
|
||||
|
||||
#define silk_LIMIT_float( a, limit1, limit2) ((limit1) > (limit2) ? ((a) > (limit1) ? (limit1) : ((a) < (limit2) ? (limit2) : (a))) \
|
||||
#define silk_min_float( a, b ) (((a) < (b)) ? (a) : (b))
|
||||
#define silk_max_float( a, b ) (((a) > (b)) ? (a) : (b))
|
||||
#define silk_abs_float( a ) ((silk_float)fabs(a))
|
||||
|
||||
#define silk_LIMIT_float( a, limit1, limit2 ) ((limit1) > (limit2) ? ((a) > (limit1) ? (limit1) : ((a) < (limit2) ? (limit2) : (a))) \
|
||||
: ((a) > (limit2) ? (limit2) : ((a) < (limit1) ? (limit1) : (a))))
|
||||
|
||||
/* sigmoid function */
|
||||
static inline silk_float silk_sigmoid(silk_float x)
|
||||
static inline silk_float silk_sigmoid( silk_float x )
|
||||
{
|
||||
return (silk_float)(1.0 / (1.0 + exp(-x)));
|
||||
}
|
||||
|
||||
/* floating-point to integer conversion (rounding) */
|
||||
static inline opus_int32 silk_float2int(double x)
|
||||
static inline opus_int32 silk_float2int( double x )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
double t = x + 6755399441055744.0;
|
||||
|
@ -185,7 +180,7 @@ static inline void silk_float2short_array(
|
|||
)
|
||||
{
|
||||
opus_int32 k;
|
||||
for (k = length-1; k >= 0; k--) {
|
||||
for( k = length - 1; k >= 0; k-- ) {
|
||||
#ifdef _WIN32
|
||||
double t = in[k] + 6755399441055744.0;
|
||||
out[k] = (opus_int16)silk_SAT16(*(( opus_int32 * )( &t )));
|
||||
|
@ -204,13 +199,16 @@ static inline void silk_short2float_array(
|
|||
)
|
||||
{
|
||||
opus_int32 k;
|
||||
for (k = length-1; k >= 0; k--) {
|
||||
for( k = length - 1; k >= 0; k-- ) {
|
||||
out[k] = (silk_float)in[k];
|
||||
}
|
||||
}
|
||||
|
||||
/* using log2() helps the fixed-point conversion */
|
||||
static inline silk_float silk_log2( double x ) { return ( silk_float )( 3.32192809488736 * log10( x ) ); }
|
||||
static inline silk_float silk_log2( double x )
|
||||
{
|
||||
return ( silk_float )( 3.32192809488736 * log10( x ) );
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "main_FLP.h"
|
||||
|
||||
/* Apply sine window to signal vector. */
|
||||
/* Apply sine window to signal vector */
|
||||
/* Window types: */
|
||||
/* 1 -> sine window from 0 to pi/2 */
|
||||
/* 2 -> sine window from pi/2 to pi */
|
||||
|
|
|
@ -42,7 +42,7 @@ void silk_autocorrelation_FLP(
|
|||
{
|
||||
opus_int i;
|
||||
|
||||
if ( correlationCount > inputDataSize ) {
|
||||
if( correlationCount > inputDataSize ) {
|
||||
correlationCount = inputDataSize;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
silk_float silk_burg_modified_FLP( /* O returns residual energy */
|
||||
silk_float A[], /* O prediction coefficients (length order) */
|
||||
const silk_float x[], /* I input signal, length: nb_subfr*(D+L_sub) */
|
||||
const opus_int subfr_length, /* I input signal subframe length (including D preceeding samples) */
|
||||
const opus_int subfr_length, /* I input signal subframe length (incl. D preceeding samples) */
|
||||
const opus_int nb_subfr, /* I number of subframes stacked in x */
|
||||
const silk_float WhiteNoiseFrac, /* I fraction added to zero-lag autocorrelation */
|
||||
const opus_int D /* I order */
|
||||
|
|
|
@ -31,7 +31,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "SigProc_FLP.h"
|
||||
|
||||
|
||||
/* Chirp (bw expand) LP AR filter */
|
||||
void silk_bwexpander_FLP(
|
||||
silk_float *ar, /* I/O AR filter to be expanded (without leading 1) */
|
||||
|
|
|
@ -47,9 +47,7 @@ void silk_encode_do_VAD_FLP(
|
|||
/****************************/
|
||||
/* Voice Activity Detection */
|
||||
/****************************/
|
||||
TIC(VAD)
|
||||
silk_VAD_GetSA_Q8( &psEnc->sCmn, psEnc->sCmn.inputBuf + 1 );
|
||||
TOC(VAD)
|
||||
|
||||
/**************************************************/
|
||||
/* Convert speech activity into VAD and DTX flags */
|
||||
|
@ -80,7 +78,7 @@ TOC(VAD)
|
|||
/****************/
|
||||
opus_int silk_encode_frame_FLP(
|
||||
silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */
|
||||
opus_int32 *pnBytesOut, /* O Number of payload bytes */
|
||||
opus_int32 *pnBytesOut, /* O Number of payload bytes; */
|
||||
ec_enc *psRangeEnc, /* I/O compressor data structure */
|
||||
opus_int condCoding, /* I The type of conditional coding to use */
|
||||
opus_int maxBits, /* I If > 0: maximum number of output bits */
|
||||
|
@ -103,10 +101,7 @@ opus_int silk_encode_frame_FLP(
|
|||
opus_int32 pGains_Q16[ MAX_NB_SUBFR ];
|
||||
opus_uint8 ec_buf_copy[ 1275 ];
|
||||
|
||||
TIC(ENCODE_FRAME)
|
||||
|
||||
/* This is totally unnecessary but many compilers (including gcc) are too dumb
|
||||
to realise it */
|
||||
/* This is totally unnecessary but many compilers (including gcc) are too dumb to realise it */
|
||||
LastGainIndex_copy2 = nBits_lower = nBits_upper = gainMult_lower = gainMult_upper = 0;
|
||||
|
||||
psEnc->sCmn.indices.Seed = psEnc->sCmn.frameCounter++ & 3;
|
||||
|
@ -136,50 +131,35 @@ TIC(ENCODE_FRAME)
|
|||
/*****************************************/
|
||||
/* Find pitch lags, initial LPC analysis */
|
||||
/*****************************************/
|
||||
TIC(FIND_PITCH)
|
||||
silk_find_pitch_lags_FLP( psEnc, &sEncCtrl, res_pitch, x_frame );
|
||||
TOC(FIND_PITCH)
|
||||
|
||||
/************************/
|
||||
/* Noise shape analysis */
|
||||
/************************/
|
||||
TIC(NOISE_SHAPE_ANALYSIS)
|
||||
silk_noise_shape_analysis_FLP( psEnc, &sEncCtrl, res_pitch_frame, x_frame );
|
||||
TOC(NOISE_SHAPE_ANALYSIS)
|
||||
|
||||
/***************************************************/
|
||||
/* Find linear prediction coefficients (LPC + LTP) */
|
||||
/***************************************************/
|
||||
TIC(FIND_PRED_COEF)
|
||||
silk_find_pred_coefs_FLP( psEnc, &sEncCtrl, res_pitch, x_frame, condCoding );
|
||||
TOC(FIND_PRED_COEF)
|
||||
|
||||
/****************************************/
|
||||
/* Process gains */
|
||||
/****************************************/
|
||||
TIC(PROCESS_GAINS)
|
||||
silk_process_gains_FLP( psEnc, &sEncCtrl, condCoding );
|
||||
TOC(PROCESS_GAINS)
|
||||
|
||||
/*****************************************/
|
||||
/* Prefiltering for noise shaper */
|
||||
/*****************************************/
|
||||
TIC(PREFILTER)
|
||||
silk_prefilter_FLP( psEnc, &sEncCtrl, xfw, x_frame );
|
||||
TOC(PREFILTER)
|
||||
|
||||
/****************************************/
|
||||
/* Low Bitrate Redundant Encoding */
|
||||
/****************************************/
|
||||
TIC(LBRR)
|
||||
silk_LBRR_encode_FLP( psEnc, &sEncCtrl, xfw, condCoding );
|
||||
TOC(LBRR)
|
||||
|
||||
if ( psEnc->sCmn.prefillFlag )
|
||||
{
|
||||
TIC(NSQ)
|
||||
if( psEnc->sCmn.prefillFlag ) {
|
||||
silk_NSQ_wrapper_FLP( psEnc, &sEncCtrl, &psEnc->sCmn.indices, &psEnc->sCmn.sNSQ, psEnc->sCmn.pulses, xfw );
|
||||
TOC(NSQ)
|
||||
} else {
|
||||
/* Loop over quantizer and entroy coding to control bitrate */
|
||||
maxIter = 5;
|
||||
|
@ -213,24 +193,18 @@ TOC(NSQ)
|
|||
/*****************************************/
|
||||
/* Noise shaping quantization */
|
||||
/*****************************************/
|
||||
TIC(NSQ)
|
||||
silk_NSQ_wrapper_FLP( psEnc, &sEncCtrl, &psEnc->sCmn.indices, &psEnc->sCmn.sNSQ, psEnc->sCmn.pulses, xfw );
|
||||
TOC(NSQ)
|
||||
|
||||
/****************************************/
|
||||
/* Encode Parameters */
|
||||
/****************************************/
|
||||
TIC(ENCODE_PARAMS)
|
||||
silk_encode_indices( &psEnc->sCmn, psRangeEnc, psEnc->sCmn.nFramesEncoded, 0, condCoding );
|
||||
TOC(ENCODE_PARAMS)
|
||||
|
||||
/****************************************/
|
||||
/* Encode Excitation Signal */
|
||||
/****************************************/
|
||||
TIC(ENCODE_PULSES)
|
||||
silk_encode_pulses( psRangeEnc, psEnc->sCmn.indices.signalType, psEnc->sCmn.indices.quantOffsetType,
|
||||
psEnc->sCmn.pulses, psEnc->sCmn.frame_length );
|
||||
TOC(ENCODE_PULSES)
|
||||
|
||||
nBits = ec_tell( psRangeEnc );
|
||||
|
||||
|
@ -343,23 +317,6 @@ TOC(ENCODE_PULSES)
|
|||
/* Payload size */
|
||||
*pnBytesOut = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
|
||||
|
||||
TOC(ENCODE_FRAME)
|
||||
|
||||
#ifdef SAVE_ALL_INTERNAL_DATA
|
||||
DEBUG_STORE_DATA( pitchL.dat, sEncCtrl.pitchL, MAX_NB_SUBFR * sizeof( opus_int ) );
|
||||
DEBUG_STORE_DATA( pitchG_quantized.dat, sEncCtrl.LTPCoef, psEnc->sCmn.nb_subfr * LTP_ORDER * sizeof( silk_float ) );
|
||||
DEBUG_STORE_DATA( LTPcorr.dat, &psEnc->LTPCorr, sizeof( silk_float ) );
|
||||
DEBUG_STORE_DATA( gains.dat, sEncCtrl.Gains, psEnc->sCmn.nb_subfr * sizeof( silk_float ) );
|
||||
DEBUG_STORE_DATA( gains_indices.dat, &psEnc->sCmn.indices.GainsIndices, psEnc->sCmn.nb_subfr * sizeof( opus_int8 ) );
|
||||
DEBUG_STORE_DATA( quantOffsetType.dat, &psEnc->sCmn.indices.quantOffsetType, sizeof( opus_int8 ) );
|
||||
DEBUG_STORE_DATA( speech_activity_q8.dat, &psEnc->sCmn.speech_activity_Q8, sizeof( opus_int ) );
|
||||
DEBUG_STORE_DATA( signalType.dat, &psEnc->sCmn.indices.signalType, sizeof( opus_int8 ) );
|
||||
DEBUG_STORE_DATA( lag_index.dat, &psEnc->sCmn.indices.lagIndex, sizeof( opus_int16 ) );
|
||||
DEBUG_STORE_DATA( contour_index.dat, &psEnc->sCmn.indices.contourIndex, sizeof( opus_int8 ) );
|
||||
DEBUG_STORE_DATA( per_index.dat, &psEnc->sCmn.indices.PERIndex, sizeof( opus_int8 ) );
|
||||
DEBUG_STORE_DATA( PredCoef.dat, &sEncCtrl.PredCoef[ 1 ], psEnc->sCmn.predictLPCOrder * sizeof( silk_float ) );
|
||||
DEBUG_STORE_DATA( ltp_scale_idx.dat, &psEnc->sCmn.indices.LTP_scaleIndex, sizeof( opus_int8 ) );
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ void silk_find_LPC_FLP(
|
|||
const opus_int LPC_order, /* I LPC order */
|
||||
const silk_float x[], /* I Input signal */
|
||||
const opus_int subfr_length, /* I Subframe length incl preceeding samples */
|
||||
const opus_int nb_subfr /* I: Number of subframes */
|
||||
const opus_int nb_subfr /* I Number of subframes */
|
||||
)
|
||||
{
|
||||
opus_int k;
|
||||
|
|
|
@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "main_FLP.h"
|
||||
|
||||
|
||||
/* Find LPC and LTP coefficients */
|
||||
void silk_find_pred_coefs_FLP(
|
||||
silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */
|
||||
silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */
|
||||
|
@ -64,11 +64,6 @@ void silk_find_pred_coefs_FLP(
|
|||
silk_find_LTP_FLP( psEncCtrl->LTPCoef, WLTP, &psEncCtrl->LTPredCodGain, res_pitch,
|
||||
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 ) );
|
||||
#endif
|
||||
|
||||
/* Quantize LTP gain parameters */
|
||||
silk_quant_LTP_gains_FLP( psEncCtrl->LTPCoef, psEnc->sCmn.indices.LTPIndex, &psEnc->sCmn.indices.PERIndex,
|
||||
WLTP, psEnc->sCmn.mu_LTP_Q9, psEnc->sCmn.LTPQuantLowComplexity, psEnc->sCmn.nb_subfr );
|
||||
|
@ -104,9 +99,7 @@ void silk_find_pred_coefs_FLP(
|
|||
LPC_in_pre, psEnc->sCmn.subfr_length + psEnc->sCmn.predictLPCOrder, psEnc->sCmn.nb_subfr );
|
||||
|
||||
/* Quantize LSFs */
|
||||
TIC(LSF_quant);
|
||||
silk_process_NLSFs_FLP( &psEnc->sCmn, psEncCtrl->PredCoef, NLSF_Q15, psEnc->sCmn.prev_NLSFq_Q15 );
|
||||
TOC(LSF_quant);
|
||||
|
||||
/* Calculate residual energy using quantized LPC coefficients */
|
||||
silk_residual_energy_FLP( psEncCtrl->ResNrg, LPC_in_pre, psEncCtrl->PredCoef, psEncCtrl->Gains,
|
||||
|
|
|
@ -32,10 +32,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "SigProc_FLP.h"
|
||||
|
||||
/* inner product of two silk_float arrays, with result as double */
|
||||
double silk_inner_product_FLP( /* O result */
|
||||
const silk_float *data1, /* I vector 1 */
|
||||
const silk_float *data2, /* I vector 2 */
|
||||
opus_int dataSize /* I length of vectors */
|
||||
double silk_inner_product_FLP(
|
||||
const silk_float *data1,
|
||||
const silk_float *data2,
|
||||
opus_int dataSize
|
||||
)
|
||||
{
|
||||
opus_int i, dataSize4;
|
||||
|
|
|
@ -33,16 +33,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* step up function, converts reflection coefficients to prediction coefficients */
|
||||
void silk_k2a_FLP(
|
||||
silk_float *A, /* O: prediction coefficients [order] */
|
||||
const silk_float *rc, /* I: reflection coefficients [order] */
|
||||
opus_int32 order /* I: prediction order */
|
||||
silk_float *A, /* O prediction coefficients [order] */
|
||||
const silk_float *rc, /* I reflection coefficients [order] */
|
||||
opus_int32 order /* I prediction order */
|
||||
)
|
||||
{
|
||||
opus_int k, n;
|
||||
silk_float Atmp[ SILK_MAX_ORDER_LPC ];
|
||||
|
||||
for( k = 0; k < order; k++ ){
|
||||
for( n = 0; n < k; n++ ){
|
||||
for( k = 0; k < order; k++ ) {
|
||||
for( n = 0; n < k; n++ ) {
|
||||
Atmp[ n ] = A[ n ];
|
||||
}
|
||||
for( n = 0; n < k; n++ ) {
|
||||
|
|
|
@ -77,7 +77,7 @@ opus_int silk_init_encoder(
|
|||
/* Control the Silk encoder */
|
||||
opus_int silk_control_encoder(
|
||||
silk_encoder_state_FLP *psEnc, /* I/O Pointer to Silk encoder state FLP */
|
||||
silk_EncControlStruct *encControl, /* I: Control structure */
|
||||
silk_EncControlStruct *encControl, /* I Control structure */
|
||||
const opus_int32 TargetRate_bps, /* I Target max bitrate (bps) */
|
||||
const opus_int allow_bw_switch, /* I Flag to allow switching audio bandwidth */
|
||||
const opus_int channelNb, /* I Channel number */
|
||||
|
@ -151,7 +151,7 @@ void silk_find_LPC_FLP(
|
|||
const opus_int LPC_order, /* I LPC order */
|
||||
const silk_float x[], /* I Input signal */
|
||||
const opus_int subfr_length, /* I Subframe length incl preceeding samples */
|
||||
const opus_int nb_subfr /* I: Number of subframes */
|
||||
const opus_int nb_subfr /* I Number of subframes */
|
||||
);
|
||||
|
||||
/* LTP analysis */
|
||||
|
@ -183,7 +183,7 @@ void silk_LTP_analysis_filter_FLP(
|
|||
void silk_residual_energy_FLP(
|
||||
silk_float nrgs[ MAX_NB_SUBFR ], /* O Residual energy per subframe */
|
||||
const silk_float x[], /* I Input signal */
|
||||
silk_float a[ 2 ][ MAX_LPC_ORDER ],/* I AR coefs for each frame half */
|
||||
silk_float a[ 2 ][ MAX_LPC_ORDER ], /* I AR coefs for each frame half */
|
||||
const silk_float gains[], /* I Quantization gains */
|
||||
const opus_int subfr_length, /* I Subframe length */
|
||||
const opus_int nb_subfr, /* I number of subframes */
|
||||
|
@ -210,17 +210,6 @@ void silk_quant_LTP_gains_FLP(
|
|||
const opus_int nb_subfr /* I number of subframes */
|
||||
);
|
||||
|
||||
/******************/
|
||||
/* NLSF Quantizer */
|
||||
/******************/
|
||||
/* Limit, stabilize, and quantize NLSFs */
|
||||
void silk_process_NLSFs_FLP(
|
||||
silk_encoder_state *psEncC, /* I/O Encoder state */
|
||||
silk_float PredCoef[ 2 ][ MAX_LPC_ORDER ], /* O Prediction coefficients */
|
||||
opus_int16 NLSF_Q15[ MAX_LPC_ORDER ], /* I/O Normalized LSFs (quant out) (0 - (2^15-1)) */
|
||||
const opus_int16 prev_NLSF_Q15[ MAX_LPC_ORDER ] /* I Previous Normalized LSFs (0 - (2^15-1)) */
|
||||
);
|
||||
|
||||
/* Residual energy: nrg = wxx - 2 * wXx * c + c' * wXX * c */
|
||||
silk_float silk_residual_energy_covar_FLP( /* O Weighted residual energy */
|
||||
const silk_float *c, /* I Filter coefficients */
|
||||
|
@ -230,18 +219,6 @@ silk_float silk_residual_energy_covar_FLP( /* O Weighted residual e
|
|||
const opus_int D /* I Dimension */
|
||||
);
|
||||
|
||||
/* Entropy constrained MATRIX-weighted VQ, for a single input data vector */
|
||||
void silk_VQ_WMat_EC_FLP(
|
||||
opus_int *ind, /* O Index of best codebook vector */
|
||||
silk_float *rate_dist, /* O Best weighted quant. error + mu * rate */
|
||||
const silk_float *in, /* I Input vector to be quantized */
|
||||
const silk_float *W, /* I Weighting matrix */
|
||||
const opus_int16 *cb, /* I Codebook */
|
||||
const opus_int16 *cl_Q6, /* I Code length for each codebook vector */
|
||||
const silk_float mu, /* I Tradeoff between WSSE and rate */
|
||||
const opus_int L /* I Number of vectors in codebook */
|
||||
);
|
||||
|
||||
/* Processing of gains */
|
||||
void silk_process_gains_FLP(
|
||||
silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */
|
||||
|
@ -312,9 +289,15 @@ void silk_NLSF2A_FLP(
|
|||
const opus_int LPC_order /* I LPC order */
|
||||
);
|
||||
|
||||
/****************************************/
|
||||
/* Limit, stabilize, and quantize NLSFs */
|
||||
void silk_process_NLSFs_FLP(
|
||||
silk_encoder_state *psEncC, /* I/O Encoder state */
|
||||
silk_float PredCoef[ 2 ][ MAX_LPC_ORDER ], /* O Prediction coefficients */
|
||||
opus_int16 NLSF_Q15[ MAX_LPC_ORDER ], /* I/O Normalized LSFs (quant out) (0 - (2^15-1)) */
|
||||
const opus_int16 prev_NLSF_Q15[ MAX_LPC_ORDER ] /* I Previous Normalized LSFs (0 - (2^15-1)) */
|
||||
);
|
||||
|
||||
/* Floating-point Silk NSQ wrapper */
|
||||
/****************************************/
|
||||
void silk_NSQ_wrapper_FLP(
|
||||
silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */
|
||||
silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */
|
||||
|
|
|
@ -30,19 +30,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Pitch analyser function
|
||||
*
|
||||
******************************************************************************/
|
||||
#include "SigProc_FLP.h"
|
||||
#include "SigProc_FIX.h"
|
||||
#include "pitch_est_defines.h"
|
||||
|
||||
#define SCRATCH_SIZE 22
|
||||
|
||||
/************************************************************/
|
||||
/* Definitions */
|
||||
/************************************************************/
|
||||
#define eps 1.192092896e-07f
|
||||
|
||||
/************************************************************/
|
||||
|
@ -66,23 +60,21 @@ static void silk_P_Ana_calc_energy_st3(
|
|||
opus_int complexity /* I Complexity setting */
|
||||
);
|
||||
|
||||
/*
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% CORE PITCH ANALYSIS FUNCTION %
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
*/
|
||||
opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoiced */
|
||||
const silk_float *frame, /* I signal of length PE_FRAME_LENGTH_MS*Fs_kHz */
|
||||
opus_int *pitch_out, /* O 4 pitch lag values */
|
||||
opus_int16 *lagIndex, /* O lag Index */
|
||||
opus_int8 *contourIndex, /* O pitch contour Index */
|
||||
silk_float *LTPCorr, /* I/O normalized correlation; input: value from previous frame */
|
||||
opus_int prevLag, /* I last lag of previous frame; set to zero is unvoiced */
|
||||
const silk_float search_thres1, /* I first stage threshold for lag candidates 0 - 1 */
|
||||
const silk_float search_thres2, /* I final threshold for lag candidates 0 - 1 */
|
||||
/************************************************************/
|
||||
/* CORE PITCH ANALYSIS FUNCTION */
|
||||
/************************************************************/
|
||||
opus_int silk_pitch_analysis_core_FLP( /* O Voicing estimate: 0 voiced, 1 unvoiced */
|
||||
const silk_float *frame, /* I Signal of length PE_FRAME_LENGTH_MS*Fs_kHz */
|
||||
opus_int *pitch_out, /* O Pitch lag values [nb_subfr] */
|
||||
opus_int16 *lagIndex, /* O Lag Index */
|
||||
opus_int8 *contourIndex, /* O Pitch contour Index */
|
||||
silk_float *LTPCorr, /* I/O Normalized correlation; input: value from previous frame */
|
||||
opus_int prevLag, /* I Last lag of previous frame; set to zero is unvoiced */
|
||||
const silk_float search_thres1, /* I First stage threshold for lag candidates 0 - 1 */
|
||||
const silk_float search_thres2, /* I Final threshold for lag candidates 0 - 1 */
|
||||
const opus_int Fs_kHz, /* I sample frequency (kHz) */
|
||||
const opus_int complexity, /* I Complexity setting, 0-2, where 2 is highest */
|
||||
const opus_int nb_subfr /* I number of 5 ms subframes */
|
||||
const opus_int nb_subfr /* I Number of 5 ms subframes */
|
||||
)
|
||||
{
|
||||
opus_int i, k, d, j;
|
||||
|
@ -117,8 +109,8 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic
|
|||
silk_assert( Fs_kHz == 8 || Fs_kHz == 12 || Fs_kHz == 16 );
|
||||
|
||||
/* Check for valid complexity setting */
|
||||
silk_assert( complexity >= SigProc_PE_MIN_COMPLEX );
|
||||
silk_assert( complexity <= SigProc_PE_MAX_COMPLEX );
|
||||
silk_assert( complexity >= SILK_PE_MIN_COMPLEX );
|
||||
silk_assert( complexity <= SILK_PE_MAX_COMPLEX );
|
||||
|
||||
silk_assert( search_thres1 >= 0.0f && search_thres1 <= 1.0f );
|
||||
silk_assert( search_thres2 >= 0.0f && search_thres2 <= 1.0f );
|
||||
|
@ -301,7 +293,7 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic
|
|||
basis_ptr = target_ptr - d;
|
||||
cross_corr = silk_inner_product_FLP( basis_ptr, target_ptr, sf_length_8kHz );
|
||||
energy = silk_energy_FLP( basis_ptr, sf_length_8kHz );
|
||||
if (cross_corr > 0.0f) {
|
||||
if( cross_corr > 0.0f ) {
|
||||
C[ k ][ d ] = (silk_float)(cross_corr * cross_corr / (energy * energy_tmp + eps));
|
||||
} else {
|
||||
C[ k ][ d ] = 0.0f;
|
||||
|
@ -334,7 +326,7 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic
|
|||
if( nb_subfr == PE_MAX_NB_SUBFR ) {
|
||||
cbk_size = PE_NB_CBKS_STAGE2_EXT;
|
||||
Lag_CB_ptr = &silk_CB_lags_stage2[ 0 ][ 0 ];
|
||||
if( Fs_kHz == 8 && complexity > SigProc_PE_MIN_COMPLEX ) {
|
||||
if( Fs_kHz == 8 && complexity > SILK_PE_MIN_COMPLEX ) {
|
||||
/* If input is 8 khz use a larger codebook here because it is last stage */
|
||||
nb_cbk_search = PE_NB_CBKS_STAGE2_EXT;
|
||||
} else {
|
||||
|
@ -372,13 +364,13 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic
|
|||
CCmax_new_b -= PE_SHORTLAG_BIAS * nb_subfr * lag_log2;
|
||||
|
||||
/* Bias towards previous lag */
|
||||
if ( prevLag > 0 ) {
|
||||
if( prevLag > 0 ) {
|
||||
delta_lag_log2_sqr = lag_log2 - prevLag_log2;
|
||||
delta_lag_log2_sqr *= delta_lag_log2_sqr;
|
||||
CCmax_new_b -= PE_PREVLAG_BIAS * nb_subfr * (*LTPCorr) * delta_lag_log2_sqr / (delta_lag_log2_sqr + 0.5f);
|
||||
}
|
||||
|
||||
if ( CCmax_new_b > CCmax_b && /* Find maximum biased correlation */
|
||||
if( CCmax_new_b > CCmax_b && /* Find maximum biased correlation */
|
||||
CCmax_new > nb_subfr * search_thres2 * search_thres2 && /* Correlation needs to be high enough to be voiced */
|
||||
silk_CB_lags_stage2[ 0 ][ CBimax_new ] <= min_lag_8kHz /* Lag must be in range */
|
||||
) {
|
||||
|
@ -515,10 +507,10 @@ static void silk_P_Ana_calc_corr_st3(
|
|||
silk_float scratch_mem[ SCRATCH_SIZE ];
|
||||
const opus_int8 *Lag_range_ptr, *Lag_CB_ptr;
|
||||
|
||||
silk_assert( complexity >= SigProc_PE_MIN_COMPLEX );
|
||||
silk_assert( complexity <= SigProc_PE_MAX_COMPLEX );
|
||||
silk_assert( complexity >= SILK_PE_MIN_COMPLEX );
|
||||
silk_assert( complexity <= SILK_PE_MAX_COMPLEX );
|
||||
|
||||
if( nb_subfr == PE_MAX_NB_SUBFR ){
|
||||
if( nb_subfr == PE_MAX_NB_SUBFR ) {
|
||||
Lag_range_ptr = &silk_Lag_range_stage3[ complexity ][ 0 ][ 0 ];
|
||||
Lag_CB_ptr = &silk_CB_lags_stage3[ 0 ][ 0 ];
|
||||
nb_cbk_search = silk_nb_cbk_searchs_stage3[ complexity ];
|
||||
|
@ -580,10 +572,10 @@ calculated recursively.
|
|||
silk_float scratch_mem[ SCRATCH_SIZE ];
|
||||
const opus_int8 *Lag_range_ptr, *Lag_CB_ptr;
|
||||
|
||||
silk_assert( complexity >= SigProc_PE_MIN_COMPLEX );
|
||||
silk_assert( complexity <= SigProc_PE_MAX_COMPLEX );
|
||||
silk_assert( complexity >= SILK_PE_MIN_COMPLEX );
|
||||
silk_assert( complexity <= SILK_PE_MAX_COMPLEX );
|
||||
|
||||
if( nb_subfr == PE_MAX_NB_SUBFR ){
|
||||
if( nb_subfr == PE_MAX_NB_SUBFR ) {
|
||||
Lag_range_ptr = &silk_Lag_range_stage3[ complexity ][ 0 ][ 0 ];
|
||||
Lag_CB_ptr = &silk_CB_lags_stage3[ 0 ][ 0 ];
|
||||
nb_cbk_search = silk_nb_cbk_searchs_stage3[ complexity ];
|
||||
|
|
|
@ -33,10 +33,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "tuning_parameters.h"
|
||||
|
||||
/*
|
||||
* silk_prefilter. Prefilter for finding Quantizer input signal
|
||||
* Prefilter for finding Quantizer input signal
|
||||
*/
|
||||
static inline void silk_prefilt_FLP(
|
||||
silk_prefilter_state_FLP *P,/* I/O state */
|
||||
silk_prefilter_state_FLP *P, /* I/O state */
|
||||
silk_float st_res[], /* I */
|
||||
silk_float xw[], /* O */
|
||||
silk_float *HarmShapeFIR, /* I */
|
||||
|
@ -154,7 +154,7 @@ void silk_prefilter_FLP(
|
|||
* Prefilter for finding Quantizer input signal
|
||||
*/
|
||||
static inline void silk_prefilt_FLP(
|
||||
silk_prefilter_state_FLP *P,/* I/O state */
|
||||
silk_prefilter_state_FLP *P, /* I/O state */
|
||||
silk_float st_res[], /* I */
|
||||
silk_float xw[], /* O */
|
||||
silk_float *HarmShapeFIR, /* I */
|
||||
|
|
|
@ -31,6 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "main_FLP.h"
|
||||
|
||||
/* Add noise to matrix diagonal */
|
||||
void silk_regularize_correlations_FLP(
|
||||
silk_float *XX, /* I/O Correlation matrices */
|
||||
silk_float *xx, /* I/O Correlation values */
|
||||
|
|
|
@ -33,7 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
silk_float silk_schur_FLP( /* O returns residual energy */
|
||||
silk_float refl_coef[], /* O reflection coefficients (length order) */
|
||||
const silk_float auto_corr[], /* I autotcorrelation sequence (length order+1) */
|
||||
const silk_float auto_corr[], /* I autocorrelation sequence (length order+1) */
|
||||
opus_int order /* I order */
|
||||
)
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ silk_float silk_schur_FLP( /* O returns residual energy
|
|||
refl_coef[ k ] = rc_tmp;
|
||||
|
||||
/* Update correlations */
|
||||
for( n = 0; n < order - k; n++ ){
|
||||
for( n = 0; n < order - k; n++ ) {
|
||||
Ctmp1 = C[ n + k + 1 ][ 0 ];
|
||||
Ctmp2 = C[ n ][ 1 ];
|
||||
C[ n + k + 1 ][ 0 ] = Ctmp1 + Ctmp2 * rc_tmp;
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../;../fixed;../../win32;../../celt</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../;../fixed;../../win32;../../celt;../../include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -70,7 +70,7 @@
|
|||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../;../fixed;../../win32;../../celt</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../;../fixed;../../win32;../../celt;../../include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -119,6 +119,7 @@
|
|||
<ClCompile Include="wrappers_FLP.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\opus_types.h" />
|
||||
<ClInclude Include="..\..\win32\config.h" />
|
||||
<ClInclude Include="main_FLP.h" />
|
||||
<ClInclude Include="SigProc_FLP.h" />
|
||||
|
|
|
@ -125,5 +125,8 @@
|
|||
<ClInclude Include="structs_FLP.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\opus_types.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -38,10 +38,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
* the symmetric matric A is given by A = L*D*L'.
|
||||
**********************************************************************/
|
||||
static inline void silk_LDL_FLP(
|
||||
silk_float *A, /* (I/O) Pointer to Symetric Square Matrix */
|
||||
opus_int M, /* (I) Size of Matrix */
|
||||
silk_float *L, /* (I/O) Pointer to Square Upper triangular Matrix */
|
||||
silk_float *Dinv /* (I/O) Pointer to vector holding the inverse diagonal elements of D */
|
||||
silk_float *A, /* I/O Pointer to Symetric Square Matrix */
|
||||
opus_int M, /* I Size of Matrix */
|
||||
silk_float *L, /* I/O Pointer to Square Upper triangular Matrix */
|
||||
silk_float *Dinv /* I/O Pointer to vector holding the inverse diagonal elements of D */
|
||||
);
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -49,10 +49,10 @@ static inline void silk_LDL_FLP(
|
|||
* triangular matrix, with ones on the diagonal.
|
||||
**********************************************************************/
|
||||
static inline void silk_SolveWithLowerTriangularWdiagOnes_FLP(
|
||||
const silk_float *L, /* (I) Pointer to Lower Triangular Matrix */
|
||||
opus_int M, /* (I) Dim of Matrix equation */
|
||||
const silk_float *b, /* (I) b Vector */
|
||||
silk_float *x /* (O) x Vector */
|
||||
const silk_float *L, /* I Pointer to Lower Triangular Matrix */
|
||||
opus_int M, /* I Dim of Matrix equation */
|
||||
const silk_float *b, /* I b Vector */
|
||||
silk_float *x /* O x Vector */
|
||||
);
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -60,10 +60,10 @@ static inline void silk_SolveWithLowerTriangularWdiagOnes_FLP(
|
|||
* triangular, with ones on the diagonal. (ie then A^T is upper triangular)
|
||||
**********************************************************************/
|
||||
static inline void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP(
|
||||
const silk_float *L, /* (I) Pointer to Lower Triangular Matrix */
|
||||
opus_int M, /* (I) Dim of Matrix equation */
|
||||
const silk_float *b, /* (I) b Vector */
|
||||
silk_float *x /* (O) x Vector */
|
||||
const silk_float *L, /* I Pointer to Lower Triangular Matrix */
|
||||
opus_int M, /* I Dim of Matrix equation */
|
||||
const silk_float *b, /* I b Vector */
|
||||
silk_float *x /* O x Vector */
|
||||
);
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -110,10 +110,10 @@ void silk_solve_LDL_FLP(
|
|||
}
|
||||
|
||||
static inline void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP(
|
||||
const silk_float *L, /* (I) Pointer to Lower Triangular Matrix */
|
||||
opus_int M, /* (I) Dim of Matrix equation */
|
||||
const silk_float *b, /* (I) b Vector */
|
||||
silk_float *x /* (O) x Vector */
|
||||
const silk_float *L, /* I Pointer to Lower Triangular Matrix */
|
||||
opus_int M, /* I Dim of Matrix equation */
|
||||
const silk_float *b, /* I b Vector */
|
||||
silk_float *x /* O x Vector */
|
||||
)
|
||||
{
|
||||
opus_int i, j;
|
||||
|
@ -132,10 +132,10 @@ static inline void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP(
|
|||
}
|
||||
|
||||
static inline void silk_SolveWithLowerTriangularWdiagOnes_FLP(
|
||||
const silk_float *L, /* (I) Pointer to Lower Triangular Matrix */
|
||||
opus_int M, /* (I) Dim of Matrix equation */
|
||||
const silk_float *b, /* (I) b Vector */
|
||||
silk_float *x /* (O) x Vector */
|
||||
const silk_float *L, /* I Pointer to Lower Triangular Matrix */
|
||||
opus_int M, /* I Dim of Matrix equation */
|
||||
const silk_float *b, /* I b Vector */
|
||||
silk_float *x /* O x Vector */
|
||||
)
|
||||
{
|
||||
opus_int i, j;
|
||||
|
@ -154,10 +154,10 @@ static inline void silk_SolveWithLowerTriangularWdiagOnes_FLP(
|
|||
}
|
||||
|
||||
static inline void silk_LDL_FLP(
|
||||
silk_float *A, /* (I/O) Pointer to Symetric Square Matrix */
|
||||
opus_int M, /* (I) Size of Matrix */
|
||||
silk_float *L, /* (I/O) Pointer to Square Upper triangular Matrix */
|
||||
silk_float *Dinv /* (I/O) Pointer to vector holding the inverse diagonal elements of D */
|
||||
silk_float *A, /* I/O Pointer to Symetric Square Matrix */
|
||||
opus_int M, /* I Size of Matrix */
|
||||
silk_float *L, /* I/O Pointer to Square Upper triangular Matrix */
|
||||
silk_float *Dinv /* I/O Pointer to vector holding the inverse diagonal elements of D */
|
||||
)
|
||||
{
|
||||
opus_int i, j, k, loop_count, err = 1;
|
||||
|
|
|
@ -37,10 +37,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "SigProc_FLP.h"
|
||||
|
||||
void silk_insertion_sort_decreasing_FLP(
|
||||
silk_float *a, /* I/O: Unsorted / Sorted vector */
|
||||
opus_int *idx, /* O: Index vector for the sorted elements */
|
||||
const opus_int L, /* I: Vector length */
|
||||
const opus_int K /* I: Number of correctly sorted positions */
|
||||
silk_float *a, /* I/O Unsorted / Sorted vector */
|
||||
opus_int *idx, /* O Index vector for the sorted elements */
|
||||
const opus_int L, /* I Vector length */
|
||||
const opus_int K /* I Number of correctly sorted positions */
|
||||
)
|
||||
{
|
||||
silk_float value;
|
||||
|
|
|
@ -39,8 +39,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
/* Initialize Silk Encoder state */
|
||||
/*********************************/
|
||||
opus_int silk_init_encoder(
|
||||
silk_encoder_state_Fxx *psEnc /* I/O Pointer to Silk encoder state */
|
||||
) {
|
||||
silk_encoder_state_Fxx *psEnc /* I/O Pointer to Silk FIX encoder state */
|
||||
)
|
||||
{
|
||||
opus_int ret = 0;
|
||||
|
||||
/* Clear the entire encoder state */
|
||||
|
|
|
@ -32,7 +32,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "SigProc_FIX.h"
|
||||
/* Approximation of 128 * log2() (very close inverse of silk_log2lin()) */
|
||||
/* Convert input to a log scale */
|
||||
opus_int32 silk_lin2log( const opus_int32 inLin ) /* I: Input in linear scale */
|
||||
opus_int32 silk_lin2log(
|
||||
const opus_int32 inLin /* I input in linear scale */
|
||||
)
|
||||
{
|
||||
opus_int32 lz, frac_Q7;
|
||||
|
||||
|
|
|
@ -33,7 +33,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* Approximation of 2^() (very close inverse of silk_lin2log()) */
|
||||
/* Convert input to a linear scale */
|
||||
opus_int32 silk_log2lin( const opus_int32 inLog_Q7 ) /* I: Input on log scale */
|
||||
opus_int32 silk_log2lin(
|
||||
const opus_int32 inLog_Q7 /* I input on log scale */
|
||||
)
|
||||
{
|
||||
opus_int32 out, frac_Q7;
|
||||
|
||||
|
|
75
silk/main.h
75
silk/main.h
|
@ -38,11 +38,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "entenc.h"
|
||||
#include "entdec.h"
|
||||
|
||||
/* Uncomment the next line to store intermadiate data to files */
|
||||
/*#define SAVE_ALL_INTERNAL_DATA 1*/
|
||||
/* Uncomment the next line to force a fixed internal sampling rate (independent of what bitrate is used */
|
||||
/*#define FORCE_INTERNAL_FS_KHZ 16*/
|
||||
|
||||
/* Simple way to make [8000, 12000, 16000, 24000, 48000] to [0,1,2,3,4] */
|
||||
#define rateID(R) ( ( ( ((R)>>12) - ((R)>16000) ) >> ((R)>24000) ) - 1 )
|
||||
|
||||
|
@ -133,13 +128,13 @@ void silk_decode_signs(
|
|||
|
||||
/* Check encoder control struct */
|
||||
opus_int check_control_input(
|
||||
silk_EncControlStruct *encControl /* I: Control structure */
|
||||
silk_EncControlStruct *encControl /* I Control structure */
|
||||
);
|
||||
|
||||
/* Control internal sampling rate */
|
||||
opus_int silk_control_audio_bandwidth(
|
||||
silk_encoder_state *psEncC, /* I/O Pointer to Silk encoder state */
|
||||
silk_EncControlStruct *encControl /* I: Control structure */
|
||||
silk_EncControlStruct *encControl /* I Control structure */
|
||||
);
|
||||
|
||||
/* Control SNR of redidual quantizer */
|
||||
|
@ -221,33 +216,33 @@ void silk_quant_LTP_gains(
|
|||
/* Entropy constrained matrix-weighted VQ, for a single input data vector */
|
||||
void silk_VQ_WMat_EC(
|
||||
opus_int8 *ind, /* O index of best codebook vector */
|
||||
opus_int32 *rate_dist_Q14, /* O best weighted quantization error + mu * rate*/
|
||||
opus_int32 *rate_dist_Q14, /* O best weighted quant error + mu * rate */
|
||||
const opus_int16 *in_Q14, /* I input vector to be quantized */
|
||||
const opus_int32 *W_Q18, /* I weighting matrix */
|
||||
const opus_int8 *cb_Q7, /* I codebook */
|
||||
const opus_uint8 *cl_Q5, /* I code length for each codebook vector */
|
||||
const opus_int mu_Q9, /* I tradeoff between weighted error and rate */
|
||||
const opus_int mu_Q9, /* I tradeoff betw. weighted error and rate */
|
||||
opus_int L /* I number of vectors in codebook */
|
||||
);
|
||||
|
||||
/***********************************/
|
||||
/* Noise shaping quantization (NSQ)*/
|
||||
/***********************************/
|
||||
/************************************/
|
||||
/* Noise shaping quantization (NSQ) */
|
||||
/************************************/
|
||||
void silk_NSQ(
|
||||
const silk_encoder_state *psEncC, /* I/O Encoder State */
|
||||
silk_nsq_state *NSQ, /* I/O NSQ state */
|
||||
SideInfoIndices *psIndices, /* I/O Quantization Indices */
|
||||
const opus_int16 x[], /* I prefiltered input signal */
|
||||
opus_int8 pulses[], /* O quantized qulse signal */
|
||||
const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefficients */
|
||||
const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefficients */
|
||||
const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I */
|
||||
const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int16 x[], /* I Prefiltered input signal */
|
||||
opus_int8 pulses[], /* O Quantized pulse signal */
|
||||
const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */
|
||||
const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */
|
||||
const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */
|
||||
const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */
|
||||
const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */
|
||||
const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int pitchL[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int Lambda_Q10, /* I */
|
||||
const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I Low frequency shaping coefs */
|
||||
const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I Quantization step sizes */
|
||||
const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lags */
|
||||
const opus_int Lambda_Q10, /* I Rate/distortion tradeoff */
|
||||
const opus_int LTP_scale_Q14 /* I LTP state scaling */
|
||||
);
|
||||
|
||||
|
@ -258,15 +253,15 @@ void silk_NSQ_del_dec(
|
|||
SideInfoIndices *psIndices, /* I/O Quantization Indices */
|
||||
const opus_int16 x[], /* I Prefiltered input signal */
|
||||
opus_int8 pulses[], /* O Quantized pulse signal */
|
||||
const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Prediction coefs */
|
||||
const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I LT prediction coefs */
|
||||
const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I */
|
||||
const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */
|
||||
const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */
|
||||
const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */
|
||||
const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */
|
||||
const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */
|
||||
const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int pitchL[ MAX_NB_SUBFR ], /* I */
|
||||
const opus_int Lambda_Q10, /* I */
|
||||
const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I Low frequency shaping coefs */
|
||||
const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I Quantization step sizes */
|
||||
const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lags */
|
||||
const opus_int Lambda_Q10, /* I Rate/distortion tradeoff */
|
||||
const opus_int LTP_scale_Q14 /* I LTP state scaling */
|
||||
);
|
||||
|
||||
|
@ -289,7 +284,7 @@ opus_int silk_VAD_GetSA_Q8( /* O Return value, 0 if
|
|||
/* Start by setting transition_frame_no = 1; */
|
||||
void silk_LP_variable_cutoff(
|
||||
silk_LP_state *psLP, /* I/O LP filter state */
|
||||
opus_int16 *signal, /* I/O Low-pass filtered output signal */
|
||||
opus_int16 *frame, /* I/O Low-pass filtered output signal */
|
||||
const opus_int frame_length /* I Frame length */
|
||||
);
|
||||
|
||||
|
@ -357,14 +352,6 @@ void silk_NLSF_decode(
|
|||
/****************************************************/
|
||||
/* Decoder Functions */
|
||||
/****************************************************/
|
||||
opus_int silk_create_decoder(
|
||||
silk_decoder_state **ppsDec /* I/O Decoder state pointer pointer */
|
||||
);
|
||||
|
||||
opus_int silk_free_decoder(
|
||||
silk_decoder_state *psDec /* I/O Decoder state pointer */
|
||||
);
|
||||
|
||||
opus_int silk_init_decoder(
|
||||
silk_decoder_state *psDec /* I/O Decoder state pointer */
|
||||
);
|
||||
|
@ -388,13 +375,7 @@ opus_int silk_decode_frame(
|
|||
opus_int condCoding /* I The type of conditional coding to use */
|
||||
);
|
||||
|
||||
/* Decode LBRR side info and excitation */
|
||||
void silk_LBRR_extract(
|
||||
silk_decoder_state *psDec, /* I/O State */
|
||||
ec_dec *psRangeDec /* I/O Compressor data structure */
|
||||
);
|
||||
|
||||
/* Decode indices from payload v4 Bitstream */
|
||||
/* Decode indices from bitstream */
|
||||
void silk_decode_indices(
|
||||
silk_decoder_state *psDec, /* I/O State */
|
||||
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
||||
|
@ -440,7 +421,7 @@ void silk_CNG_Reset(
|
|||
void silk_CNG(
|
||||
silk_decoder_state *psDec, /* I/O Decoder state */
|
||||
silk_decoder_control *psDecCtrl, /* I/O Decoder control */
|
||||
opus_int16 signal[], /* I/O Signal */
|
||||
opus_int16 frame[], /* I/O Signal */
|
||||
opus_int length /* I Length of residual */
|
||||
);
|
||||
|
||||
|
|
|
@ -30,27 +30,27 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "SigProc_FIX.h"
|
||||
|
||||
/************************************************************/
|
||||
/* Definitions For Fix pitch estimator */
|
||||
/************************************************************/
|
||||
/********************************************************/
|
||||
/* Definitions for pitch estimator */
|
||||
/********************************************************/
|
||||
|
||||
#define PE_MAX_FS_KHZ 16 /* Maximum sampling frequency used */
|
||||
|
||||
#define PE_MAX_NB_SUBFR 4
|
||||
#define PE_SUBFR_LENGTH_MS 5 /* 5 ms */
|
||||
|
||||
#define PE_LTP_MEM_LENGTH_MS (4 * PE_SUBFR_LENGTH_MS)
|
||||
#define PE_LTP_MEM_LENGTH_MS ( 4 * PE_SUBFR_LENGTH_MS )
|
||||
|
||||
#define PE_MAX_FRAME_LENGTH_MS (PE_LTP_MEM_LENGTH_MS + PE_MAX_NB_SUBFR * PE_SUBFR_LENGTH_MS)
|
||||
#define PE_MAX_FRAME_LENGTH (PE_MAX_FRAME_LENGTH_MS * PE_MAX_FS_KHZ)
|
||||
#define PE_MAX_FRAME_LENGTH_ST_1 (PE_MAX_FRAME_LENGTH >> 2)
|
||||
#define PE_MAX_FRAME_LENGTH_ST_2 (PE_MAX_FRAME_LENGTH >> 1)
|
||||
#define PE_MAX_SF_FRAME_LENGTH (PE_SUB_FRAME * PE_MAX_FS_KHZ)
|
||||
#define PE_MAX_FRAME_LENGTH_MS ( PE_LTP_MEM_LENGTH_MS + PE_MAX_NB_SUBFR * PE_SUBFR_LENGTH_MS )
|
||||
#define PE_MAX_FRAME_LENGTH ( PE_MAX_FRAME_LENGTH_MS * PE_MAX_FS_KHZ )
|
||||
#define PE_MAX_FRAME_LENGTH_ST_1 ( PE_MAX_FRAME_LENGTH >> 2 )
|
||||
#define PE_MAX_FRAME_LENGTH_ST_2 ( PE_MAX_FRAME_LENGTH >> 1 )
|
||||
#define PE_MAX_SF_FRAME_LENGTH ( PE_SUB_FRAME * PE_MAX_FS_KHZ )
|
||||
|
||||
#define PE_MAX_LAG_MS 18 /* 18 ms -> 56 Hz */
|
||||
#define PE_MIN_LAG_MS 2 /* 2 ms -> 500 Hz */
|
||||
#define PE_MAX_LAG (PE_MAX_LAG_MS * PE_MAX_FS_KHZ)
|
||||
#define PE_MIN_LAG (PE_MIN_LAG_MS * PE_MAX_FS_KHZ)
|
||||
#define PE_MAX_LAG ( PE_MAX_LAG_MS * PE_MAX_FS_KHZ )
|
||||
#define PE_MIN_LAG ( PE_MIN_LAG_MS * PE_MAX_FS_KHZ )
|
||||
|
||||
#define PE_D_SRCH_LENGTH 24
|
||||
|
||||
|
@ -73,12 +73,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#define PE_PREVLAG_BIAS 0.2f /* for logarithmic weighting */
|
||||
#define PE_FLATCONTOUR_BIAS 0.05f
|
||||
|
||||
#define SILK_PE_MIN_COMPLEX 0
|
||||
#define SILK_PE_MID_COMPLEX 1
|
||||
#define SILK_PE_MAX_COMPLEX 2
|
||||
|
||||
/* Tables for 20 ms frames */
|
||||
extern const opus_int8 silk_CB_lags_stage2[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE2_EXT ];
|
||||
extern const opus_int8 silk_CB_lags_stage3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ];
|
||||
extern const opus_int8 silk_Lag_range_stage3[ SILK_PE_MAX_COMPLEX + 1 ] [ PE_MAX_NB_SUBFR ][ 2 ];
|
||||
extern const opus_int8 silk_nb_cbk_searchs_stage3[ SILK_PE_MAX_COMPLEX + 1 ];
|
||||
|
||||
/* Tables added for 10 ms frames */
|
||||
/* Tables for 10 ms frames */
|
||||
extern const opus_int8 silk_CB_lags_stage2_10_ms[ PE_MAX_NB_SUBFR >> 1][ 3 ];
|
||||
extern const opus_int8 silk_CB_lags_stage3_10_ms[ PE_MAX_NB_SUBFR >> 1 ][ 12 ];
|
||||
extern const opus_int8 silk_Lag_range_stage3_10_ms[ PE_MAX_NB_SUBFR >> 1 ][ 2 ];
|
||||
|
|
|
@ -80,15 +80,12 @@ void silk_process_NLSFs(
|
|||
i_sqr_Q15 = silk_LSHIFT( silk_SMULBB( psEncC->indices.NLSFInterpCoef_Q2, psEncC->indices.NLSFInterpCoef_Q2 ), 11 );
|
||||
for( i = 0; i < psEncC->predictLPCOrder; i++ ) {
|
||||
pNLSFW_QW[ i ] = silk_SMLAWB( silk_RSHIFT( pNLSFW_QW[ i ], 1 ), pNLSFW0_temp_QW[ i ], i_sqr_Q15 );
|
||||
silk_assert( pNLSFW_QW[ i ] <= silk_int16_MAX );
|
||||
silk_assert( pNLSFW_QW[ i ] >= 1 );
|
||||
}
|
||||
}
|
||||
|
||||
TIC(NLSF_encode)
|
||||
silk_NLSF_encode( psEncC->indices.NLSFIndices, pNLSF_Q15, psEncC->psNLSF_CB, pNLSFW_QW,
|
||||
NLSF_mu_Q20, psEncC->NLSF_MSVQ_Survivors, psEncC->indices.signalType );
|
||||
TOC(NLSF_encode)
|
||||
|
||||
/* Convert quantized NLSFs back to LPC coefficients */
|
||||
silk_NLSF2A( PredCoef_Q12[ 1 ], pNLSF_Q15, psEncC->predictLPCOrder );
|
||||
|
|
|
@ -49,8 +49,6 @@ void silk_quant_LTP_gains(
|
|||
const opus_int32 *W_Q18_ptr;
|
||||
opus_int32 rate_dist_Q14_subfr, rate_dist_Q14, min_rate_dist_Q14;
|
||||
|
||||
TIC(quant_LTP)
|
||||
|
||||
/***************************************************/
|
||||
/* iterate over different codebooks with different */
|
||||
/* rates/distortions, and choose best */
|
||||
|
@ -67,7 +65,6 @@ TIC(quant_LTP)
|
|||
|
||||
rate_dist_Q14 = 0;
|
||||
for( j = 0; j < nb_subfr; j++ ) {
|
||||
|
||||
silk_VQ_WMat_EC(
|
||||
&temp_idx[ j ], /* O index of best codebook vector */
|
||||
&rate_dist_Q14_subfr, /* O best weighted quantization error + mu * rate */
|
||||
|
@ -106,6 +103,5 @@ TIC(quant_LTP)
|
|||
B_Q14[ j * LTP_ORDER + k ] = silk_LSHIFT( cbk_ptr_Q7[ cbk_index[ j ] * LTP_ORDER + k ], 7 );
|
||||
}
|
||||
}
|
||||
TOC(quant_LTP)
|
||||
}
|
||||
|
||||
|
|
|
@ -60,9 +60,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* 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 up2 = 0, down2 = 0;
|
||||
|
@ -71,8 +71,8 @@ opus_int silk_resampler_init(
|
|||
silk_memset( S, 0, sizeof( silk_resampler_state_struct ) );
|
||||
|
||||
/* Input checking */
|
||||
if( (Fs_Hz_in!=8000 && Fs_Hz_in!=12000 && Fs_Hz_in!=16000 && Fs_Hz_in!=24000 && Fs_Hz_in!=48000) ||
|
||||
(Fs_Hz_out!=8000 && Fs_Hz_out!=12000 && Fs_Hz_out!=16000 && Fs_Hz_out!=24000 && Fs_Hz_out!=48000) ) {
|
||||
if( ( Fs_Hz_in != 8000 && Fs_Hz_in != 12000 && Fs_Hz_in != 16000 && Fs_Hz_in != 24000 && Fs_Hz_in != 48000 ) ||
|
||||
( Fs_Hz_out != 8000 && Fs_Hz_out != 12000 && Fs_Hz_out != 16000 && Fs_Hz_out != 24000 && Fs_Hz_out != 48000 ) ) {
|
||||
silk_assert( 0 );
|
||||
return -1;
|
||||
}
|
||||
|
@ -143,14 +143,14 @@ opus_int silk_resampler_init(
|
|||
|
||||
/* 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 */
|
||||
)
|
||||
{
|
||||
/* Input and output sampling rate are at most 48000 Hz */
|
||||
switch(S->resampler_function) {
|
||||
switch( S->resampler_function ) {
|
||||
case USE_silk_resampler_private_up2_HQ_wrapper:
|
||||
silk_resampler_private_up2_HQ_wrapper( S, out, in, inLen );
|
||||
break;
|
||||
|
|
|
@ -34,10 +34,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* Downsample by a factor 2, mediocre quality */
|
||||
void silk_resampler_down2(
|
||||
opus_int32 *S, /* I/O: State vector [ 2 ] */
|
||||
opus_int16 *out, /* O: Output signal [ len ] */
|
||||
const opus_int16 *in, /* I: Input signal [ floor(len/2) ] */
|
||||
opus_int32 inLen /* I: Number of input samples */
|
||||
opus_int32 *S, /* I/O State vector [ 2 ] */
|
||||
opus_int16 *out, /* O Output signal [ len ] */
|
||||
const opus_int16 *in, /* I Input signal [ floor(len/2) ] */
|
||||
opus_int32 inLen /* I Number of input samples */
|
||||
)
|
||||
{
|
||||
opus_int32 k, len2 = silk_RSHIFT32( inLen, 1 );
|
||||
|
|
|
@ -36,10 +36,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* Downsample by a factor 2/3, low quality */
|
||||
void silk_resampler_down2_3(
|
||||
opus_int32 *S, /* I/O: State vector [ 6 ] */
|
||||
opus_int16 *out, /* O: Output signal [ floor(2*inLen/3) ] */
|
||||
const opus_int16 *in, /* I: Input signal [ inLen ] */
|
||||
opus_int32 inLen /* I: Number of input samples */
|
||||
opus_int32 *S, /* I/O State vector [ 6 ] */
|
||||
opus_int16 *out, /* O Output signal [ floor(2*inLen/3) ] */
|
||||
const opus_int16 *in, /* I Input signal [ inLen ] */
|
||||
opus_int32 inLen /* I Number of input samples */
|
||||
)
|
||||
{
|
||||
opus_int32 nSamplesIn, counter, res_Q6;
|
||||
|
|
|
@ -41,51 +41,43 @@ extern "C" {
|
|||
|
||||
/* 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 */
|
||||
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 */
|
||||
);
|
||||
|
||||
/* 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 */
|
||||
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) */
|
||||
opus_int16 *out, /* O: Output signal [ 2 * len ] */
|
||||
const opus_int16 *in, /* I: Input signal [ len ] */
|
||||
opus_int32 len /* I: Number of input samples */
|
||||
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 */
|
||||
);
|
||||
|
||||
/* Upsample by a factor 2, high quality */
|
||||
void silk_resampler_private_up2_HQ(
|
||||
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 */
|
||||
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 */
|
||||
);
|
||||
|
||||
/* 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 */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -34,11 +34,11 @@ 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;
|
||||
|
|
|
@ -33,10 +33,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "resampler_private.h"
|
||||
|
||||
static 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_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 = silk_SMULWB( index_Q16 & 0xFFFF, 144 );
|
||||
|
@ -54,10 +60,10 @@ static inline opus_int16 *silk_resampler_private_IIR_FIR_INTERPOL(
|
|||
}
|
||||
/* 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;
|
||||
|
@ -65,7 +71,6 @@ void silk_resampler_private_IIR_FIR(
|
|||
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 */
|
||||
silk_memcpy( buf, S->sFIR, RESAMPLER_ORDER_FIR_144 * sizeof( opus_int32 ) );
|
||||
|
||||
|
|
|
@ -33,10 +33,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "resampler_private.h"
|
||||
|
||||
static 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 + silk_RSHIFT( index_Q16, 16 );
|
||||
|
@ -58,12 +64,19 @@ static inline opus_int16 *silk_resampler_private_down_FIR_INTERPOL0(
|
|||
}
|
||||
|
||||
static 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 + silk_RSHIFT( index_Q16, 16 );
|
||||
|
@ -100,10 +113,10 @@ static inline opus_int16 *silk_resampler_private_down_FIR_INTERPOL1(
|
|||
|
||||
/* 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;
|
||||
|
|
|
@ -36,10 +36,10 @@ 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_int16 *out, /* O: Output signal [ 2 * len ] */
|
||||
const opus_int16 *in, /* I: Input signal [ len ] */
|
||||
opus_int32 len /* I: Number of INPUT samples */
|
||||
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 */
|
||||
)
|
||||
{
|
||||
opus_int32 k;
|
||||
|
@ -102,10 +102,10 @@ void silk_resampler_private_up2_HQ(
|
|||
}
|
||||
|
||||
void silk_resampler_private_up2_HQ_wrapper(
|
||||
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 */
|
||||
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 */
|
||||
)
|
||||
{
|
||||
silk_resampler_state_struct *S = (silk_resampler_state_struct *)SS;
|
||||
|
|
|
@ -39,7 +39,6 @@ extern "C"
|
|||
#define RESAMPLER_DOWN_ORDER_FIR 16
|
||||
#define RESAMPLER_ORDER_FIR_144 6
|
||||
|
||||
|
||||
/* Tables for 2x downsampler. Values above 32767 intentionally wrap to a negative value. */
|
||||
extern const opus_int16 silk_resampler_down2_0;
|
||||
extern const opus_int16 silk_resampler_down2_1;
|
||||
|
|
|
@ -32,11 +32,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Flag to enable support for input/output sampling rates above 48 kHz. Turn off for embedded devices */
|
||||
#define SILK_RESAMPLER_MAX_FIR_ORDER 16
|
||||
#define SILK_RESAMPLER_MAX_IIR_ORDER 6
|
||||
|
||||
|
||||
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 ];
|
||||
|
|
|
@ -34,9 +34,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
/* shell coder; pulse-subframe length is hardcoded */
|
||||
|
||||
static inline void combine_pulses(
|
||||
opus_int *out, /* O: combined pulses vector [len] */
|
||||
const opus_int *in, /* I: input vector [2 * len] */
|
||||
const opus_int len /* I: number of OUTPUT samples */
|
||||
opus_int *out, /* O combined pulses vector [len] */
|
||||
const opus_int *in, /* I input vector [2 * len] */
|
||||
const opus_int len /* I number of OUTPUT samples */
|
||||
)
|
||||
{
|
||||
opus_int k;
|
||||
|
@ -47,9 +47,9 @@ static inline void combine_pulses(
|
|||
|
||||
static inline void encode_split(
|
||||
ec_enc *psRangeEnc, /* I/O compressor data structure */
|
||||
const opus_int p_child1, /* I: pulse amplitude of first child subframe */
|
||||
const opus_int p, /* I: pulse amplitude of current subframe */
|
||||
const opus_uint8 *shell_table /* I: table of shell cdfs */
|
||||
const opus_int p_child1, /* I pulse amplitude of first child subframe */
|
||||
const opus_int p, /* I pulse amplitude of current subframe */
|
||||
const opus_uint8 *shell_table /* I table of shell cdfs */
|
||||
)
|
||||
{
|
||||
if( p > 0 ) {
|
||||
|
@ -58,11 +58,11 @@ static inline void encode_split(
|
|||
}
|
||||
|
||||
static inline void decode_split(
|
||||
opus_int *p_child1, /* O: pulse amplitude of first child subframe */
|
||||
opus_int *p_child2, /* O: pulse amplitude of second child subframe */
|
||||
opus_int *p_child1, /* O pulse amplitude of first child subframe */
|
||||
opus_int *p_child2, /* O pulse amplitude of second child subframe */
|
||||
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
||||
const opus_int p, /* I: pulse amplitude of current subframe */
|
||||
const opus_uint8 *shell_table /* I: table of shell cdfs */
|
||||
const opus_int p, /* I pulse amplitude of current subframe */
|
||||
const opus_uint8 *shell_table /* I table of shell cdfs */
|
||||
)
|
||||
{
|
||||
if( p > 0 ) {
|
||||
|
|
|
@ -46,7 +46,9 @@ static const opus_int32 sigm_LUT_neg_Q15[ 6 ] = {
|
|||
16384, 8812, 3906, 1554, 589, 219
|
||||
};
|
||||
|
||||
opus_int silk_sigm_Q15( opus_int in_Q5 )
|
||||
opus_int silk_sigm_Q15(
|
||||
opus_int in_Q5 /* I */
|
||||
)
|
||||
{
|
||||
opus_int ind;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>fixed;float;../win32;../celt</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>fixed;float;../win32;../celt;../include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -70,7 +70,7 @@
|
|||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>fixed;float;../win32;../celt</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>fixed;float;../win32;../celt;../include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -164,8 +164,8 @@
|
|||
<ClCompile Include="VQ_WMat_EC.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\opus_types.h" />
|
||||
<ClInclude Include="..\win32\config.h" />
|
||||
<ClInclude Include="float\main_FLP.h" />
|
||||
<ClInclude Include="control.h" />
|
||||
<ClInclude Include="debug.h" />
|
||||
<ClInclude Include="define.h" />
|
||||
|
|
|
@ -281,9 +281,6 @@
|
|||
<ClInclude Include="PLC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="float\main_FLP.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resampler_private.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -314,5 +311,8 @@
|
|||
<ClInclude Include="SigProc_FIX.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\opus_types.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
20
silk/sort.c
20
silk/sort.c
|
@ -38,10 +38,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "SigProc_FIX.h"
|
||||
|
||||
void silk_insertion_sort_increasing(
|
||||
opus_int32 *a, /* I/O: Unsorted / Sorted vector */
|
||||
opus_int *idx, /* O: Index vector for the sorted elements */
|
||||
const opus_int L, /* I: Vector length */
|
||||
const opus_int K /* I: Number of correctly sorted positions */
|
||||
opus_int32 *a, /* I/O Unsorted / Sorted vector */
|
||||
opus_int *idx, /* O Index vector for the sorted elements */
|
||||
const opus_int L, /* I Vector length */
|
||||
const opus_int K /* I Number of correctly sorted positions */
|
||||
)
|
||||
{
|
||||
opus_int32 value;
|
||||
|
@ -84,10 +84,10 @@ void silk_insertion_sort_increasing(
|
|||
}
|
||||
|
||||
void silk_insertion_sort_decreasing_int16(
|
||||
opus_int16 *a, /* I/O: Unsorted / Sorted vector */
|
||||
opus_int *idx, /* O: Index vector for the sorted elements */
|
||||
const opus_int L, /* I: Vector length */
|
||||
const opus_int K /* I: Number of correctly sorted positions */
|
||||
opus_int16 *a, /* I/O Unsorted / Sorted vector */
|
||||
opus_int *idx, /* O Index vector for the sorted elements */
|
||||
const opus_int L, /* I Vector length */
|
||||
const opus_int K /* I Number of correctly sorted positions */
|
||||
)
|
||||
{
|
||||
opus_int i, j;
|
||||
|
@ -130,8 +130,8 @@ void silk_insertion_sort_decreasing_int16(
|
|||
}
|
||||
|
||||
void silk_insertion_sort_increasing_all_values_int16(
|
||||
opus_int16 *a, /* I/O: Unsorted / Sorted vector */
|
||||
const opus_int L /* I: Vector length */
|
||||
opus_int16 *a, /* I/O Unsorted / Sorted vector */
|
||||
const opus_int L /* I Vector length */
|
||||
)
|
||||
{
|
||||
opus_int value;
|
||||
|
|
|
@ -185,12 +185,6 @@ void silk_stereo_LR_to_MS(
|
|||
mid_side_rates_bps[ 1 ] = 1;
|
||||
mid_side_rates_bps[ 0 ] = silk_max_int( 1, total_rate_bps - mid_side_rates_bps[ 1 ]);
|
||||
}
|
||||
#if 0
|
||||
DEBUG_STORE_DATA( midside.dat, &mid_side_rates_bps[ 0 ], 8 );
|
||||
DEBUG_STORE_DATA( norms0.pcm, &state->mid_side_amp_Q0[0], 8 );
|
||||
DEBUG_STORE_DATA( norms1.pcm, &state->mid_side_amp_Q0[2], 8 );
|
||||
DEBUG_STORE_DATA( width.pcm, &width_Q14, 4 );
|
||||
#endif
|
||||
|
||||
/* Interpolate predictors and subtract prediction from side channel */
|
||||
pred0_Q13 = -state->pred_prev_Q13[ 0 ];
|
||||
|
|
|
@ -136,7 +136,7 @@ typedef struct {
|
|||
silk_LP_state sLP; /* Low pass filter state */
|
||||
silk_VAD_state sVAD; /* Voice activity detector state */
|
||||
silk_nsq_state sNSQ; /* Noise Shape Quantizer State */
|
||||
opus_int16 prev_NLSFq_Q15[ MAX_LPC_ORDER ];/* Previously quantized NLSF vector */
|
||||
opus_int16 prev_NLSFq_Q15[ MAX_LPC_ORDER ]; /* Previously quantized NLSF vector */
|
||||
opus_int speech_activity_Q8; /* Speech activity */
|
||||
opus_int allow_bandwidth_switch; /* Flag indicating that switching of internal bandwidth is allowed */
|
||||
opus_int8 LBRRprevLastGainIndex;
|
||||
|
@ -309,10 +309,10 @@ typedef struct {
|
|||
/* Decoder control */
|
||||
/************************/
|
||||
typedef struct {
|
||||
/* prediction and coding parameters */
|
||||
/* Prediction and coding parameters */
|
||||
opus_int pitchL[ MAX_NB_SUBFR ];
|
||||
opus_int32 Gains_Q16[ MAX_NB_SUBFR ];
|
||||
/* holds interpolated and final coefficients, 4-byte aligned */
|
||||
/* Holds interpolated and final coefficients, 4-byte aligned */
|
||||
silk_DWORD_ALIGN opus_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ];
|
||||
opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ];
|
||||
opus_int LTP_scale_Q14;
|
||||
|
|
|
@ -36,11 +36,11 @@ extern "C"
|
|||
{
|
||||
#endif
|
||||
|
||||
/* entropy coding tables */
|
||||
/* Entropy coding tables (with size in bytes indicated) */
|
||||
extern const opus_uint8 silk_gain_iCDF[ 3 ][ N_LEVELS_QGAIN / 8 ]; /* 24 */
|
||||
extern const opus_uint8 silk_delta_gain_iCDF[ MAX_DELTA_GAIN_QUANT - MIN_DELTA_GAIN_QUANT + 1 ]; /* 41 */
|
||||
|
||||
extern const opus_uint8 silk_pitch_lag_iCDF[ 2 * ( PITCH_EST_MAX_LAG_MS - PITCH_EST_MIN_LAG_MS ) ]; /* 32 */
|
||||
extern const opus_uint8 silk_pitch_lag_iCDF[ 2 * ( PITCH_EST_MAX_LAG_MS - PITCH_EST_MIN_LAG_MS ) ];/* 32 */
|
||||
extern const opus_uint8 silk_pitch_delta_iCDF[ 21 ]; /* 21 */
|
||||
extern const opus_uint8 silk_pitch_contour_iCDF[ 34 ]; /* 34 */
|
||||
extern const opus_uint8 silk_pitch_contour_NB_iCDF[ 11 ]; /* 11 */
|
||||
|
@ -81,7 +81,7 @@ extern const opus_int8 * const silk_LTP_vq_ptrs_Q7[ NB_LTP_CBKS ];
|
|||
extern const opus_int8 silk_LTP_vq_sizes[ NB_LTP_CBKS ]; /* 3 */
|
||||
|
||||
extern const opus_uint8 silk_LTPscale_iCDF[ 3 ]; /* 4 */
|
||||
extern const opus_int16 silk_LTPScales_table_Q14[ 3 ];
|
||||
extern const opus_int16 silk_LTPScales_table_Q14[ 3 ]; /* 6 */
|
||||
|
||||
extern const opus_uint8 silk_type_offset_VAD_iCDF[ 4 ]; /* 4 */
|
||||
extern const opus_uint8 silk_type_offset_no_VAD_iCDF[ 2 ]; /* 2 */
|
||||
|
@ -94,24 +94,24 @@ extern const opus_uint8 * const silk_LBRR_flags_iCDF_ptr[ 2 ];
|
|||
|
||||
extern const opus_uint8 silk_NLSF_interpolation_factor_iCDF[ 5 ]; /* 5 */
|
||||
|
||||
extern const silk_NLSF_CB_struct silk_NLSF_CB_WB;
|
||||
extern const silk_NLSF_CB_struct silk_NLSF_CB_NB_MB;
|
||||
extern const silk_NLSF_CB_struct silk_NLSF_CB_WB; /* 1040 */
|
||||
extern const silk_NLSF_CB_struct silk_NLSF_CB_NB_MB; /* 728 */
|
||||
|
||||
/* Piece-wise linear mapping from bitrate in kbps to coding quality in dB SNR */
|
||||
extern const opus_int32 silk_TargetRate_table_NB[ TARGET_RATE_TAB_SZ ];
|
||||
extern const opus_int32 silk_TargetRate_table_MB[ TARGET_RATE_TAB_SZ ];
|
||||
extern const opus_int32 silk_TargetRate_table_WB[ TARGET_RATE_TAB_SZ ];
|
||||
extern const opus_int16 silk_SNR_table_Q1[ TARGET_RATE_TAB_SZ ];
|
||||
extern const opus_int32 silk_TargetRate_table_NB[ TARGET_RATE_TAB_SZ ]; /* 32 */
|
||||
extern const opus_int32 silk_TargetRate_table_MB[ TARGET_RATE_TAB_SZ ]; /* 32 */
|
||||
extern const opus_int32 silk_TargetRate_table_WB[ TARGET_RATE_TAB_SZ ]; /* 32 */
|
||||
extern const opus_int16 silk_SNR_table_Q1[ TARGET_RATE_TAB_SZ ]; /* 32 */
|
||||
|
||||
/* Quantization offsets */
|
||||
extern const opus_int16 silk_Quantization_Offsets_Q10[ 2 ][ 2 ];
|
||||
extern const opus_int16 silk_Quantization_Offsets_Q10[ 2 ][ 2 ]; /* 8 */
|
||||
|
||||
/* Interpolation points for filter coefficients used in the bandwidth transition smoother */
|
||||
extern const opus_int32 silk_Transition_LP_B_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NB ];
|
||||
extern const opus_int32 silk_Transition_LP_A_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NA ];
|
||||
extern const opus_int32 silk_Transition_LP_B_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NB ]; /* 60 */
|
||||
extern const opus_int32 silk_Transition_LP_A_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NA ]; /* 60 */
|
||||
|
||||
/* Rom table with cosine values */
|
||||
extern const opus_int16 silk_LSFCosTab_FIX_Q12[ LSF_COS_TAB_SZ_FIX + 1 ];
|
||||
extern const opus_int16 silk_LSFCosTab_FIX_Q12[ LSF_COS_TAB_SZ_FIX + 1 ]; /* 258 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue