Commit 6999980d authored by Martin Storsjo's avatar Martin Storsjo

Use saturating adds to avoid overflow

When the addition overflowed, asserts were triggered later, where
the values were assumed to be non-negative.
parent 010c7590
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment