Fix an assertion failure (avoid division by zero) when encoding a particular input

This commit is contained in:
Martin Storsjo 2017-10-30 23:06:44 +02:00
parent cf697df5ad
commit 1e3515e03e
1 changed files with 3 additions and 0 deletions

View File

@ -1147,6 +1147,9 @@ static INT FDKaacEnc_AutoToParcor(
workBuffer++; workBuffer++;
} }
if (input[0] == 0)
input[0] = 1;
tmp = fMult((FIXP_DBL)((LONG)TNS_PREDGAIN_SCALE<<21), fDivNorm(fAbs(autoCorr_0), fAbs(input[0]), &scale)); tmp = fMult((FIXP_DBL)((LONG)TNS_PREDGAIN_SCALE<<21), fDivNorm(fAbs(autoCorr_0), fAbs(input[0]), &scale));
if ( fMultDiv2(autoCorr_0, input[0])<FL2FXCONST_DBL(0.0f) ) { if ( fMultDiv2(autoCorr_0, input[0])<FL2FXCONST_DBL(0.0f) ) {
tmp = -tmp; tmp = -tmp;