Fixed off-by-one issue in Silk DTX
authorGustaf Ullberg <gustaf.ullberg@gmail.com>
Wed, 22 Nov 2017 10:38:18 +0000 (11:38 +0100)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Thu, 22 Feb 2018 21:33:05 +0000 (16:33 -0500)
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
silk/fixed/encode_frame_FIX.c
silk/float/encode_frame_FLP.c

index 4f9e086..0efa9e6 100644 (file)
@@ -57,7 +57,7 @@ void silk_encode_do_VAD_FIX(
     if( psEnc->sCmn.speech_activity_Q8 < SILK_FIX_CONST( SPEECH_ACTIVITY_DTX_THRES, 8 ) ) {
         psEnc->sCmn.indices.signalType = TYPE_NO_VOICE_ACTIVITY;
         psEnc->sCmn.noSpeechCounter++;
-        if( psEnc->sCmn.noSpeechCounter < NB_SPEECH_FRAMES_BEFORE_DTX ) {
+        if( psEnc->sCmn.noSpeechCounter <= NB_SPEECH_FRAMES_BEFORE_DTX ) {
             psEnc->sCmn.inDTX = 0;
         } else if( psEnc->sCmn.noSpeechCounter > MAX_CONSECUTIVE_DTX + NB_SPEECH_FRAMES_BEFORE_DTX ) {
             psEnc->sCmn.noSpeechCounter = NB_SPEECH_FRAMES_BEFORE_DTX;
index c3ad50a..5db85c7 100644 (file)
@@ -56,7 +56,7 @@ void silk_encode_do_VAD_FLP(
     if( psEnc->sCmn.speech_activity_Q8 < SILK_FIX_CONST( SPEECH_ACTIVITY_DTX_THRES, 8 ) ) {
         psEnc->sCmn.indices.signalType = TYPE_NO_VOICE_ACTIVITY;
         psEnc->sCmn.noSpeechCounter++;
-        if( psEnc->sCmn.noSpeechCounter < NB_SPEECH_FRAMES_BEFORE_DTX ) {
+        if( psEnc->sCmn.noSpeechCounter <= NB_SPEECH_FRAMES_BEFORE_DTX ) {
             psEnc->sCmn.inDTX = 0;
         } else if( psEnc->sCmn.noSpeechCounter > MAX_CONSECUTIVE_DTX + NB_SPEECH_FRAMES_BEFORE_DTX ) {
             psEnc->sCmn.noSpeechCounter = NB_SPEECH_FRAMES_BEFORE_DTX;