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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 #include "main.h" | 32 #include "main.h" |
33 #include "stack_alloc.h" | 33 #include "stack_alloc.h" |
34 #include "PLC.h" | 34 #include "PLC.h" |
35 | 35 |
36 #define NB_ATT 2 | 36 #define NB_ATT 2 |
37 static const opus_int16 HARM_ATT_Q15[NB_ATT] = { 32440, 31130 }; /*
0.99, 0.95 */ | 37 static const opus_int16 HARM_ATT_Q15[NB_ATT] = { 32440, 31130 }; /*
0.99, 0.95 */ |
38 static const opus_int16 PLC_RAND_ATTENUATE_V_Q15[NB_ATT] = { 31130, 26214 }; /*
0.95, 0.8 */ | 38 static const opus_int16 PLC_RAND_ATTENUATE_V_Q15[NB_ATT] = { 31130, 26214 }; /*
0.95, 0.8 */ |
39 static const opus_int16 PLC_RAND_ATTENUATE_UV_Q15[NB_ATT] = { 32440, 29491 }; /*
0.99, 0.9 */ | 39 static const opus_int16 PLC_RAND_ATTENUATE_UV_Q15[NB_ATT] = { 32440, 29491 }; /*
0.99, 0.9 */ |
40 | 40 |
41 static inline void silk_PLC_update( | 41 static OPUS_INLINE void silk_PLC_update( |
42 silk_decoder_state *psDec, /* I/O Decoder state
*/ | 42 silk_decoder_state *psDec, /* I/O Decoder state
*/ |
43 silk_decoder_control *psDecCtrl /* I/O Decoder contr
ol */ | 43 silk_decoder_control *psDecCtrl /* I/O Decoder contr
ol */ |
44 ); | 44 ); |
45 | 45 |
46 static inline void silk_PLC_conceal( | 46 static OPUS_INLINE void silk_PLC_conceal( |
47 silk_decoder_state *psDec, /* I/O Decoder state
*/ | 47 silk_decoder_state *psDec, /* I/O Decoder state
*/ |
48 silk_decoder_control *psDecCtrl, /* I/O Decoder contr
ol */ | 48 silk_decoder_control *psDecCtrl, /* I/O Decoder contr
ol */ |
49 opus_int16 frame[] /* O LPC residual si
gnal */ | 49 opus_int16 frame[] /* O LPC residual si
gnal */ |
50 ); | 50 ); |
51 | 51 |
52 | 52 |
53 void silk_PLC_Reset( | 53 void silk_PLC_Reset( |
54 silk_decoder_state *psDec /* I/O Decoder state
*/ | 54 silk_decoder_state *psDec /* I/O Decoder state
*/ |
55 ) | 55 ) |
56 { | 56 { |
(...skipping 28 matching lines...) Expand all Loading... |
85 /****************************/ | 85 /****************************/ |
86 /* Update state */ | 86 /* Update state */ |
87 /****************************/ | 87 /****************************/ |
88 silk_PLC_update( psDec, psDecCtrl ); | 88 silk_PLC_update( psDec, psDecCtrl ); |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 /**************************************************/ | 92 /**************************************************/ |
93 /* Update state of PLC */ | 93 /* Update state of PLC */ |
94 /**************************************************/ | 94 /**************************************************/ |
95 static inline void silk_PLC_update( | 95 static OPUS_INLINE void silk_PLC_update( |
96 silk_decoder_state *psDec, /* I/O Decoder state
*/ | 96 silk_decoder_state *psDec, /* I/O Decoder state
*/ |
97 silk_decoder_control *psDecCtrl /* I/O Decoder contr
ol */ | 97 silk_decoder_control *psDecCtrl /* I/O Decoder contr
ol */ |
98 ) | 98 ) |
99 { | 99 { |
100 opus_int32 LTP_Gain_Q14, temp_LTP_Gain_Q14; | 100 opus_int32 LTP_Gain_Q14, temp_LTP_Gain_Q14; |
101 opus_int i, j; | 101 opus_int i, j; |
102 silk_PLC_struct *psPLC; | 102 silk_PLC_struct *psPLC; |
103 | 103 |
104 psPLC = &psDec->sPLC; | 104 psPLC = &psDec->sPLC; |
105 | 105 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 silk_memcpy( psPLC->prevLPC_Q12, psDecCtrl->PredCoef_Q12[ 1 ], psDec->LPC_or
der * sizeof( opus_int16 ) ); | 158 silk_memcpy( psPLC->prevLPC_Q12, psDecCtrl->PredCoef_Q12[ 1 ], psDec->LPC_or
der * sizeof( opus_int16 ) ); |
159 psPLC->prevLTP_scale_Q14 = psDecCtrl->LTP_scale_Q14; | 159 psPLC->prevLTP_scale_Q14 = psDecCtrl->LTP_scale_Q14; |
160 | 160 |
161 /* Save last two gains */ | 161 /* Save last two gains */ |
162 silk_memcpy( psPLC->prevGain_Q16, &psDecCtrl->Gains_Q16[ psDec->nb_subfr - 2
], 2 * sizeof( opus_int32 ) ); | 162 silk_memcpy( psPLC->prevGain_Q16, &psDecCtrl->Gains_Q16[ psDec->nb_subfr - 2
], 2 * sizeof( opus_int32 ) ); |
163 | 163 |
164 psPLC->subfr_length = psDec->subfr_length; | 164 psPLC->subfr_length = psDec->subfr_length; |
165 psPLC->nb_subfr = psDec->nb_subfr; | 165 psPLC->nb_subfr = psDec->nb_subfr; |
166 } | 166 } |
167 | 167 |
168 static inline void silk_PLC_conceal( | 168 static OPUS_INLINE void silk_PLC_conceal( |
169 silk_decoder_state *psDec, /* I/O Decoder state
*/ | 169 silk_decoder_state *psDec, /* I/O Decoder state
*/ |
170 silk_decoder_control *psDecCtrl, /* I/O Decoder contr
ol */ | 170 silk_decoder_control *psDecCtrl, /* I/O Decoder contr
ol */ |
171 opus_int16 frame[] /* O LPC residual si
gnal */ | 171 opus_int16 frame[] /* O LPC residual si
gnal */ |
172 ) | 172 ) |
173 { | 173 { |
174 opus_int i, j, k; | 174 opus_int i, j, k; |
175 opus_int lag, idx, sLTP_buf_idx, shift1, shift2; | 175 opus_int lag, idx, sLTP_buf_idx, shift1, shift2; |
176 opus_int32 rand_seed, harm_Gain_Q15, rand_Gain_Q15, inv_gain_Q30; | 176 opus_int32 rand_seed, harm_Gain_Q15, rand_Gain_Q15, inv_gain_Q30; |
177 opus_int32 energy1, energy2, *rand_ptr, *pred_lag_ptr; | 177 opus_int32 energy1, energy2, *rand_ptr, *pred_lag_ptr; |
178 opus_int32 LPC_pred_Q10, LTP_pred_Q12; | 178 opus_int32 LPC_pred_Q10, LTP_pred_Q12; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 gain_Q16 += slope_Q16; | 414 gain_Q16 += slope_Q16; |
415 if( gain_Q16 > (opus_int32)1 << 16 ) { | 415 if( gain_Q16 > (opus_int32)1 << 16 ) { |
416 break; | 416 break; |
417 } | 417 } |
418 } | 418 } |
419 } | 419 } |
420 } | 420 } |
421 psPLC->last_frame_lost = 0; | 421 psPLC->last_frame_lost = 0; |
422 } | 422 } |
423 } | 423 } |
OLD | NEW |