mirror of
https://github.com/xiph/opus.git
synced 2025-06-03 00:57:43 +00:00
Fixes integer overflow in SILK VAD for 10-ms frames
Reported by Chandrakala Madhira on the mailing list
This commit is contained in:
parent
4503261d0f
commit
4b6af2da93
1 changed files with 5 additions and 6 deletions
11
silk/VAD.c
11
silk/VAD.c
|
@ -252,15 +252,14 @@ opus_int silk_VAD_GetSA_Q8_c( /* O Return v
|
||||||
speech_nrg += ( b + 1 ) * silk_RSHIFT( Xnrg[ b ] - psSilk_VAD->NL[ b ], 4 );
|
speech_nrg += ( b + 1 ) * silk_RSHIFT( Xnrg[ b ] - psSilk_VAD->NL[ b ], 4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( psEncC->frame_length == 20 * psEncC->fs_kHz ) {
|
||||||
|
speech_nrg = silk_RSHIFT32( speech_nrg, 1 );
|
||||||
|
}
|
||||||
/* Power scaling */
|
/* Power scaling */
|
||||||
if( speech_nrg <= 0 ) {
|
if( speech_nrg <= 0 ) {
|
||||||
SA_Q15 = silk_RSHIFT( SA_Q15, 1 );
|
SA_Q15 = silk_RSHIFT( SA_Q15, 1 );
|
||||||
} else if( speech_nrg < 32768 ) {
|
} else if( speech_nrg < 16384 ) {
|
||||||
if( psEncC->frame_length == 10 * psEncC->fs_kHz ) {
|
speech_nrg = silk_LSHIFT32( speech_nrg, 16 );
|
||||||
speech_nrg = silk_LSHIFT_SAT32( speech_nrg, 16 );
|
|
||||||
} else {
|
|
||||||
speech_nrg = silk_LSHIFT_SAT32( speech_nrg, 15 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* square-root */
|
/* square-root */
|
||||||
speech_nrg = silk_SQRT_APPROX( speech_nrg );
|
speech_nrg = silk_SQRT_APPROX( speech_nrg );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue