| OLD | NEW |
| 1 /*********************************************************************** | 1 /*********************************************************************** |
| 2 Copyright (c) 2006-2011, Skype Limited. All rights reserved. | 2 Copyright (c) 2006-2011, Skype Limited. All rights reserved. |
| 3 Redistribution and use in source and binary forms, with or without | 3 Redistribution and use in source and binary forms, with or without |
| 4 modification, are permitted provided that the following conditions | 4 modification, are permitted provided that the following conditions |
| 5 are met: | 5 are met: |
| 6 - Redistributions of source code must retain the above copyright notice, | 6 - Redistributions of source code must retain the above copyright notice, |
| 7 this list of conditions and the following disclaimer. | 7 this list of conditions and the following disclaimer. |
| 8 - Redistributions in binary form must reproduce the above copyright | 8 - Redistributions in binary form must reproduce the above copyright |
| 9 notice, this list of conditions and the following disclaimer in the | 9 notice, this list of conditions and the following disclaimer in the |
| 10 documentation and/or other materials provided with the distribution. | 10 documentation and/or other materials provided with the distribution. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 opus_int32 Q_Q10; | 50 opus_int32 Q_Q10; |
| 51 opus_int32 RD_Q10; | 51 opus_int32 RD_Q10; |
| 52 opus_int32 xq_Q14; | 52 opus_int32 xq_Q14; |
| 53 opus_int32 LF_AR_Q14; | 53 opus_int32 LF_AR_Q14; |
| 54 opus_int32 sLTP_shp_Q14; | 54 opus_int32 sLTP_shp_Q14; |
| 55 opus_int32 LPC_exc_Q14; | 55 opus_int32 LPC_exc_Q14; |
| 56 } NSQ_sample_struct; | 56 } NSQ_sample_struct; |
| 57 | 57 |
| 58 typedef NSQ_sample_struct NSQ_sample_pair[ 2 ]; | 58 typedef NSQ_sample_struct NSQ_sample_pair[ 2 ]; |
| 59 | 59 |
| 60 #if defined(MIPSr1_ASM) |
| 61 #include "mips/NSQ_del_dec_mipsr1.h" |
| 62 #endif |
| 60 static OPUS_INLINE void silk_nsq_del_dec_scale_states( | 63 static OPUS_INLINE void silk_nsq_del_dec_scale_states( |
| 61 const silk_encoder_state *psEncC, /* I Encoder State
*/ | 64 const silk_encoder_state *psEncC, /* I Encoder State
*/ |
| 62 silk_nsq_state *NSQ, /* I/O NSQ state
*/ | 65 silk_nsq_state *NSQ, /* I/O NSQ state
*/ |
| 63 NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision sta
tes */ | 66 NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision sta
tes */ |
| 64 const opus_int32 x_Q3[], /* I Input in Q3
*/ | 67 const opus_int32 x_Q3[], /* I Input in Q3
*/ |
| 65 opus_int32 x_sc_Q10[], /* O Input scaled with 1/
Gain in Q10 */ | 68 opus_int32 x_sc_Q10[], /* O Input scaled with 1/
Gain in Q10 */ |
| 66 const opus_int16 sLTP[], /* I Re-whitened LTP stat
e in Q0 */ | 69 const opus_int16 sLTP[], /* I Re-whitened LTP stat
e in Q0 */ |
| 67 opus_int32 sLTP_Q15[], /* O LTP state matching s
caled input */ | 70 opus_int32 sLTP_Q15[], /* O LTP state matching s
caled input */ |
| 68 opus_int subfr, /* I Subframe number
*/ | 71 opus_int subfr, /* I Subframe number
*/ |
| 69 opus_int nStatesDelayedDecision, /* I Number of del dec st
ates */ | 72 opus_int nStatesDelayedDecision, /* I Number of del dec st
ates */ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 99 opus_int length, /* I Input length
*/ | 102 opus_int length, /* I Input length
*/ |
| 100 opus_int subfr, /* I Subframe number
*/ | 103 opus_int subfr, /* I Subframe number
*/ |
| 101 opus_int shapingLPCOrder, /* I Shaping LPC filter order
*/ | 104 opus_int shapingLPCOrder, /* I Shaping LPC filter order
*/ |
| 102 opus_int predictLPCOrder, /* I Prediction filter order
*/ | 105 opus_int predictLPCOrder, /* I Prediction filter order
*/ |
| 103 opus_int warping_Q16, /* I
*/ | 106 opus_int warping_Q16, /* I
*/ |
| 104 opus_int nStatesDelayedDecision, /* I Number of states in deci
sion tree */ | 107 opus_int nStatesDelayedDecision, /* I Number of states in deci
sion tree */ |
| 105 opus_int *smpl_buf_idx, /* I Index to newest samples
in buffers */ | 108 opus_int *smpl_buf_idx, /* I Index to newest samples
in buffers */ |
| 106 opus_int decisionDelay /* I
*/ | 109 opus_int decisionDelay /* I
*/ |
| 107 ); | 110 ); |
| 108 | 111 |
| 109 void silk_NSQ_del_dec( | 112 void silk_NSQ_del_dec_c( |
| 110 const silk_encoder_state *psEncC, /* I
/O Encoder State */ | 113 const silk_encoder_state *psEncC, /* I
/O Encoder State */ |
| 111 silk_nsq_state *NSQ, /* I
/O NSQ state */ | 114 silk_nsq_state *NSQ, /* I
/O NSQ state */ |
| 112 SideInfoIndices *psIndices, /* I
/O Quantization Indices */ | 115 SideInfoIndices *psIndices, /* I
/O Quantization Indices */ |
| 113 const opus_int32 x_Q3[], /* I
Prefiltered input signal */ | 116 const opus_int32 x_Q3[], /* I
Prefiltered input signal */ |
| 114 opus_int8 pulses[], /* O
Quantized pulse signal */ | 117 opus_int8 pulses[], /* O
Quantized pulse signal */ |
| 115 const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I
Short term prediction coefs */ | 118 const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I
Short term prediction coefs */ |
| 116 const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I
Long term prediction coefs */ | 119 const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I
Long term prediction coefs */ |
| 117 const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /
* I Noise shaping coefs */ | 120 const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /
* I Noise shaping coefs */ |
| 118 const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I
Long term shaping coefs */ | 121 const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I
Long term shaping coefs */ |
| 119 const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I
Spectral tilt */ | 122 const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I
Spectral tilt */ |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } | 240 } |
| 238 | 241 |
| 239 subfr = 0; | 242 subfr = 0; |
| 240 } | 243 } |
| 241 | 244 |
| 242 /* Rewhiten with new A coefs */ | 245 /* Rewhiten with new A coefs */ |
| 243 start_idx = psEncC->ltp_mem_length - lag - psEncC->predictLPCOrd
er - LTP_ORDER / 2; | 246 start_idx = psEncC->ltp_mem_length - lag - psEncC->predictLPCOrd
er - LTP_ORDER / 2; |
| 244 silk_assert( start_idx > 0 ); | 247 silk_assert( start_idx > 0 ); |
| 245 | 248 |
| 246 silk_LPC_analysis_filter( &sLTP[ start_idx ], &NSQ->xq[ start_id
x + k * psEncC->subfr_length ], | 249 silk_LPC_analysis_filter( &sLTP[ start_idx ], &NSQ->xq[ start_id
x + k * psEncC->subfr_length ], |
| 247 A_Q12, psEncC->ltp_mem_length - start_idx, psEncC->predictLP
COrder ); | 250 A_Q12, psEncC->ltp_mem_length - start_idx, psEncC->predictLP
COrder, psEncC->arch ); |
| 248 | 251 |
| 249 NSQ->sLTP_buf_idx = psEncC->ltp_mem_length; | 252 NSQ->sLTP_buf_idx = psEncC->ltp_mem_length; |
| 250 NSQ->rewhite_flag = 1; | 253 NSQ->rewhite_flag = 1; |
| 251 } | 254 } |
| 252 } | 255 } |
| 253 | 256 |
| 254 silk_nsq_del_dec_scale_states( psEncC, NSQ, psDelDec, x_Q3, x_sc_Q10, sL
TP, sLTP_Q15, k, | 257 silk_nsq_del_dec_scale_states( psEncC, NSQ, psDelDec, x_Q3, x_sc_Q10, sL
TP, sLTP_Q15, k, |
| 255 psEncC->nStatesDelayedDecision, LTP_scale_Q14, Gains_Q16, pitchL, ps
Indices->signalType, decisionDelay ); | 258 psEncC->nStatesDelayedDecision, LTP_scale_Q14, Gains_Q16, pitchL, ps
Indices->signalType, decisionDelay ); |
| 256 | 259 |
| 257 silk_noise_shape_quantizer_del_dec( NSQ, psDelDec, psIndices->signalType
, x_sc_Q10, pulses, pxq, sLTP_Q15, | 260 silk_noise_shape_quantizer_del_dec( NSQ, psDelDec, psIndices->signalType
, x_sc_Q10, pulses, pxq, sLTP_Q15, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 /* Save quantized speech signal */ | 299 /* Save quantized speech signal */ |
| 297 /* DEBUG_STORE_DATA( enc.pcm, &NSQ->xq[psEncC->ltp_mem_length], psEncC->fram
e_length * sizeof( opus_int16 ) ) */ | 300 /* DEBUG_STORE_DATA( enc.pcm, &NSQ->xq[psEncC->ltp_mem_length], psEncC->fram
e_length * sizeof( opus_int16 ) ) */ |
| 298 silk_memmove( NSQ->xq, &NSQ->xq[ psEncC->frame_length ],
psEncC->ltp_mem_length * sizeof( opus_int16 ) ); | 301 silk_memmove( NSQ->xq, &NSQ->xq[ psEncC->frame_length ],
psEncC->ltp_mem_length * sizeof( opus_int16 ) ); |
| 299 silk_memmove( NSQ->sLTP_shp_Q14, &NSQ->sLTP_shp_Q14[ psEncC->frame_length ],
psEncC->ltp_mem_length * sizeof( opus_int32 ) ); | 302 silk_memmove( NSQ->sLTP_shp_Q14, &NSQ->sLTP_shp_Q14[ psEncC->frame_length ],
psEncC->ltp_mem_length * sizeof( opus_int32 ) ); |
| 300 RESTORE_STACK; | 303 RESTORE_STACK; |
| 301 } | 304 } |
| 302 | 305 |
| 303 /******************************************/ | 306 /******************************************/ |
| 304 /* Noise shape quantizer for one subframe */ | 307 /* Noise shape quantizer for one subframe */ |
| 305 /******************************************/ | 308 /******************************************/ |
| 309 #ifndef OVERRIDE_silk_noise_shape_quantizer_del_dec |
| 306 static OPUS_INLINE void silk_noise_shape_quantizer_del_dec( | 310 static OPUS_INLINE void silk_noise_shape_quantizer_del_dec( |
| 307 silk_nsq_state *NSQ, /* I/O NSQ state
*/ | 311 silk_nsq_state *NSQ, /* I/O NSQ state
*/ |
| 308 NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states
*/ | 312 NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states
*/ |
| 309 opus_int signalType, /* I Signal type
*/ | 313 opus_int signalType, /* I Signal type
*/ |
| 310 const opus_int32 x_Q10[], /* I
*/ | 314 const opus_int32 x_Q10[], /* I
*/ |
| 311 opus_int8 pulses[], /* O
*/ | 315 opus_int8 pulses[], /* O
*/ |
| 312 opus_int16 xq[], /* O
*/ | 316 opus_int16 xq[], /* O
*/ |
| 313 opus_int32 sLTP_Q15[], /* I/O LTP filter state
*/ | 317 opus_int32 sLTP_Q15[], /* I/O LTP filter state
*/ |
| 314 opus_int32 delayedGain_Q10[], /* I/O Gain delay buffer
*/ | 318 opus_int32 delayedGain_Q10[], /* I/O Gain delay buffer
*/ |
| 315 const opus_int16 a_Q12[], /* I Short term prediction co
efs */ | 319 const opus_int16 a_Q12[], /* I Short term prediction co
efs */ |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 } | 626 } |
| 623 delayedGain_Q10[ *smpl_buf_idx ] = Gain_Q10; | 627 delayedGain_Q10[ *smpl_buf_idx ] = Gain_Q10; |
| 624 } | 628 } |
| 625 /* Update LPC states */ | 629 /* Update LPC states */ |
| 626 for( k = 0; k < nStatesDelayedDecision; k++ ) { | 630 for( k = 0; k < nStatesDelayedDecision; k++ ) { |
| 627 psDD = &psDelDec[ k ]; | 631 psDD = &psDelDec[ k ]; |
| 628 silk_memcpy( psDD->sLPC_Q14, &psDD->sLPC_Q14[ length ], NSQ_LPC_BUF_LENG
TH * sizeof( opus_int32 ) ); | 632 silk_memcpy( psDD->sLPC_Q14, &psDD->sLPC_Q14[ length ], NSQ_LPC_BUF_LENG
TH * sizeof( opus_int32 ) ); |
| 629 } | 633 } |
| 630 RESTORE_STACK; | 634 RESTORE_STACK; |
| 631 } | 635 } |
| 636 #endif /* OVERRIDE_silk_noise_shape_quantizer_del_dec */ |
| 632 | 637 |
| 633 static OPUS_INLINE void silk_nsq_del_dec_scale_states( | 638 static OPUS_INLINE void silk_nsq_del_dec_scale_states( |
| 634 const silk_encoder_state *psEncC, /* I Encoder State
*/ | 639 const silk_encoder_state *psEncC, /* I Encoder State
*/ |
| 635 silk_nsq_state *NSQ, /* I/O NSQ state
*/ | 640 silk_nsq_state *NSQ, /* I/O NSQ state
*/ |
| 636 NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision sta
tes */ | 641 NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision sta
tes */ |
| 637 const opus_int32 x_Q3[], /* I Input in Q3
*/ | 642 const opus_int32 x_Q3[], /* I Input in Q3
*/ |
| 638 opus_int32 x_sc_Q10[], /* O Input scaled with 1/
Gain in Q10 */ | 643 opus_int32 x_sc_Q10[], /* O Input scaled with 1/
Gain in Q10 */ |
| 639 const opus_int16 sLTP[], /* I Re-whitened LTP stat
e in Q0 */ | 644 const opus_int16 sLTP[], /* I Re-whitened LTP stat
e in Q0 */ |
| 640 opus_int32 sLTP_Q15[], /* O LTP state matching s
caled input */ | 645 opus_int32 sLTP_Q15[], /* O LTP state matching s
caled input */ |
| 641 opus_int subfr, /* I Subframe number
*/ | 646 opus_int subfr, /* I Subframe number
*/ |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 for( i = 0; i < MAX_SHAPE_LPC_ORDER; i++ ) { | 715 for( i = 0; i < MAX_SHAPE_LPC_ORDER; i++ ) { |
| 711 psDD->sAR2_Q14[ i ] = silk_SMULWW( gain_adj_Q16, psDD->sAR2_Q14[
i ] ); | 716 psDD->sAR2_Q14[ i ] = silk_SMULWW( gain_adj_Q16, psDD->sAR2_Q14[
i ] ); |
| 712 } | 717 } |
| 713 for( i = 0; i < DECISION_DELAY; i++ ) { | 718 for( i = 0; i < DECISION_DELAY; i++ ) { |
| 714 psDD->Pred_Q15[ i ] = silk_SMULWW( gain_adj_Q16, psDD->Pred_Q15
[ i ] ); | 719 psDD->Pred_Q15[ i ] = silk_SMULWW( gain_adj_Q16, psDD->Pred_Q15
[ i ] ); |
| 715 psDD->Shape_Q14[ i ] = silk_SMULWW( gain_adj_Q16, psDD->Shape_Q1
4[ i ] ); | 720 psDD->Shape_Q14[ i ] = silk_SMULWW( gain_adj_Q16, psDD->Shape_Q1
4[ i ] ); |
| 716 } | 721 } |
| 717 } | 722 } |
| 718 } | 723 } |
| 719 } | 724 } |
| OLD | NEW |