1
0
mirror of https://github.com/mstorsjo/fdk-aac.git synced 2025-01-09 06:05:16 +01:00

Use saturating adds to avoid overflow

When the addition overflowed, asserts were triggered later, where
the values were assumed to be non-negative.
This commit is contained in:
Martin Storsjo 2012-08-11 21:56:42 +03:00
parent 010c75901e
commit 6999980d67

View File

@ -762,8 +762,8 @@ calculateSbrEnvelope (FIXP_DBL **RESTRICT YBufferLeft, /*! energy buffer left *
/* save energies */
pNrgLeft[j] = nrgLeft;
pNrgRight[j] = nrgRight;
envNrgLeft += nrgLeft;
envNrgRight += nrgRight;
envNrgLeft = fAddSaturate(envNrgLeft, nrgLeft);
envNrgRight = fAddSaturate(envNrgRight, nrgRight);
} /* j */