summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2012-09-02 22:13:09 +0200
committerMartin Storsjo <martin@martin.st>2012-09-02 22:27:52 +0200
commit8e4d5d9d2fb16e29e4b30a1ae867ab269b1781b3 (patch)
tree5ad69c4e3c509e797b9ebd34125abe94c25a2cd3
parente036dbc8eb7d5fdd02dc70faff20e9ac3e2989ca (diff)
downloadfdk-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.cpp2
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++)