| 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 21 matching lines...) Expand all Loading... |
| 32 #include "main.h" | 32 #include "main.h" |
| 33 #include "stack_alloc.h" | 33 #include "stack_alloc.h" |
| 34 | 34 |
| 35 /**********************************************************/ | 35 /**********************************************************/ |
| 36 /* Core decoder. Performs inverse NSQ operation LTP + LPC */ | 36 /* Core decoder. Performs inverse NSQ operation LTP + LPC */ |
| 37 /**********************************************************/ | 37 /**********************************************************/ |
| 38 void silk_decode_core( | 38 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_int pulses[ MAX_FRAME_LENGTH ] /* I Pulse si
gnal */ | 42 const opus_int16 pulses[ MAX_FRAME_LENGTH ], /* I Pulse si
gnal */ |
| 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; |
| 46 opus_int16 *A_Q12, *B_Q14, *pxq, A_Q12_tmp[ MAX_LPC_ORDER ]; | 47 opus_int16 *A_Q12, *B_Q14, *pxq, A_Q12_tmp[ MAX_LPC_ORDER ]; |
| 47 VARDECL( opus_int16, sLTP ); | 48 VARDECL( opus_int16, sLTP ); |
| 48 VARDECL( opus_int32, sLTP_Q15 ); | 49 VARDECL( opus_int32, sLTP_Q15 ); |
| 49 opus_int32 LTP_pred_Q13, LPC_pred_Q10, Gain_Q10, inv_gain_Q31, gain_adj_Q16,
rand_seed, offset_Q10; | 50 opus_int32 LTP_pred_Q13, LPC_pred_Q10, Gain_Q10, inv_gain_Q31, gain_adj_Q16,
rand_seed, offset_Q10; |
| 50 opus_int32 *pred_lag_ptr, *pexc_Q14, *pres_Q14; | 51 opus_int32 *pred_lag_ptr, *pexc_Q14, *pres_Q14; |
| 51 VARDECL( opus_int32, res_Q14 ); | 52 VARDECL( opus_int32, res_Q14 ); |
| 52 VARDECL( opus_int32, sLPC_Q14 ); | 53 VARDECL( opus_int32, sLPC_Q14 ); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 silk_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[ st
art_idx + k * psDec->subfr_length ], | 150 silk_LPC_analysis_filter( &sLTP[ start_idx ], &psDec->outBuf[ st
art_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 ) { |
| 154 /* Do LTP downscaling to reduce inter-packet dependency */ | 155 /* Do LTP downscaling to reduce inter-packet dependency */ |
| 155 inv_gain_Q31 = silk_LSHIFT( silk_SMULWB( inv_gain_Q31, psDec
Ctrl->LTP_scale_Q14 ), 2 ); | 156 inv_gain_Q31 = silk_LSHIFT( silk_SMULWB( inv_gain_Q31, psDec
Ctrl->LTP_scale_Q14 ), 2 ); |
| 156 } | 157 } |
| 157 for( i = 0; i < lag + LTP_ORDER/2; i++ ) { | 158 for( i = 0; i < lag + LTP_ORDER/2; i++ ) { |
| 158 sLTP_Q15[ sLTP_buf_idx - i - 1 ] = silk_SMULWB( inv_gain_Q31
, sLTP[ psDec->ltp_mem_length - i - 1 ] ); | 159 sLTP_Q15[ sLTP_buf_idx - i - 1 ] = silk_SMULWB( inv_gain_Q31
, sLTP[ psDec->ltp_mem_length - i - 1 ] ); |
| 159 } | 160 } |
| 160 } else { | 161 } else { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 /* Update LPC filter state */ | 230 /* Update LPC filter state */ |
| 230 silk_memcpy( sLPC_Q14, &sLPC_Q14[ psDec->subfr_length ], MAX_LPC_ORDER *
sizeof( opus_int32 ) ); | 231 silk_memcpy( sLPC_Q14, &sLPC_Q14[ psDec->subfr_length ], MAX_LPC_ORDER *
sizeof( opus_int32 ) ); |
| 231 pexc_Q14 += psDec->subfr_length; | 232 pexc_Q14 += psDec->subfr_length; |
| 232 pxq += psDec->subfr_length; | 233 pxq += psDec->subfr_length; |
| 233 } | 234 } |
| 234 | 235 |
| 235 /* Save LPC state */ | 236 /* Save LPC state */ |
| 236 silk_memcpy( psDec->sLPC_Q14_buf, sLPC_Q14, MAX_LPC_ORDER * sizeof( opus_int
32 ) ); | 237 silk_memcpy( psDec->sLPC_Q14_buf, sLPC_Q14, MAX_LPC_ORDER * sizeof( opus_int
32 ) ); |
| 237 RESTORE_STACK; | 238 RESTORE_STACK; |
| 238 } | 239 } |
| OLD | NEW |