summaryrefslogtreecommitdiffstats
path: root/thirdparty/opus/silk/VAD.c
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-11-18 09:56:18 +0100
committerRémi Verschelde <rverschelde@gmail.com>2019-11-18 09:56:48 +0100
commit46ae64cd60166ead412bacc1bf03e9c8f8965e2c (patch)
tree9e592667ffa91e55491a66733e5e3d7de0b666c9 /thirdparty/opus/silk/VAD.c
parent974646309bfe09c48c8a72bf751b0ea6ad8b5bc5 (diff)
downloadredot-engine-46ae64cd60166ead412bacc1bf03e9c8f8965e2c.tar.gz
Revert "Update opus to 1.3.1 and opusfile to 0.11"
This reverts commit e00426c512a7905f5f925d382c443bab7a0ca693. The way we handle platform-specific intrinsics is not good, so the current state will not compile on armv8. This commit also requires SSE4.1 support, which is likely not a good idea for portable binaries. We'll have to redo this with more caution after 3.2 is released, or we might simply drop opus as we're only using it as dependency for theora right now. Fixes #33606.
Diffstat (limited to 'thirdparty/opus/silk/VAD.c')
-rw-r--r--thirdparty/opus/silk/VAD.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/thirdparty/opus/silk/VAD.c b/thirdparty/opus/silk/VAD.c
index d0cda52162..0a782af2f1 100644
--- a/thirdparty/opus/silk/VAD.c
+++ b/thirdparty/opus/silk/VAD.c
@@ -101,9 +101,9 @@ opus_int silk_VAD_GetSA_Q8_c( /* O Return v
/* Safety checks */
silk_assert( VAD_N_BANDS == 4 );
- celt_assert( MAX_FRAME_LENGTH >= psEncC->frame_length );
- celt_assert( psEncC->frame_length <= 512 );
- celt_assert( psEncC->frame_length == 8 * silk_RSHIFT( psEncC->frame_length, 3 ) );
+ silk_assert( MAX_FRAME_LENGTH >= psEncC->frame_length );
+ silk_assert( psEncC->frame_length <= 512 );
+ silk_assert( psEncC->frame_length == 8 * silk_RSHIFT( psEncC->frame_length, 3 ) );
/***********************/
/* Filter and Decimate */
@@ -252,14 +252,15 @@ opus_int silk_VAD_GetSA_Q8_c( /* O Return v
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 */
if( speech_nrg <= 0 ) {
SA_Q15 = silk_RSHIFT( SA_Q15, 1 );
- } else if( speech_nrg < 16384 ) {
- speech_nrg = silk_LSHIFT32( speech_nrg, 16 );
+ } else if( speech_nrg < 32768 ) {
+ if( psEncC->frame_length == 10 * psEncC->fs_kHz ) {
+ speech_nrg = silk_LSHIFT_SAT32( speech_nrg, 16 );
+ } else {
+ speech_nrg = silk_LSHIFT_SAT32( speech_nrg, 15 );
+ }
/* square-root */
speech_nrg = silk_SQRT_APPROX( speech_nrg );
@@ -312,8 +313,6 @@ void silk_VAD_GetNoiseLevels(
/* Initially faster smoothing */
if( psSilk_VAD->counter < 1000 ) { /* 1000 = 20 sec */
min_coef = silk_DIV32_16( silk_int16_MAX, silk_RSHIFT( psSilk_VAD->counter, 4 ) + 1 );
- /* Increment frame counter */
- psSilk_VAD->counter++;
} else {
min_coef = 0;
}
@@ -357,4 +356,7 @@ void silk_VAD_GetNoiseLevels(
/* Store as part of state */
psSilk_VAD->NL[ k ] = nl;
}
+
+ /* Increment frame counter */
+ psSilk_VAD->counter++;
}