| Index: third_party/opus/src/silk/float/wrappers_FLP.c
|
| diff --git a/third_party/opus/src/silk/float/wrappers_FLP.c b/third_party/opus/src/silk/float/wrappers_FLP.c
|
| index 6666b8efaade2f0ce9eef37181c07683d5433ec2..ad90b874a4d814a615c914174205fdfb10df0974 100644
|
| --- a/third_party/opus/src/silk/float/wrappers_FLP.c
|
| +++ b/third_party/opus/src/silk/float/wrappers_FLP.c
|
| @@ -54,13 +54,14 @@ void silk_A2NLSF_FLP(
|
| void silk_NLSF2A_FLP(
|
| silk_float *pAR, /* O LPC coefficients [ LPC_order ] */
|
| const opus_int16 *NLSF_Q15, /* I NLSF vector [ LPC_order ] */
|
| - const opus_int LPC_order /* I LPC order */
|
| + const opus_int LPC_order, /* I LPC order */
|
| + int arch /* I Run-time architecture */
|
| )
|
| {
|
| opus_int i;
|
| opus_int16 a_fix_Q12[ MAX_LPC_ORDER ];
|
|
|
| - silk_NLSF2A( a_fix_Q12, NLSF_Q15, LPC_order );
|
| + silk_NLSF2A( a_fix_Q12, NLSF_Q15, LPC_order, arch );
|
|
|
| for( i = 0; i < LPC_order; i++ ) {
|
| pAR[ i ] = ( silk_float )a_fix_Q12[ i ] * ( 1.0f / 4096.0f );
|
| @@ -102,14 +103,14 @@ void silk_NSQ_wrapper_FLP(
|
| )
|
| {
|
| opus_int i, j;
|
| - opus_int32 x_Q3[ MAX_FRAME_LENGTH ];
|
| + opus_int16 x16[ MAX_FRAME_LENGTH ];
|
| opus_int32 Gains_Q16[ MAX_NB_SUBFR ];
|
| 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;
|
|
|
| /* Noise shaping parameters */
|
| - opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ];
|
| + opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ];
|
| opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ]; /* Packs two int16 coefficients per int32 value */
|
| opus_int Lambda_Q10;
|
| opus_int Tilt_Q14[ MAX_NB_SUBFR ];
|
| @@ -119,7 +120,7 @@ void silk_NSQ_wrapper_FLP(
|
| /* Noise shape parameters */
|
| for( i = 0; i < psEnc->sCmn.nb_subfr; i++ ) {
|
| for( j = 0; j < psEnc->sCmn.shapingLPCOrder; j++ ) {
|
| - AR2_Q13[ i * MAX_SHAPE_LPC_ORDER + j ] = silk_float2int( psEncCtrl->AR2[ i * MAX_SHAPE_LPC_ORDER + j ] * 8192.0f );
|
| + AR_Q13[ i * MAX_SHAPE_LPC_ORDER + j ] = silk_float2int( psEncCtrl->AR[ i * MAX_SHAPE_LPC_ORDER + j ] * 8192.0f );
|
| }
|
| }
|
|
|
| @@ -155,16 +156,16 @@ void silk_NSQ_wrapper_FLP(
|
|
|
| /* Convert input to fix */
|
| for( i = 0; i < psEnc->sCmn.frame_length; i++ ) {
|
| - x_Q3[ i ] = silk_float2int( 8.0f * x[ i ] );
|
| + x16[ i ] = silk_float2int( x[ i ] );
|
| }
|
|
|
| /* Call NSQ */
|
| if( psEnc->sCmn.nStatesDelayedDecision > 1 || psEnc->sCmn.warping_Q16 > 0 ) {
|
| - silk_NSQ_del_dec( &psEnc->sCmn, psNSQ, psIndices, x_Q3, pulses, PredCoef_Q12[ 0 ], LTPCoef_Q14,
|
| - AR2_Q13, HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, psEncCtrl->pitchL, Lambda_Q10, LTP_scale_Q14, psEnc->sCmn.arch );
|
| + silk_NSQ_del_dec( &psEnc->sCmn, psNSQ, psIndices, x16, pulses, PredCoef_Q12[ 0 ], LTPCoef_Q14,
|
| + AR_Q13, HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, psEncCtrl->pitchL, Lambda_Q10, LTP_scale_Q14, psEnc->sCmn.arch );
|
| } else {
|
| - silk_NSQ( &psEnc->sCmn, psNSQ, psIndices, x_Q3, pulses, PredCoef_Q12[ 0 ], LTPCoef_Q14,
|
| - AR2_Q13, HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, psEncCtrl->pitchL, Lambda_Q10, LTP_scale_Q14, psEnc->sCmn.arch );
|
| + silk_NSQ( &psEnc->sCmn, psNSQ, psIndices, x16, pulses, PredCoef_Q12[ 0 ], LTPCoef_Q14,
|
| + AR_Q13, HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, psEncCtrl->pitchL, Lambda_Q10, LTP_scale_Q14, psEnc->sCmn.arch );
|
| }
|
| }
|
|
|
| @@ -172,31 +173,35 @@ void silk_NSQ_wrapper_FLP(
|
| /* Floating-point Silk LTP quantiation wrapper */
|
| /***********************************************/
|
| void silk_quant_LTP_gains_FLP(
|
| - silk_float B[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (Un-)quantized LTP gains */
|
| + silk_float B[ MAX_NB_SUBFR * LTP_ORDER ], /* O Quantized LTP gains */
|
| opus_int8 cbk_index[ MAX_NB_SUBFR ], /* O Codebook index */
|
| opus_int8 *periodicity_index, /* O Periodicity index */
|
| opus_int32 *sum_log_gain_Q7, /* I/O Cumulative max prediction gain */
|
| - const silk_float W[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* I Error weights */
|
| - const opus_int mu_Q10, /* I Mu value (R/D tradeoff) */
|
| - const opus_int lowComplexity, /* I Flag for low complexity */
|
| - const opus_int nb_subfr, /* I number of subframes */
|
| + silk_float *pred_gain_dB, /* O LTP prediction gain */
|
| + const silk_float XX[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* I Correlation matrix */
|
| + const silk_float xX[ MAX_NB_SUBFR * LTP_ORDER ], /* I Correlation vector */
|
| + const opus_int subfr_len, /* I Number of samples per subframe */
|
| + const opus_int nb_subfr, /* I Number of subframes */
|
| int arch /* I Run-time architecture */
|
| )
|
| {
|
| - opus_int i;
|
| + opus_int i, pred_gain_dB_Q7;
|
| opus_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ];
|
| - opus_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ];
|
| + opus_int32 XX_Q17[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ];
|
| + opus_int32 xX_Q17[ MAX_NB_SUBFR * LTP_ORDER ];
|
|
|
| - for( i = 0; i < nb_subfr * LTP_ORDER; i++ ) {
|
| - B_Q14[ i ] = (opus_int16)silk_float2int( B[ i ] * 16384.0f );
|
| - }
|
| for( i = 0; i < nb_subfr * LTP_ORDER * LTP_ORDER; i++ ) {
|
| - W_Q18[ i ] = (opus_int32)silk_float2int( W[ i ] * 262144.0f );
|
| + XX_Q17[ i ] = (opus_int32)silk_float2int( XX[ i ] * 131072.0f );
|
| + }
|
| + for( i = 0; i < nb_subfr * LTP_ORDER; i++ ) {
|
| + xX_Q17[ i ] = (opus_int32)silk_float2int( xX[ i ] * 131072.0f );
|
| }
|
|
|
| - silk_quant_LTP_gains( B_Q14, cbk_index, periodicity_index, sum_log_gain_Q7, W_Q18, mu_Q10, lowComplexity, nb_subfr, arch );
|
| + silk_quant_LTP_gains( B_Q14, cbk_index, periodicity_index, sum_log_gain_Q7, &pred_gain_dB_Q7, XX_Q17, xX_Q17, subfr_len, nb_subfr, arch );
|
|
|
| for( i = 0; i < nb_subfr * LTP_ORDER; i++ ) {
|
| B[ i ] = (silk_float)B_Q14[ i ] * ( 1.0f / 16384.0f );
|
| }
|
| +
|
| + *pred_gain_dB = (silk_float)pred_gain_dB_Q7 * ( 1.0f / 128.0f );
|
| }
|
|
|