| 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. |
| 11 - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 - Neither the name of Internet Society, IETF or IETF Trust, nor the |
| 12 names of specific contributors, may be used to endorse or promote | 12 names of specific contributors, may be used to endorse or promote |
| 13 products derived from this software without specific prior written | 13 products derived from this software without specific prior written |
| 14 permission. | 14 permission. |
| 15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” | 15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 16 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 16 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 17 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 18 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | 18 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 19 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 19 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 20 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 20 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 21 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 21 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 22 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 22 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 23 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 23 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 24 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 24 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 25 POSSIBILITY OF SUCH DAMAGE. | 25 POSSIBILITY OF SUCH DAMAGE. |
| 26 ***********************************************************************/ | 26 ***********************************************************************/ |
| 27 | 27 |
| 28 #ifdef HAVE_CONFIG_H | 28 #ifdef HAVE_CONFIG_H |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 #include "main.h" | 32 #include "main.h" |
| 33 #include "stack_alloc.h" |
| 33 | 34 |
| 34 typedef struct { | 35 typedef struct { |
| 35 opus_int32 sLPC_Q14[ MAX_SUB_FRAME_LENGTH + NSQ_LPC_BUF_LENGTH ]; | 36 opus_int32 sLPC_Q14[ MAX_SUB_FRAME_LENGTH + NSQ_LPC_BUF_LENGTH ]; |
| 36 opus_int32 RandState[ DECISION_DELAY ]; | 37 opus_int32 RandState[ DECISION_DELAY ]; |
| 37 opus_int32 Q_Q10[ DECISION_DELAY ]; | 38 opus_int32 Q_Q10[ DECISION_DELAY ]; |
| 38 opus_int32 Xq_Q14[ DECISION_DELAY ]; | 39 opus_int32 Xq_Q14[ DECISION_DELAY ]; |
| 39 opus_int32 Pred_Q15[ DECISION_DELAY ]; | 40 opus_int32 Pred_Q15[ DECISION_DELAY ]; |
| 40 opus_int32 Shape_Q14[ DECISION_DELAY ]; | 41 opus_int32 Shape_Q14[ DECISION_DELAY ]; |
| 41 opus_int32 sAR2_Q14[ MAX_SHAPE_LPC_ORDER ]; | 42 opus_int32 sAR2_Q14[ MAX_SHAPE_LPC_ORDER ]; |
| 42 opus_int32 LF_AR_Q14; | 43 opus_int32 LF_AR_Q14; |
| 43 opus_int32 Seed; | 44 opus_int32 Seed; |
| 44 opus_int32 SeedInit; | 45 opus_int32 SeedInit; |
| 45 opus_int32 RD_Q10; | 46 opus_int32 RD_Q10; |
| 46 } NSQ_del_dec_struct; | 47 } NSQ_del_dec_struct; |
| 47 | 48 |
| 48 typedef struct { | 49 typedef struct { |
| 49 opus_int32 Q_Q10; | 50 opus_int32 Q_Q10; |
| 50 opus_int32 RD_Q10; | 51 opus_int32 RD_Q10; |
| 51 opus_int32 xq_Q14; | 52 opus_int32 xq_Q14; |
| 52 opus_int32 LF_AR_Q14; | 53 opus_int32 LF_AR_Q14; |
| 53 opus_int32 sLTP_shp_Q14; | 54 opus_int32 sLTP_shp_Q14; |
| 54 opus_int32 LPC_exc_Q14; | 55 opus_int32 LPC_exc_Q14; |
| 55 } NSQ_sample_struct; | 56 } NSQ_sample_struct; |
| 56 | 57 |
| 58 typedef NSQ_sample_struct NSQ_sample_pair[ 2 ]; |
| 59 |
| 57 static inline void silk_nsq_del_dec_scale_states( | 60 static inline void silk_nsq_del_dec_scale_states( |
| 58 const silk_encoder_state *psEncC, /* I Encoder State
*/ | 61 const silk_encoder_state *psEncC, /* I Encoder State
*/ |
| 59 silk_nsq_state *NSQ, /* I/O NSQ state
*/ | 62 silk_nsq_state *NSQ, /* I/O NSQ state
*/ |
| 60 NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision sta
tes */ | 63 NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision sta
tes */ |
| 61 const opus_int32 x_Q3[], /* I Input in Q3
*/ | 64 const opus_int32 x_Q3[], /* I Input in Q3
*/ |
| 62 opus_int32 x_sc_Q10[], /* O Input scaled with 1/
Gain in Q10 */ | 65 opus_int32 x_sc_Q10[], /* O Input scaled with 1/
Gain in Q10 */ |
| 63 const opus_int16 sLTP[], /* I Re-whitened LTP stat
e in Q0 */ | 66 const opus_int16 sLTP[], /* I Re-whitened LTP stat
e in Q0 */ |
| 64 opus_int32 sLTP_Q15[], /* O LTP state matching s
caled input */ | 67 opus_int32 sLTP_Q15[], /* O LTP state matching s
caled input */ |
| 65 opus_int subfr, /* I Subframe number
*/ | 68 opus_int subfr, /* I Subframe number
*/ |
| 66 opus_int nStatesDelayedDecision, /* I Number of del dec st
ates */ | 69 opus_int nStatesDelayedDecision, /* I Number of del dec st
ates */ |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I
Spectral tilt */ | 119 const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I
Spectral tilt */ |
| 117 const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I
Low frequency shaping coefs */ | 120 const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I
Low frequency shaping coefs */ |
| 118 const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I
Quantization step sizes */ | 121 const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I
Quantization step sizes */ |
| 119 const opus_int pitchL[ MAX_NB_SUBFR ], /* I
Pitch lags */ | 122 const opus_int pitchL[ MAX_NB_SUBFR ], /* I
Pitch lags */ |
| 120 const opus_int Lambda_Q10, /* I
Rate/distortion tradeoff */ | 123 const opus_int Lambda_Q10, /* I
Rate/distortion tradeoff */ |
| 121 const opus_int LTP_scale_Q14 /* I
LTP state scaling */ | 124 const opus_int LTP_scale_Q14 /* I
LTP state scaling */ |
| 122 ) | 125 ) |
| 123 { | 126 { |
| 124 opus_int i, k, lag, start_idx, LSF_interpolation_flag, Winner_ind
, subfr; | 127 opus_int i, k, lag, start_idx, LSF_interpolation_flag, Winner_ind
, subfr; |
| 125 opus_int last_smple_idx, smpl_buf_idx, decisionDelay; | 128 opus_int last_smple_idx, smpl_buf_idx, decisionDelay; |
| 126 const opus_int16 » *A_Q12, *B_Q14, *AR_shp_Q13; | 129 const opus_int16 *A_Q12, *B_Q14, *AR_shp_Q13; |
| 127 opus_int16 *pxq; | 130 opus_int16 *pxq; |
| 128 opus_int32 sLTP_Q15[ 2 * MAX_FRAME_LENGTH ]; | 131 VARDECL( opus_int32, sLTP_Q15 ); |
| 129 opus_int16 sLTP[ 2 * MAX_FRAME_LENGTH ]; | 132 VARDECL( opus_int16, sLTP ); |
| 130 opus_int32 HarmShapeFIRPacked_Q14; | 133 opus_int32 HarmShapeFIRPacked_Q14; |
| 131 opus_int offset_Q10; | 134 opus_int offset_Q10; |
| 132 opus_int32 RDmin_Q10, Gain_Q10; | 135 opus_int32 RDmin_Q10, Gain_Q10; |
| 133 opus_int32 x_sc_Q10[ MAX_SUB_FRAME_LENGTH ]; | 136 VARDECL( opus_int32, x_sc_Q10 ); |
| 134 opus_int32 delayedGain_Q10[ DECISION_DELAY ]; | 137 VARDECL( opus_int32, delayedGain_Q10 ); |
| 135 NSQ_del_dec_struct psDelDec[ MAX_DEL_DEC_STATES ]; | 138 VARDECL( NSQ_del_dec_struct, psDelDec ); |
| 136 NSQ_del_dec_struct *psDD; | 139 NSQ_del_dec_struct *psDD; |
| 140 SAVE_STACK; |
| 137 | 141 |
| 138 /* Set unvoiced lag to the previous one, overwrite later for voiced */ | 142 /* Set unvoiced lag to the previous one, overwrite later for voiced */ |
| 139 lag = NSQ->lagPrev; | 143 lag = NSQ->lagPrev; |
| 140 | 144 |
| 141 silk_assert( NSQ->prev_gain_Q16 != 0 ); | 145 silk_assert( NSQ->prev_gain_Q16 != 0 ); |
| 142 | 146 |
| 143 /* Initialize delayed decision states */ | 147 /* Initialize delayed decision states */ |
| 148 ALLOC( psDelDec, psEncC->nStatesDelayedDecision, NSQ_del_dec_struct ); |
| 144 silk_memset( psDelDec, 0, psEncC->nStatesDelayedDecision * sizeof( NSQ_del_d
ec_struct ) ); | 149 silk_memset( psDelDec, 0, psEncC->nStatesDelayedDecision * sizeof( NSQ_del_d
ec_struct ) ); |
| 145 for( k = 0; k < psEncC->nStatesDelayedDecision; k++ ) { | 150 for( k = 0; k < psEncC->nStatesDelayedDecision; k++ ) { |
| 146 psDD = &psDelDec[ k ]; | 151 psDD = &psDelDec[ k ]; |
| 147 psDD->Seed = ( k + psIndices->Seed ) & 3; | 152 psDD->Seed = ( k + psIndices->Seed ) & 3; |
| 148 psDD->SeedInit = psDD->Seed; | 153 psDD->SeedInit = psDD->Seed; |
| 149 psDD->RD_Q10 = 0; | 154 psDD->RD_Q10 = 0; |
| 150 psDD->LF_AR_Q14 = NSQ->sLF_AR_shp_Q14; | 155 psDD->LF_AR_Q14 = NSQ->sLF_AR_shp_Q14; |
| 151 psDD->Shape_Q14[ 0 ] = NSQ->sLTP_shp_Q14[ psEncC->ltp_mem_length - 1 ]; | 156 psDD->Shape_Q14[ 0 ] = NSQ->sLTP_shp_Q14[ psEncC->ltp_mem_length - 1 ]; |
| 152 silk_memcpy( psDD->sLPC_Q14, NSQ->sLPC_Q14, NSQ_LPC_BUF_LENGTH * sizeof(
opus_int32 ) ); | 157 silk_memcpy( psDD->sLPC_Q14, NSQ->sLPC_Q14, NSQ_LPC_BUF_LENGTH * sizeof(
opus_int32 ) ); |
| 153 silk_memcpy( psDD->sAR2_Q14, NSQ->sAR2_Q14, sizeof( NSQ->sAR2_Q14 ) ); | 158 silk_memcpy( psDD->sAR2_Q14, NSQ->sAR2_Q14, sizeof( NSQ->sAR2_Q14 ) ); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 168 decisionDelay = silk_min_int( decisionDelay, lag - LTP_ORDER / 2 - 1
); | 173 decisionDelay = silk_min_int( decisionDelay, lag - LTP_ORDER / 2 - 1
); |
| 169 } | 174 } |
| 170 } | 175 } |
| 171 | 176 |
| 172 if( psIndices->NLSFInterpCoef_Q2 == 4 ) { | 177 if( psIndices->NLSFInterpCoef_Q2 == 4 ) { |
| 173 LSF_interpolation_flag = 0; | 178 LSF_interpolation_flag = 0; |
| 174 } else { | 179 } else { |
| 175 LSF_interpolation_flag = 1; | 180 LSF_interpolation_flag = 1; |
| 176 } | 181 } |
| 177 | 182 |
| 183 ALLOC( sLTP_Q15, |
| 184 psEncC->ltp_mem_length + psEncC->frame_length, opus_int32 ); |
| 185 ALLOC( sLTP, psEncC->ltp_mem_length + psEncC->frame_length, opus_int16 ); |
| 186 ALLOC( x_sc_Q10, psEncC->subfr_length, opus_int32 ); |
| 187 ALLOC( delayedGain_Q10, DECISION_DELAY, opus_int32 ); |
| 178 /* Set up pointers to start of sub frame */ | 188 /* Set up pointers to start of sub frame */ |
| 179 pxq = &NSQ->xq[ psEncC->ltp_mem_length ]; | 189 pxq = &NSQ->xq[ psEncC->ltp_mem_length ]; |
| 180 NSQ->sLTP_shp_buf_idx = psEncC->ltp_mem_length; | 190 NSQ->sLTP_shp_buf_idx = psEncC->ltp_mem_length; |
| 181 NSQ->sLTP_buf_idx = psEncC->ltp_mem_length; | 191 NSQ->sLTP_buf_idx = psEncC->ltp_mem_length; |
| 182 subfr = 0; | 192 subfr = 0; |
| 183 for( k = 0; k < psEncC->nb_subfr; k++ ) { | 193 for( k = 0; k < psEncC->nb_subfr; k++ ) { |
| 184 A_Q12 = &PredCoef_Q12[ ( ( k >> 1 ) | ( 1 - LSF_interpolation_flag
) ) * MAX_LPC_ORDER ]; | 194 A_Q12 = &PredCoef_Q12[ ( ( k >> 1 ) | ( 1 - LSF_interpolation_flag
) ) * MAX_LPC_ORDER ]; |
| 185 B_Q14 = <PCoef_Q14[ k * LTP_ORDER ]; | 195 B_Q14 = <PCoef_Q14[ k * LTP_ORDER ]; |
| 186 AR_shp_Q13 = &AR2_Q13[ k * MAX_SHAPE_LPC_ORDER ]; | 196 AR_shp_Q13 = &AR2_Q13[ k * MAX_SHAPE_LPC_ORDER ]; |
| 187 | 197 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 silk_memcpy( NSQ->sAR2_Q14, psDD->sAR2_Q14, sizeof( psDD->sAR2_Q14 ) ); | 290 silk_memcpy( NSQ->sAR2_Q14, psDD->sAR2_Q14, sizeof( psDD->sAR2_Q14 ) ); |
| 281 | 291 |
| 282 /* Update states */ | 292 /* Update states */ |
| 283 NSQ->sLF_AR_shp_Q14 = psDD->LF_AR_Q14; | 293 NSQ->sLF_AR_shp_Q14 = psDD->LF_AR_Q14; |
| 284 NSQ->lagPrev = pitchL[ psEncC->nb_subfr - 1 ]; | 294 NSQ->lagPrev = pitchL[ psEncC->nb_subfr - 1 ]; |
| 285 | 295 |
| 286 /* Save quantized speech signal */ | 296 /* Save quantized speech signal */ |
| 287 /* DEBUG_STORE_DATA( enc.pcm, &NSQ->xq[psEncC->ltp_mem_length], psEncC->fram
e_length * sizeof( opus_int16 ) ) */ | 297 /* DEBUG_STORE_DATA( enc.pcm, &NSQ->xq[psEncC->ltp_mem_length], psEncC->fram
e_length * sizeof( opus_int16 ) ) */ |
| 288 silk_memmove( NSQ->xq, &NSQ->xq[ psEncC->frame_length ],
psEncC->ltp_mem_length * sizeof( opus_int16 ) ); | 298 silk_memmove( NSQ->xq, &NSQ->xq[ psEncC->frame_length ],
psEncC->ltp_mem_length * sizeof( opus_int16 ) ); |
| 289 silk_memmove( NSQ->sLTP_shp_Q14, &NSQ->sLTP_shp_Q14[ psEncC->frame_length ],
psEncC->ltp_mem_length * sizeof( opus_int32 ) ); | 299 silk_memmove( NSQ->sLTP_shp_Q14, &NSQ->sLTP_shp_Q14[ psEncC->frame_length ],
psEncC->ltp_mem_length * sizeof( opus_int32 ) ); |
| 300 RESTORE_STACK; |
| 290 } | 301 } |
| 291 | 302 |
| 292 /******************************************/ | 303 /******************************************/ |
| 293 /* Noise shape quantizer for one subframe */ | 304 /* Noise shape quantizer for one subframe */ |
| 294 /******************************************/ | 305 /******************************************/ |
| 295 static inline void silk_noise_shape_quantizer_del_dec( | 306 static inline void silk_noise_shape_quantizer_del_dec( |
| 296 silk_nsq_state *NSQ, /* I/O NSQ state
*/ | 307 silk_nsq_state *NSQ, /* I/O NSQ state
*/ |
| 297 NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states
*/ | 308 NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states
*/ |
| 298 opus_int signalType, /* I Signal type
*/ | 309 opus_int signalType, /* I Signal type
*/ |
| 299 const opus_int32 x_Q10[], /* I
*/ | 310 const opus_int32 x_Q10[], /* I
*/ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 321 opus_int decisionDelay /* I
*/ | 332 opus_int decisionDelay /* I
*/ |
| 322 ) | 333 ) |
| 323 { | 334 { |
| 324 opus_int i, j, k, Winner_ind, RDmin_ind, RDmax_ind, last_smple_idx; | 335 opus_int i, j, k, Winner_ind, RDmin_ind, RDmax_ind, last_smple_idx; |
| 325 opus_int32 Winner_rand_state; | 336 opus_int32 Winner_rand_state; |
| 326 opus_int32 LTP_pred_Q14, LPC_pred_Q14, n_AR_Q14, n_LTP_Q14; | 337 opus_int32 LTP_pred_Q14, LPC_pred_Q14, n_AR_Q14, n_LTP_Q14; |
| 327 opus_int32 n_LF_Q14, r_Q10, rr_Q10, rd1_Q10, rd2_Q10, RDmin_Q10, RDmax_Q10
; | 338 opus_int32 n_LF_Q14, r_Q10, rr_Q10, rd1_Q10, rd2_Q10, RDmin_Q10, RDmax_Q10
; |
| 328 opus_int32 q1_Q0, q1_Q10, q2_Q10, exc_Q14, LPC_exc_Q14, xq_Q14, Gain_Q10; | 339 opus_int32 q1_Q0, q1_Q10, q2_Q10, exc_Q14, LPC_exc_Q14, xq_Q14, Gain_Q10; |
| 329 opus_int32 tmp1, tmp2, sLF_AR_shp_Q14; | 340 opus_int32 tmp1, tmp2, sLF_AR_shp_Q14; |
| 330 opus_int32 *pred_lag_ptr, *shp_lag_ptr, *psLPC_Q14; | 341 opus_int32 *pred_lag_ptr, *shp_lag_ptr, *psLPC_Q14; |
| 331 NSQ_sample_struct psSampleState[ MAX_DEL_DEC_STATES ][ 2 ]; | 342 VARDECL( NSQ_sample_pair, psSampleState ); |
| 332 NSQ_del_dec_struct *psDD; | 343 NSQ_del_dec_struct *psDD; |
| 333 NSQ_sample_struct *psSS; | 344 NSQ_sample_struct *psSS; |
| 345 SAVE_STACK; |
| 334 | 346 |
| 335 silk_assert( nStatesDelayedDecision > 0 ); | 347 silk_assert( nStatesDelayedDecision > 0 ); |
| 348 ALLOC( psSampleState, nStatesDelayedDecision, NSQ_sample_pair ); |
| 336 | 349 |
| 337 shp_lag_ptr = &NSQ->sLTP_shp_Q14[ NSQ->sLTP_shp_buf_idx - lag + HARM_SHAPE_
FIR_TAPS / 2 ]; | 350 shp_lag_ptr = &NSQ->sLTP_shp_Q14[ NSQ->sLTP_shp_buf_idx - lag + HARM_SHAPE_
FIR_TAPS / 2 ]; |
| 338 pred_lag_ptr = &sLTP_Q15[ NSQ->sLTP_buf_idx - lag + LTP_ORDER / 2 ]; | 351 pred_lag_ptr = &sLTP_Q15[ NSQ->sLTP_buf_idx - lag + LTP_ORDER / 2 ]; |
| 339 Gain_Q10 = silk_RSHIFT( Gain_Q16, 6 ); | 352 Gain_Q10 = silk_RSHIFT( Gain_Q16, 6 ); |
| 340 | 353 |
| 341 for( i = 0; i < length; i++ ) { | 354 for( i = 0; i < length; i++ ) { |
| 342 /* Perform common calculations used in all states */ | 355 /* Perform common calculations used in all states */ |
| 343 | 356 |
| 344 /* Long-term prediction */ | 357 /* Long-term prediction */ |
| 345 if( signalType == TYPE_VOICED ) { | 358 if( signalType == TYPE_VOICED ) { |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 psDD->RandState[ *smpl_buf_idx ] = psDD->Seed; | 620 psDD->RandState[ *smpl_buf_idx ] = psDD->Seed; |
| 608 psDD->RD_Q10 = psSS->RD_Q10; | 621 psDD->RD_Q10 = psSS->RD_Q10; |
| 609 } | 622 } |
| 610 delayedGain_Q10[ *smpl_buf_idx ] = Gain_Q10; | 623 delayedGain_Q10[ *smpl_buf_idx ] = Gain_Q10; |
| 611 } | 624 } |
| 612 /* Update LPC states */ | 625 /* Update LPC states */ |
| 613 for( k = 0; k < nStatesDelayedDecision; k++ ) { | 626 for( k = 0; k < nStatesDelayedDecision; k++ ) { |
| 614 psDD = &psDelDec[ k ]; | 627 psDD = &psDelDec[ k ]; |
| 615 silk_memcpy( psDD->sLPC_Q14, &psDD->sLPC_Q14[ length ], NSQ_LPC_BUF_LENG
TH * sizeof( opus_int32 ) ); | 628 silk_memcpy( psDD->sLPC_Q14, &psDD->sLPC_Q14[ length ], NSQ_LPC_BUF_LENG
TH * sizeof( opus_int32 ) ); |
| 616 } | 629 } |
| 630 RESTORE_STACK; |
| 617 } | 631 } |
| 618 | 632 |
| 619 static inline void silk_nsq_del_dec_scale_states( | 633 static inline void silk_nsq_del_dec_scale_states( |
| 620 const silk_encoder_state *psEncC, /* I Encoder State
*/ | 634 const silk_encoder_state *psEncC, /* I Encoder State
*/ |
| 621 silk_nsq_state *NSQ, /* I/O NSQ state
*/ | 635 silk_nsq_state *NSQ, /* I/O NSQ state
*/ |
| 622 NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision sta
tes */ | 636 NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision sta
tes */ |
| 623 const opus_int32 x_Q3[], /* I Input in Q3
*/ | 637 const opus_int32 x_Q3[], /* I Input in Q3
*/ |
| 624 opus_int32 x_sc_Q10[], /* O Input scaled with 1/
Gain in Q10 */ | 638 opus_int32 x_sc_Q10[], /* O Input scaled with 1/
Gain in Q10 */ |
| 625 const opus_int16 sLTP[], /* I Re-whitened LTP stat
e in Q0 */ | 639 const opus_int16 sLTP[], /* I Re-whitened LTP stat
e in Q0 */ |
| 626 opus_int32 sLTP_Q15[], /* O LTP state matching s
caled input */ | 640 opus_int32 sLTP_Q15[], /* O LTP state matching s
caled input */ |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 for( i = 0; i < MAX_SHAPE_LPC_ORDER; i++ ) { | 710 for( i = 0; i < MAX_SHAPE_LPC_ORDER; i++ ) { |
| 697 psDD->sAR2_Q14[ i ] = silk_SMULWW( gain_adj_Q16, psDD->sAR2_Q14[
i ] ); | 711 psDD->sAR2_Q14[ i ] = silk_SMULWW( gain_adj_Q16, psDD->sAR2_Q14[
i ] ); |
| 698 } | 712 } |
| 699 for( i = 0; i < DECISION_DELAY; i++ ) { | 713 for( i = 0; i < DECISION_DELAY; i++ ) { |
| 700 psDD->Pred_Q15[ i ] = silk_SMULWW( gain_adj_Q16, psDD->Pred_Q15
[ i ] ); | 714 psDD->Pred_Q15[ i ] = silk_SMULWW( gain_adj_Q16, psDD->Pred_Q15
[ i ] ); |
| 701 psDD->Shape_Q14[ i ] = silk_SMULWW( gain_adj_Q16, psDD->Shape_Q1
4[ i ] ); | 715 psDD->Shape_Q14[ i ] = silk_SMULWW( gain_adj_Q16, psDD->Shape_Q1
4[ i ] ); |
| 702 } | 716 } |
| 703 } | 717 } |
| 704 } | 718 } |
| 705 } | 719 } |
| OLD | NEW |