summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libopus/silk/decode_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libopus/silk/decode_core.c')
-rw-r--r--lib/rbcodec/codecs/libopus/silk/decode_core.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/rbcodec/codecs/libopus/silk/decode_core.c b/lib/rbcodec/codecs/libopus/silk/decode_core.c
index af68b75da9..1c352a6522 100644
--- a/lib/rbcodec/codecs/libopus/silk/decode_core.c
+++ b/lib/rbcodec/codecs/libopus/silk/decode_core.c
@@ -39,7 +39,8 @@ void silk_decode_core(
39 silk_decoder_state *psDec, /* I/O Decoder state */ 39 silk_decoder_state *psDec, /* I/O Decoder state */
40 silk_decoder_control *psDecCtrl, /* I Decoder control */ 40 silk_decoder_control *psDecCtrl, /* I Decoder control */
41 opus_int16 xq[], /* O Decoded speech */ 41 opus_int16 xq[], /* O Decoded speech */
42 const opus_int16 pulses[ MAX_FRAME_LENGTH ] /* I Pulse signal */ 42 const opus_int16 pulses[ MAX_FRAME_LENGTH ], /* I Pulse signal */
43 int arch /* I Run-time architecture */
43) 44)
44{ 45{
45 opus_int i, k, lag = 0, start_idx, sLTP_buf_idx, NLSF_interpolation_flag, signalType; 46 opus_int i, k, lag = 0, start_idx, sLTP_buf_idx, NLSF_interpolation_flag, signalType;
@@ -140,14 +141,14 @@ void silk_decode_core(
140 if( k == 0 || ( k == 2 && NLSF_interpolation_flag ) ) { 141 if( k == 0 || ( k == 2 && NLSF_interpolation_flag ) ) {
141 /* Rewhiten with new A coefs */ 142 /* Rewhiten with new A coefs */
142 start_idx = psDec->ltp_mem_length - lag - psDec->LPC_order - LTP_ORDER / 2; 143 start_idx = psDec->ltp_mem_length - lag - psDec->LPC_order - LTP_ORDER / 2;
143 silk_assert( start_idx > 0 ); 144 celt_assert( start_idx > 0 );
144 145
145 if( k == 2 ) { 146 if( k == 2 ) {
146 silk_memcpy( &psDec->outBuf[ psDec->ltp_mem_length ], xq, 2 * psDec->subfr_length * sizeof( opus_int16 ) ); 147 silk_memcpy( &psDec->outBuf[ psDec->ltp_mem_length ], xq, 2 * psDec->subfr_length * sizeof( opus_int16 ) );
147 } 148 }
148 149
149 silk_LPC_analysis_filter( &sLTP[ start_idx ], &psDec->outBuf[ start_idx + k * psDec->subfr_length ], 150 silk_LPC_analysis_filter( &sLTP[ start_idx ], &psDec->outBuf[ start_idx + k * psDec->subfr_length ],
150 A_Q12, psDec->ltp_mem_length - start_idx, psDec->LPC_order ); 151 A_Q12, psDec->ltp_mem_length - start_idx, psDec->LPC_order, arch );
151 152
152 /* After rewhitening the LTP state is unscaled */ 153 /* After rewhitening the LTP state is unscaled */
153 if( k == 0 ) { 154 if( k == 0 ) {
@@ -195,7 +196,7 @@ void silk_decode_core(
195 196
196 for( i = 0; i < psDec->subfr_length; i++ ) { 197 for( i = 0; i < psDec->subfr_length; i++ ) {
197 /* Short-term prediction */ 198 /* Short-term prediction */
198 silk_assert( psDec->LPC_order == 10 || psDec->LPC_order == 16 ); 199 celt_assert( psDec->LPC_order == 10 || psDec->LPC_order == 16 );
199 /* Avoids introducing a bias because silk_SMLAWB() always rounds to -inf */ 200 /* Avoids introducing a bias because silk_SMLAWB() always rounds to -inf */
200 LPC_pred_Q10 = silk_RSHIFT( psDec->LPC_order, 1 ); 201 LPC_pred_Q10 = silk_RSHIFT( psDec->LPC_order, 1 );
201 LPC_pred_Q10 = silk_SMLAWB( LPC_pred_Q10, sLPC_Q14[ MAX_LPC_ORDER + i - 1 ], A_Q12_tmp[ 0 ] ); 202 LPC_pred_Q10 = silk_SMLAWB( LPC_pred_Q10, sLPC_Q14[ MAX_LPC_ORDER + i - 1 ], A_Q12_tmp[ 0 ] );
@@ -218,14 +219,12 @@ void silk_decode_core(
218 } 219 }
219 220
220 /* Add prediction to LPC excitation */ 221 /* Add prediction to LPC excitation */
221 sLPC_Q14[ MAX_LPC_ORDER + i ] = silk_ADD_LSHIFT32( pres_Q14[ i ], LPC_pred_Q10, 4 ); 222 sLPC_Q14[ MAX_LPC_ORDER + i ] = silk_ADD_SAT32( pres_Q14[ i ], silk_LSHIFT_SAT32( LPC_pred_Q10, 4 ) );
222 223
223 /* Scale with gain */ 224 /* Scale with gain */
224 pxq[ i ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( silk_SMULWW( sLPC_Q14[ MAX_LPC_ORDER + i ], Gain_Q10 ), 8 ) ); 225 pxq[ i ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( silk_SMULWW( sLPC_Q14[ MAX_LPC_ORDER + i ], Gain_Q10 ), 8 ) );
225 } 226 }
226 227
227 /* DEBUG_STORE_DATA( dec.pcm, pxq, psDec->subfr_length * sizeof( opus_int16 ) ) */
228
229 /* Update LPC filter state */ 228 /* Update LPC filter state */
230 silk_memcpy( sLPC_Q14, &sLPC_Q14[ psDec->subfr_length ], MAX_LPC_ORDER * sizeof( opus_int32 ) ); 229 silk_memcpy( sLPC_Q14, &sLPC_Q14[ psDec->subfr_length ], MAX_LPC_ORDER * sizeof( opus_int32 ) );
231 pexc_Q14 += psDec->subfr_length; 230 pexc_Q14 += psDec->subfr_length;