aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2018-12-20 15:52:46 +0100
committerJean-Michel Trivi <jmtrivi@google.com>2019-01-03 10:32:39 -0500
commit691d00e6fa72b9cea30782c4cf93c8e3013ed5ed (patch)
treee0a81869e768cb73ccbf8f22c07f6c8d8008e5ff
parent7884aefc84b56d7f805d8e84d378ab468274d3ff (diff)
downloadfdk-aac-691d00e6fa72b9cea30782c4cf93c8e3013ed5ed.tar.gz
fdk-aac-691d00e6fa72b9cea30782c4cf93c8e3013ed5ed.tar.bz2
fdk-aac-691d00e6fa72b9cea30782c4cf93c8e3013ed5ed.zip
Integer overflow fix in _compressorIO_sigmoid()
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: I3b7c72a85fc735469cc785ca5aa0545485b91532
-rw-r--r--libDRCdec/src/drcGainDec_preprocess.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/libDRCdec/src/drcGainDec_preprocess.cpp b/libDRCdec/src/drcGainDec_preprocess.cpp
index 7919589..c543c53 100644
--- a/libDRCdec/src/drcGainDec_preprocess.cpp
+++ b/libDRCdec/src/drcGainDec_preprocess.cpp
@@ -300,8 +300,9 @@ static DRC_ERROR _compressorIO_sigmoid(const CUSTOM_DRC_CHAR_SIGMOID* pCChar,
FIXP_SGL exp = pCChar->exp;
DRC_ERROR err = DE_OK;
- tmp = fMultDiv2(DRC_INPUT_LOUDNESS_TARGET - inLevelDb, pCChar->ioRatio);
- tmp = SATURATE_LEFT_SHIFT(tmp, 2 + 1, DFRACT_BITS);
+ tmp = fMultDiv2((DRC_INPUT_LOUDNESS_TARGET >> 1) - (inLevelDb >> 1),
+ pCChar->ioRatio);
+ tmp = SATURATE_LEFT_SHIFT(tmp, 2 + 1 + 1, DFRACT_BITS);
if (exp < (FIXP_SGL)MAXVAL_SGL) {
/* x = tmp / gainDbLimit; */
/* *outGainDb = tmp / pow(1.0f + pow(x, exp), 1.0f/exp); */