diff options
author | Martin Storsjo <martin@martin.st> | 2012-09-02 22:13:09 +0200 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2012-09-02 22:27:52 +0200 |
commit | 8e4d5d9d2fb16e29e4b30a1ae867ab269b1781b3 (patch) | |
tree | 5ad69c4e3c509e797b9ebd34125abe94c25a2cd3 | |
parent | e036dbc8eb7d5fdd02dc70faff20e9ac3e2989ca (diff) | |
download | fdk-aac-8e4d5d9d2fb16e29e4b30a1ae867ab269b1781b3.tar.gz fdk-aac-8e4d5d9d2fb16e29e4b30a1ae867ab269b1781b3.tar.bz2 fdk-aac-8e4d5d9d2fb16e29e4b30a1ae867ab269b1781b3.zip |
Use a saturating shift to avoid overflow
When the shift overflowed, asserts were triggered later, where
the values were assumed to be non-negative.
-rw-r--r-- | libAACenc/src/band_nrg.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libAACenc/src/band_nrg.cpp b/libAACenc/src/band_nrg.cpp index 458aa9c..c672c6c 100644 --- a/libAACenc/src/band_nrg.cpp +++ b/libAACenc/src/band_nrg.cpp @@ -267,7 +267,7 @@ FDKaacEnc_CalcBandEnergyOptimShort(const FIXP_DBL *RESTRICT mdctSpectrum, FIXP_DBL spec = mdctSpectrum[j]<<leadingBits; tmp = fPow2AddDiv2(tmp, spec); } - bandEnergy[i] = tmp<<1; + bandEnergy[i] = scaleValueSaturate(tmp, 1); } for(i=0; i<numBands; i++) |