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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 if( psDec->prevSignalType == TYPE_VOICED ) { | 268 if( psDec->prevSignalType == TYPE_VOICED ) { |
269 for( i = 0; i < LTP_ORDER; i++ ) { | 269 for( i = 0; i < LTP_ORDER; i++ ) { |
270 rand_scale_Q14 -= B_Q14[ i ]; | 270 rand_scale_Q14 -= B_Q14[ i ]; |
271 } | 271 } |
272 rand_scale_Q14 = silk_max_16( 3277, rand_scale_Q14 ); /* 0.2 */ | 272 rand_scale_Q14 = silk_max_16( 3277, rand_scale_Q14 ); /* 0.2 */ |
273 rand_scale_Q14 = (opus_int16)silk_RSHIFT( silk_SMULBB( rand_scale_Q1
4, psPLC->prevLTP_scale_Q14 ), 14 ); | 273 rand_scale_Q14 = (opus_int16)silk_RSHIFT( silk_SMULBB( rand_scale_Q1
4, psPLC->prevLTP_scale_Q14 ), 14 ); |
274 } else { | 274 } else { |
275 /* Reduce random noise for unvoiced frames with high LPC gain */ | 275 /* Reduce random noise for unvoiced frames with high LPC gain */ |
276 opus_int32 invGain_Q30, down_scale_Q30; | 276 opus_int32 invGain_Q30, down_scale_Q30; |
277 | 277 |
278 invGain_Q30 = silk_LPC_inverse_pred_gain( psPLC->prevLPC_Q12, psDec-
>LPC_order ); | 278 invGain_Q30 = silk_LPC_inverse_pred_gain( psPLC->prevLPC_Q12, psDec-
>LPC_order, arch ); |
279 | 279 |
280 down_scale_Q30 = silk_min_32( silk_RSHIFT( (opus_int32)1 << 30, LOG2
_INV_LPC_GAIN_HIGH_THRES ), invGain_Q30 ); | 280 down_scale_Q30 = silk_min_32( silk_RSHIFT( (opus_int32)1 << 30, LOG2
_INV_LPC_GAIN_HIGH_THRES ), invGain_Q30 ); |
281 down_scale_Q30 = silk_max_32( silk_RSHIFT( (opus_int32)1 << 30, LOG2
_INV_LPC_GAIN_LOW_THRES ), down_scale_Q30 ); | 281 down_scale_Q30 = silk_max_32( silk_RSHIFT( (opus_int32)1 << 30, LOG2
_INV_LPC_GAIN_LOW_THRES ), down_scale_Q30 ); |
282 down_scale_Q30 = silk_LSHIFT( down_scale_Q30, LOG2_INV_LPC_GAIN_HIGH
_THRES ); | 282 down_scale_Q30 = silk_LSHIFT( down_scale_Q30, LOG2_INV_LPC_GAIN_HIGH
_THRES ); |
283 | 283 |
284 rand_Gain_Q15 = silk_RSHIFT( silk_SMULWB( down_scale_Q30, rand_Gain_
Q15 ), 14 ); | 284 rand_Gain_Q15 = silk_RSHIFT( silk_SMULWB( down_scale_Q30, rand_Gain_
Q15 ), 14 ); |
285 } | 285 } |
286 } | 286 } |
287 | 287 |
288 rand_seed = psPLC->rand_seed; | 288 rand_seed = psPLC->rand_seed; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 rand_seed = silk_RAND( rand_seed ); | 321 rand_seed = silk_RAND( rand_seed ); |
322 idx = silk_RSHIFT( rand_seed, 25 ) & RAND_BUF_MASK; | 322 idx = silk_RSHIFT( rand_seed, 25 ) & RAND_BUF_MASK; |
323 sLTP_Q14[ sLTP_buf_idx ] = silk_LSHIFT32( silk_SMLAWB( LTP_pred_Q12,
rand_ptr[ idx ], rand_scale_Q14 ), 2 ); | 323 sLTP_Q14[ sLTP_buf_idx ] = silk_LSHIFT32( silk_SMLAWB( LTP_pred_Q12,
rand_ptr[ idx ], rand_scale_Q14 ), 2 ); |
324 sLTP_buf_idx++; | 324 sLTP_buf_idx++; |
325 } | 325 } |
326 | 326 |
327 /* Gradually reduce LTP gain */ | 327 /* Gradually reduce LTP gain */ |
328 for( j = 0; j < LTP_ORDER; j++ ) { | 328 for( j = 0; j < LTP_ORDER; j++ ) { |
329 B_Q14[ j ] = silk_RSHIFT( silk_SMULBB( harm_Gain_Q15, B_Q14[ j ] ),
15 ); | 329 B_Q14[ j ] = silk_RSHIFT( silk_SMULBB( harm_Gain_Q15, B_Q14[ j ] ),
15 ); |
330 } | 330 } |
331 /* Gradually reduce excitation gain */ | 331 if ( psDec->indices.signalType != TYPE_NO_VOICE_ACTIVITY ) { |
332 rand_scale_Q14 = silk_RSHIFT( silk_SMULBB( rand_scale_Q14, rand_Gain_Q15
), 15 ); | 332 /* Gradually reduce excitation gain */ |
| 333 rand_scale_Q14 = silk_RSHIFT( silk_SMULBB( rand_scale_Q14, rand_Gain
_Q15 ), 15 ); |
| 334 } |
333 | 335 |
334 /* Slowly increase pitch lag */ | 336 /* Slowly increase pitch lag */ |
335 psPLC->pitchL_Q8 = silk_SMLAWB( psPLC->pitchL_Q8, psPLC->pitchL_Q8, PITC
H_DRIFT_FAC_Q16 ); | 337 psPLC->pitchL_Q8 = silk_SMLAWB( psPLC->pitchL_Q8, psPLC->pitchL_Q8, PITC
H_DRIFT_FAC_Q16 ); |
336 psPLC->pitchL_Q8 = silk_min_32( psPLC->pitchL_Q8, silk_LSHIFT( silk_SMUL
BB( MAX_PITCH_LAG_MS, psDec->fs_kHz ), 8 ) ); | 338 psPLC->pitchL_Q8 = silk_min_32( psPLC->pitchL_Q8, silk_LSHIFT( silk_SMUL
BB( MAX_PITCH_LAG_MS, psDec->fs_kHz ), 8 ) ); |
337 lag = silk_RSHIFT_ROUND( psPLC->pitchL_Q8, 8 ); | 339 lag = silk_RSHIFT_ROUND( psPLC->pitchL_Q8, 8 ); |
338 } | 340 } |
339 | 341 |
340 /***************************/ | 342 /***************************/ |
341 /* LPC synthesis filtering */ | 343 /* LPC synthesis filtering */ |
342 /***************************/ | 344 /***************************/ |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 gain_Q16 += slope_Q16; | 439 gain_Q16 += slope_Q16; |
438 if( gain_Q16 > (opus_int32)1 << 16 ) { | 440 if( gain_Q16 > (opus_int32)1 << 16 ) { |
439 break; | 441 break; |
440 } | 442 } |
441 } | 443 } |
442 } | 444 } |
443 } | 445 } |
444 psPLC->last_frame_lost = 0; | 446 psPLC->last_frame_lost = 0; |
445 } | 447 } |
446 } | 448 } |
OLD | NEW |