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 12 matching lines...) Expand all Loading... |
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 /**********************************************************/ | 35 /**********************************************************/ |
35 /* Core decoder. Performs inverse NSQ operation LTP + LPC */ | 36 /* Core decoder. Performs inverse NSQ operation LTP + LPC */ |
36 /**********************************************************/ | 37 /**********************************************************/ |
37 void silk_decode_core( | 38 void silk_decode_core( |
38 silk_decoder_state *psDec, /* I/O Decoder
state */ | 39 silk_decoder_state *psDec, /* I/O Decoder
state */ |
39 silk_decoder_control *psDecCtrl, /* I Decoder
control */ | 40 silk_decoder_control *psDecCtrl, /* I Decoder
control */ |
40 opus_int16 xq[], /* O Decoded
speech */ | 41 opus_int16 xq[], /* O Decoded
speech */ |
41 const opus_int pulses[ MAX_FRAME_LENGTH ] /* I Pulse si
gnal */ | 42 const opus_int pulses[ MAX_FRAME_LENGTH ] /* I Pulse si
gnal */ |
42 ) | 43 ) |
43 { | 44 { |
44 opus_int i, k, lag = 0, start_idx, sLTP_buf_idx, NLSF_interpolation_flag,
signalType; | 45 opus_int i, k, lag = 0, start_idx, sLTP_buf_idx, NLSF_interpolation_flag,
signalType; |
45 opus_int16 *A_Q12, *B_Q14, *pxq, A_Q12_tmp[ MAX_LPC_ORDER ]; | 46 opus_int16 *A_Q12, *B_Q14, *pxq, A_Q12_tmp[ MAX_LPC_ORDER ]; |
46 opus_int16 sLTP[ MAX_FRAME_LENGTH ]; | 47 VARDECL( opus_int16, sLTP ); |
47 opus_int32 sLTP_Q15[ 2 * MAX_FRAME_LENGTH ]; | 48 VARDECL( opus_int32, sLTP_Q15 ); |
48 opus_int32 LTP_pred_Q13, LPC_pred_Q10, Gain_Q10, inv_gain_Q31, gain_adj_Q16,
rand_seed, offset_Q10; | 49 opus_int32 LTP_pred_Q13, LPC_pred_Q10, Gain_Q10, inv_gain_Q31, gain_adj_Q16,
rand_seed, offset_Q10; |
49 opus_int32 *pred_lag_ptr, *pexc_Q14, *pres_Q14; | 50 opus_int32 *pred_lag_ptr, *pexc_Q14, *pres_Q14; |
50 opus_int32 res_Q14[ MAX_SUB_FRAME_LENGTH ]; | 51 VARDECL( opus_int32, res_Q14 ); |
51 opus_int32 sLPC_Q14[ MAX_SUB_FRAME_LENGTH + MAX_LPC_ORDER ]; | 52 VARDECL( opus_int32, sLPC_Q14 ); |
| 53 SAVE_STACK; |
52 | 54 |
53 silk_assert( psDec->prev_gain_Q16 != 0 ); | 55 silk_assert( psDec->prev_gain_Q16 != 0 ); |
54 | 56 |
| 57 ALLOC( sLTP, psDec->ltp_mem_length, opus_int16 ); |
| 58 ALLOC( sLTP_Q15, psDec->ltp_mem_length + psDec->frame_length, opus_int32 ); |
| 59 ALLOC( res_Q14, psDec->subfr_length, opus_int32 ); |
| 60 ALLOC( sLPC_Q14, psDec->subfr_length + MAX_LPC_ORDER, opus_int32 ); |
| 61 |
55 offset_Q10 = silk_Quantization_Offsets_Q10[ psDec->indices.signalType >> 1 ]
[ psDec->indices.quantOffsetType ]; | 62 offset_Q10 = silk_Quantization_Offsets_Q10[ psDec->indices.signalType >> 1 ]
[ psDec->indices.quantOffsetType ]; |
56 | 63 |
57 if( psDec->indices.NLSFInterpCoef_Q2 < 1 << 2 ) { | 64 if( psDec->indices.NLSFInterpCoef_Q2 < 1 << 2 ) { |
58 NLSF_interpolation_flag = 1; | 65 NLSF_interpolation_flag = 1; |
59 } else { | 66 } else { |
60 NLSF_interpolation_flag = 0; | 67 NLSF_interpolation_flag = 0; |
61 } | 68 } |
62 | 69 |
63 /* Decode excitation */ | 70 /* Decode excitation */ |
64 rand_seed = psDec->indices.Seed; | 71 rand_seed = psDec->indices.Seed; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 /* DEBUG_STORE_DATA( dec.pcm, pxq, psDec->subfr_length * sizeof( opus_in
t16 ) ) */ | 227 /* DEBUG_STORE_DATA( dec.pcm, pxq, psDec->subfr_length * sizeof( opus_in
t16 ) ) */ |
221 | 228 |
222 /* Update LPC filter state */ | 229 /* Update LPC filter state */ |
223 silk_memcpy( sLPC_Q14, &sLPC_Q14[ psDec->subfr_length ], MAX_LPC_ORDER *
sizeof( opus_int32 ) ); | 230 silk_memcpy( sLPC_Q14, &sLPC_Q14[ psDec->subfr_length ], MAX_LPC_ORDER *
sizeof( opus_int32 ) ); |
224 pexc_Q14 += psDec->subfr_length; | 231 pexc_Q14 += psDec->subfr_length; |
225 pxq += psDec->subfr_length; | 232 pxq += psDec->subfr_length; |
226 } | 233 } |
227 | 234 |
228 /* Save LPC state */ | 235 /* Save LPC state */ |
229 silk_memcpy( psDec->sLPC_Q14_buf, sLPC_Q14, MAX_LPC_ORDER * sizeof( opus_int
32 ) ); | 236 silk_memcpy( psDec->sLPC_Q14_buf, sLPC_Q14, MAX_LPC_ORDER * sizeof( opus_int
32 ) ); |
| 237 RESTORE_STACK; |
230 } | 238 } |
OLD | NEW |