aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec/src/usacdec_fac.cpp
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2018-12-27 09:36:33 -0800
committerandroid-build-merger <android-build-merger@google.com>2018-12-27 09:36:33 -0800
commit61b3c49df02edfde16650080d73ff50759f816c0 (patch)
treed5ae0638b42852f766750f49083593d818629501 /libAACdec/src/usacdec_fac.cpp
parent437b7440d181130b9b09c0439113fb5257e55457 (diff)
parent83ba3e096a1982fddc4577880ab6a2ba0b6b7c2e (diff)
downloadfdk-aac-61b3c49df02edfde16650080d73ff50759f816c0.tar.gz
fdk-aac-61b3c49df02edfde16650080d73ff50759f816c0.tar.bz2
fdk-aac-61b3c49df02edfde16650080d73ff50759f816c0.zip
Merge "Signed Integer Overflows in imlt_block()" am: 55930c28af am: 7d959f2f30
am: 83ba3e096a Change-Id: I0805e8ba62c75a16c9df2d2169c79b8ddbd0974e
Diffstat (limited to 'libAACdec/src/usacdec_fac.cpp')
-rw-r--r--libAACdec/src/usacdec_fac.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/libAACdec/src/usacdec_fac.cpp b/libAACdec/src/usacdec_fac.cpp
index c10a3fe..0d3d844 100644
--- a/libAACdec/src/usacdec_fac.cpp
+++ b/libAACdec/src/usacdec_fac.cpp
@@ -534,10 +534,12 @@ INT CLpd_FAC_Acelp2Mdct(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *_pSpec,
/* Optional scaling of time domain - no yet windowed - of current spectrum */
if (total_gain != (FIXP_DBL)0) {
- scaleValuesWithFactor(pSpec, total_gain, tl, spec_scale[0] + scale);
- } else {
- scaleValuesSaturate(pSpec, tl, spec_scale[0] + scale);
+ for (i = 0; i < tl; i++) {
+ pSpec[i] = fMult(pSpec[i], total_gain);
+ }
}
+ int loc_scale = fixmin_I(spec_scale[0] + scale, (INT)DFRACT_BITS - 1);
+ scaleValuesSaturate(pSpec, tl, loc_scale);
pOut1 += fl / 2 - 1;
pCurr = pSpec + tl - fl / 2;
@@ -623,10 +625,12 @@ INT CLpd_FAC_Acelp2Mdct(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *_pSpec,
*/
/* and de-scale current spectrum signal (time domain, no yet windowed) */
if (total_gain != (FIXP_DBL)0) {
- scaleValuesWithFactor(pSpec, total_gain, tl, spec_scale[w] + scale);
- } else {
- scaleValuesSaturate(pSpec, tl, spec_scale[w] + scale);
+ for (i = 0; i < tl; i++) {
+ pSpec[i] = fMult(pSpec[i], total_gain);
+ }
}
+ loc_scale = fixmin_I(spec_scale[w] + scale, (INT)DFRACT_BITS - 1);
+ scaleValuesSaturate(pSpec, tl, loc_scale);
if (noOutSamples <= nrSamples) {
/* Divert output first half to overlap buffer if we already got enough