From 52e10238f191c9922802a82ac456ad3cdb9e2450 Mon Sep 17 00:00:00 2001 From: Johan Pascal Date: Wed, 11 Feb 2015 10:58:19 +0100 Subject: [PATCH] Fix DTX init bug - past autocorrelation coefficients can't be 0, set autocorrelation[0] to 1 for the whole past buffer. --- src/dtx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dtx.c b/src/dtx.c index cf598e0..d14db44 100644 --- a/src/dtx.c +++ b/src/dtx.c @@ -205,9 +205,15 @@ static uint8_t compareLPCFilters(word32_t *LPCoefficientsAutocorrelation, word32 /* */ /*****************************************************************************/ bcg729DTXChannelContextStruct *initBcg729DTXChannel() { + int i; /* create the context structure */ bcg729DTXChannelContextStruct *DTXChannelContext = malloc(sizeof(bcg729DTXChannelContextStruct)); memset(DTXChannelContext, 0, sizeof(*DTXChannelContext)); /* set autocorrelation buffers to 0 */ + /* avoid arithmetics problem: set past autocorrelation[0] to 1 */ + for (i=0; i<7; i++) { + DTXChannelContext->autocorrelationCoefficients[i][0] = ONE_IN_Q30; + DTXChannelContext->autocorrelationCoefficientsScale[i] = 30; + } DTXChannelContext->previousVADflag = 1; /* previous VAD flag must be initialised to VOICE */ DTXChannelContext->pseudoRandomSeed = CNG_DTX_RANDOM_SEED_INIT;