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 15 matching lines...) Expand all Loading... |
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 /* Silk VAD noise level estimation */ | 35 /* Silk VAD noise level estimation */ |
| 36 # if !defined(OPUS_X86_MAY_HAVE_SSE4_1) |
36 static OPUS_INLINE void silk_VAD_GetNoiseLevels( | 37 static OPUS_INLINE void silk_VAD_GetNoiseLevels( |
37 const opus_int32 pX[ VAD_N_BANDS ], /* I subband energies
*/ | 38 const opus_int32 pX[ VAD_N_BANDS ], /* I subband energies
*/ |
38 silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk VAD
state */ | 39 silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk VAD
state */ |
39 ); | 40 ); |
| 41 #endif |
40 | 42 |
41 /**********************************/ | 43 /**********************************/ |
42 /* Initialization of the Silk VAD */ | 44 /* Initialization of the Silk VAD */ |
43 /**********************************/ | 45 /**********************************/ |
44 opus_int silk_VAD_Init( /* O Return v
alue, 0 if success */ | 46 opus_int silk_VAD_Init( /* O Return v
alue, 0 if success */ |
45 silk_VAD_state *psSilk_VAD /* I/O Pointer
to Silk VAD state */ | 47 silk_VAD_state *psSilk_VAD /* I/O Pointer
to Silk VAD state */ |
46 ) | 48 ) |
47 { | 49 { |
48 opus_int b, ret = 0; | 50 opus_int b, ret = 0; |
49 | 51 |
(...skipping 20 matching lines...) Expand all Loading... |
70 | 72 |
71 return( ret ); | 73 return( ret ); |
72 } | 74 } |
73 | 75 |
74 /* Weighting factors for tilt measure */ | 76 /* Weighting factors for tilt measure */ |
75 static const opus_int32 tiltWeights[ VAD_N_BANDS ] = { 30000, 6000, -12000, -120
00 }; | 77 static const opus_int32 tiltWeights[ VAD_N_BANDS ] = { 30000, 6000, -12000, -120
00 }; |
76 | 78 |
77 /***************************************/ | 79 /***************************************/ |
78 /* Get the speech activity level in Q8 */ | 80 /* Get the speech activity level in Q8 */ |
79 /***************************************/ | 81 /***************************************/ |
80 opus_int silk_VAD_GetSA_Q8( /* O Return v
alue, 0 if success */ | 82 opus_int silk_VAD_GetSA_Q8_c( /* O Return v
alue, 0 if success */ |
81 silk_encoder_state *psEncC, /* I/O Encoder
state */ | 83 silk_encoder_state *psEncC, /* I/O Encoder
state */ |
82 const opus_int16 pIn[] /* I PCM inpu
t */ | 84 const opus_int16 pIn[] /* I PCM inpu
t */ |
83 ) | 85 ) |
84 { | 86 { |
85 opus_int SA_Q15, pSNR_dB_Q7, input_tilt; | 87 opus_int SA_Q15, pSNR_dB_Q7, input_tilt; |
86 opus_int decimated_framelength1, decimated_framelength2; | 88 opus_int decimated_framelength1, decimated_framelength2; |
87 opus_int decimated_framelength; | 89 opus_int decimated_framelength; |
88 opus_int dec_subframe_length, dec_subframe_offset, SNR_Q7, i, b, s; | 90 opus_int dec_subframe_length, dec_subframe_offset, SNR_Q7, i, b, s; |
89 opus_int32 sumSquared, smooth_coef_Q16; | 91 opus_int32 sumSquared, smooth_coef_Q16; |
90 opus_int16 HPstateTmp; | 92 opus_int16 HPstateTmp; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 psEncC->input_quality_bands_Q15[ b ] = silk_sigm_Q15( silk_RSHIFT( SNR_Q
7 - 16 * 128, 4 ) ); | 291 psEncC->input_quality_bands_Q15[ b ] = silk_sigm_Q15( silk_RSHIFT( SNR_Q
7 - 16 * 128, 4 ) ); |
290 } | 292 } |
291 | 293 |
292 RESTORE_STACK; | 294 RESTORE_STACK; |
293 return( ret ); | 295 return( ret ); |
294 } | 296 } |
295 | 297 |
296 /**************************/ | 298 /**************************/ |
297 /* Noise level estimation */ | 299 /* Noise level estimation */ |
298 /**************************/ | 300 /**************************/ |
299 static OPUS_INLINE void silk_VAD_GetNoiseLevels( | 301 # if !defined(OPUS_X86_MAY_HAVE_SSE4_1) |
| 302 static OPUS_INLINE |
| 303 #endif |
| 304 void silk_VAD_GetNoiseLevels( |
300 const opus_int32 pX[ VAD_N_BANDS ], /* I subband energies
*/ | 305 const opus_int32 pX[ VAD_N_BANDS ], /* I subband energies
*/ |
301 silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk VAD
state */ | 306 silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk VAD
state */ |
302 ) | 307 ) |
303 { | 308 { |
304 opus_int k; | 309 opus_int k; |
305 opus_int32 nl, nrg, inv_nrg; | 310 opus_int32 nl, nrg, inv_nrg; |
306 opus_int coef, min_coef; | 311 opus_int coef, min_coef; |
307 | 312 |
308 /* Initially faster smoothing */ | 313 /* Initially faster smoothing */ |
309 if( psSilk_VAD->counter < 1000 ) { /* 1000 = 20 sec */ | 314 if( psSilk_VAD->counter < 1000 ) { /* 1000 = 20 sec */ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 /* Limit noise levels (guarantee 7 bits of head room) */ | 353 /* Limit noise levels (guarantee 7 bits of head room) */ |
349 nl = silk_min( nl, 0x00FFFFFF ); | 354 nl = silk_min( nl, 0x00FFFFFF ); |
350 | 355 |
351 /* Store as part of state */ | 356 /* Store as part of state */ |
352 psSilk_VAD->NL[ k ] = nl; | 357 psSilk_VAD->NL[ k ] = nl; |
353 } | 358 } |
354 | 359 |
355 /* Increment frame counter */ | 360 /* Increment frame counter */ |
356 psSilk_VAD->counter++; | 361 psSilk_VAD->counter++; |
357 } | 362 } |
OLD | NEW |