Use saturating adds to avoid overflow
These additions can overflow, triggering assertions later.
This commit is contained in:
parent
d8e8f1ac46
commit
839ae290c1
@ -1150,8 +1150,8 @@ static INT FDKaacEnc_AutoToParcor(
|
||||
for(j=numOfCoeff-i-1; j>=0; j--) {
|
||||
FIXP_DBL accu1 = fMult(tmp, input[j]);
|
||||
FIXP_DBL accu2 = fMult(tmp, workBuffer[j]);
|
||||
workBuffer[j] += accu1;
|
||||
input[j] += accu2;
|
||||
workBuffer[j] = fAddSaturate(workBuffer[j], accu1);
|
||||
input[j] = fAddSaturate(input[j], accu2);
|
||||
}
|
||||
|
||||
workBuffer++;
|
||||
|
@ -195,7 +195,7 @@ FDKaacEnc_groupShortData(FIXP_DBL *mdctSpectrum, /* in-out
|
||||
FIXP_DBL energy = sfbEnergy->Short[wnd][sfb];
|
||||
for (j=1; j<groupLen[grp]; j++)
|
||||
{
|
||||
energy += sfbEnergy->Short[wnd+j][sfb];
|
||||
energy = fAddSaturate(energy, sfbEnergy->Short[wnd+j][sfb]);
|
||||
}
|
||||
sfbEnergy->Long[i++] = energy;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user