diff options
author | Martin Storsjo <martin@martin.st> | 2012-08-11 21:56:42 +0300 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2012-08-11 22:28:54 +0300 |
commit | 6999980d671f70fdae19c8b4663efa5189f9ca6c (patch) | |
tree | 81c9e367a2fe48194be3caba183d216aa8727d11 | |
parent | 010c75901e4e01aab6ac8a26c71f2192f454d659 (diff) | |
download | fdk-aac-6999980d671f70fdae19c8b4663efa5189f9ca6c.tar.gz fdk-aac-6999980d671f70fdae19c8b4663efa5189f9ca6c.tar.bz2 fdk-aac-6999980d671f70fdae19c8b4663efa5189f9ca6c.zip |
Use saturating adds to avoid overflow
When the addition overflowed, asserts were triggered later, where
the values were assumed to be non-negative.
-rw-r--r-- | libSBRenc/src/env_est.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libSBRenc/src/env_est.cpp b/libSBRenc/src/env_est.cpp index 9423f27..312e0ae 100644 --- a/libSBRenc/src/env_est.cpp +++ b/libSBRenc/src/env_est.cpp @@ -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 */ |