| 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 14 matching lines...) Expand all Loading... |
| 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 #include "stack_alloc.h" |
| 34 | 34 |
| 35 static inline void silk_nsq_scale_states( | 35 static OPUS_INLINE void silk_nsq_scale_states( |
| 36 const silk_encoder_state *psEncC, /* I Encoder State
*/ | 36 const silk_encoder_state *psEncC, /* I Encoder State
*/ |
| 37 silk_nsq_state *NSQ, /* I/O NSQ state
*/ | 37 silk_nsq_state *NSQ, /* I/O NSQ state
*/ |
| 38 const opus_int32 x_Q3[], /* I input in Q3
*/ | 38 const opus_int32 x_Q3[], /* I input in Q3
*/ |
| 39 opus_int32 x_sc_Q10[], /* O input scaled with 1/Gain
*/ | 39 opus_int32 x_sc_Q10[], /* O input scaled with 1/Gain
*/ |
| 40 const opus_int16 sLTP[], /* I re-whitened LTP state in
Q0 */ | 40 const opus_int16 sLTP[], /* I re-whitened LTP state in
Q0 */ |
| 41 opus_int32 sLTP_Q15[], /* O LTP state matching scale
d input */ | 41 opus_int32 sLTP_Q15[], /* O LTP state matching scale
d input */ |
| 42 opus_int subfr, /* I subframe number
*/ | 42 opus_int subfr, /* I subframe number
*/ |
| 43 const opus_int LTP_scale_Q14, /* I
*/ | 43 const opus_int LTP_scale_Q14, /* I
*/ |
| 44 const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I
*/ | 44 const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I
*/ |
| 45 const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lag
*/ | 45 const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lag
*/ |
| 46 const opus_int signal_type /* I Signal type
*/ | 46 const opus_int signal_type /* I Signal type
*/ |
| 47 ); | 47 ); |
| 48 | 48 |
| 49 static inline void silk_noise_shape_quantizer( | 49 static OPUS_INLINE void silk_noise_shape_quantizer( |
| 50 silk_nsq_state *NSQ, /* I/O NSQ state
*/ | 50 silk_nsq_state *NSQ, /* I/O NSQ state
*/ |
| 51 opus_int signalType, /* I Signal type
*/ | 51 opus_int signalType, /* I Signal type
*/ |
| 52 const opus_int32 x_sc_Q10[], /* I
*/ | 52 const opus_int32 x_sc_Q10[], /* I
*/ |
| 53 opus_int8 pulses[], /* O
*/ | 53 opus_int8 pulses[], /* O
*/ |
| 54 opus_int16 xq[], /* O
*/ | 54 opus_int16 xq[], /* O
*/ |
| 55 opus_int32 sLTP_Q15[], /* I/O LTP state
*/ | 55 opus_int32 sLTP_Q15[], /* I/O LTP state
*/ |
| 56 const opus_int16 a_Q12[], /* I Short term prediction co
efs */ | 56 const opus_int16 a_Q12[], /* I Short term prediction co
efs */ |
| 57 const opus_int16 b_Q14[], /* I Long term prediction coe
fs */ | 57 const opus_int16 b_Q14[], /* I Long term prediction coe
fs */ |
| 58 const opus_int16 AR_shp_Q13[], /* I Noise shaping AR coefs
*/ | 58 const opus_int16 AR_shp_Q13[], /* I Noise shaping AR coefs
*/ |
| 59 opus_int lag, /* I Pitch lag
*/ | 59 opus_int lag, /* I Pitch lag
*/ |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 /* Save quantized speech and noise shaping signals */ | 165 /* Save quantized speech and noise shaping signals */ |
| 166 /* DEBUG_STORE_DATA( enc.pcm, &NSQ->xq[ psEncC->ltp_mem_length ], psEncC->fr
ame_length * sizeof( opus_int16 ) ) */ | 166 /* DEBUG_STORE_DATA( enc.pcm, &NSQ->xq[ psEncC->ltp_mem_length ], psEncC->fr
ame_length * sizeof( opus_int16 ) ) */ |
| 167 silk_memmove( NSQ->xq, &NSQ->xq[ psEncC->frame_length ],
psEncC->ltp_mem_length * sizeof( opus_int16 ) ); | 167 silk_memmove( NSQ->xq, &NSQ->xq[ psEncC->frame_length ],
psEncC->ltp_mem_length * sizeof( opus_int16 ) ); |
| 168 silk_memmove( NSQ->sLTP_shp_Q14, &NSQ->sLTP_shp_Q14[ psEncC->frame_length ],
psEncC->ltp_mem_length * sizeof( opus_int32 ) ); | 168 silk_memmove( NSQ->sLTP_shp_Q14, &NSQ->sLTP_shp_Q14[ psEncC->frame_length ],
psEncC->ltp_mem_length * sizeof( opus_int32 ) ); |
| 169 RESTORE_STACK; | 169 RESTORE_STACK; |
| 170 } | 170 } |
| 171 | 171 |
| 172 /***********************************/ | 172 /***********************************/ |
| 173 /* silk_noise_shape_quantizer */ | 173 /* silk_noise_shape_quantizer */ |
| 174 /***********************************/ | 174 /***********************************/ |
| 175 static inline void silk_noise_shape_quantizer( | 175 static OPUS_INLINE void silk_noise_shape_quantizer( |
| 176 silk_nsq_state *NSQ, /* I/O NSQ state
*/ | 176 silk_nsq_state *NSQ, /* I/O NSQ state
*/ |
| 177 opus_int signalType, /* I Signal type
*/ | 177 opus_int signalType, /* I Signal type
*/ |
| 178 const opus_int32 x_sc_Q10[], /* I
*/ | 178 const opus_int32 x_sc_Q10[], /* I
*/ |
| 179 opus_int8 pulses[], /* O
*/ | 179 opus_int8 pulses[], /* O
*/ |
| 180 opus_int16 xq[], /* O
*/ | 180 opus_int16 xq[], /* O
*/ |
| 181 opus_int32 sLTP_Q15[], /* I/O LTP state
*/ | 181 opus_int32 sLTP_Q15[], /* I/O LTP state
*/ |
| 182 const opus_int16 a_Q12[], /* I Short term prediction co
efs */ | 182 const opus_int16 a_Q12[], /* I Short term prediction co
efs */ |
| 183 const opus_int16 b_Q14[], /* I Long term prediction coe
fs */ | 183 const opus_int16 b_Q14[], /* I Long term prediction coe
fs */ |
| 184 const opus_int16 AR_shp_Q13[], /* I Noise shaping AR coefs
*/ | 184 const opus_int16 AR_shp_Q13[], /* I Noise shaping AR coefs
*/ |
| 185 opus_int lag, /* I Pitch lag
*/ | 185 opus_int lag, /* I Pitch lag
*/ |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 NSQ->sLTP_buf_idx++; | 363 NSQ->sLTP_buf_idx++; |
| 364 | 364 |
| 365 /* Make dither dependent on quantized signal */ | 365 /* Make dither dependent on quantized signal */ |
| 366 NSQ->rand_seed = silk_ADD32_ovflw( NSQ->rand_seed, pulses[ i ] ); | 366 NSQ->rand_seed = silk_ADD32_ovflw( NSQ->rand_seed, pulses[ i ] ); |
| 367 } | 367 } |
| 368 | 368 |
| 369 /* Update LPC synth buffer */ | 369 /* Update LPC synth buffer */ |
| 370 silk_memcpy( NSQ->sLPC_Q14, &NSQ->sLPC_Q14[ length ], NSQ_LPC_BUF_LENGTH * s
izeof( opus_int32 ) ); | 370 silk_memcpy( NSQ->sLPC_Q14, &NSQ->sLPC_Q14[ length ], NSQ_LPC_BUF_LENGTH * s
izeof( opus_int32 ) ); |
| 371 } | 371 } |
| 372 | 372 |
| 373 static inline void silk_nsq_scale_states( | 373 static OPUS_INLINE void silk_nsq_scale_states( |
| 374 const silk_encoder_state *psEncC, /* I Encoder State
*/ | 374 const silk_encoder_state *psEncC, /* I Encoder State
*/ |
| 375 silk_nsq_state *NSQ, /* I/O NSQ state
*/ | 375 silk_nsq_state *NSQ, /* I/O NSQ state
*/ |
| 376 const opus_int32 x_Q3[], /* I input in Q3
*/ | 376 const opus_int32 x_Q3[], /* I input in Q3
*/ |
| 377 opus_int32 x_sc_Q10[], /* O input scaled with 1/Gain
*/ | 377 opus_int32 x_sc_Q10[], /* O input scaled with 1/Gain
*/ |
| 378 const opus_int16 sLTP[], /* I re-whitened LTP state in
Q0 */ | 378 const opus_int16 sLTP[], /* I re-whitened LTP state in
Q0 */ |
| 379 opus_int32 sLTP_Q15[], /* O LTP state matching scale
d input */ | 379 opus_int32 sLTP_Q15[], /* O LTP state matching scale
d input */ |
| 380 opus_int subfr, /* I subframe number
*/ | 380 opus_int subfr, /* I subframe number
*/ |
| 381 const opus_int LTP_scale_Q14, /* I
*/ | 381 const opus_int LTP_scale_Q14, /* I
*/ |
| 382 const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I
*/ | 382 const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I
*/ |
| 383 const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lag
*/ | 383 const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lag
*/ |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 437 |
| 438 /* Scale short-term prediction and shaping states */ | 438 /* Scale short-term prediction and shaping states */ |
| 439 for( i = 0; i < NSQ_LPC_BUF_LENGTH; i++ ) { | 439 for( i = 0; i < NSQ_LPC_BUF_LENGTH; i++ ) { |
| 440 NSQ->sLPC_Q14[ i ] = silk_SMULWW( gain_adj_Q16, NSQ->sLPC_Q14[ i ] )
; | 440 NSQ->sLPC_Q14[ i ] = silk_SMULWW( gain_adj_Q16, NSQ->sLPC_Q14[ i ] )
; |
| 441 } | 441 } |
| 442 for( i = 0; i < MAX_SHAPE_LPC_ORDER; i++ ) { | 442 for( i = 0; i < MAX_SHAPE_LPC_ORDER; i++ ) { |
| 443 NSQ->sAR2_Q14[ i ] = silk_SMULWW( gain_adj_Q16, NSQ->sAR2_Q14[ i ] )
; | 443 NSQ->sAR2_Q14[ i ] = silk_SMULWW( gain_adj_Q16, NSQ->sAR2_Q14[ i ] )
; |
| 444 } | 444 } |
| 445 } | 445 } |
| 446 } | 446 } |
| OLD | NEW |