Merge "Signed Integer Overflows in imlt_block()"

am: 55930c28af

Change-Id: Ie1e1f5d57cd6a8bf0f56461ceef36d15b3dd0db6
This commit is contained in:
Jean-Michel Trivi 2018-12-27 09:26:34 -08:00 committed by android-build-merger
commit 7d959f2f30
1 changed files with 10 additions and 6 deletions

View File

@ -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 */ /* Optional scaling of time domain - no yet windowed - of current spectrum */
if (total_gain != (FIXP_DBL)0) { if (total_gain != (FIXP_DBL)0) {
scaleValuesWithFactor(pSpec, total_gain, tl, spec_scale[0] + scale); for (i = 0; i < tl; i++) {
} else { pSpec[i] = fMult(pSpec[i], total_gain);
scaleValuesSaturate(pSpec, tl, spec_scale[0] + scale); }
} }
int loc_scale = fixmin_I(spec_scale[0] + scale, (INT)DFRACT_BITS - 1);
scaleValuesSaturate(pSpec, tl, loc_scale);
pOut1 += fl / 2 - 1; pOut1 += fl / 2 - 1;
pCurr = pSpec + tl - fl / 2; 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) */ /* and de-scale current spectrum signal (time domain, no yet windowed) */
if (total_gain != (FIXP_DBL)0) { if (total_gain != (FIXP_DBL)0) {
scaleValuesWithFactor(pSpec, total_gain, tl, spec_scale[w] + scale); for (i = 0; i < tl; i++) {
} else { pSpec[i] = fMult(pSpec[i], total_gain);
scaleValuesSaturate(pSpec, tl, spec_scale[w] + scale); }
} }
loc_scale = fixmin_I(spec_scale[w] + scale, (INT)DFRACT_BITS - 1);
scaleValuesSaturate(pSpec, tl, loc_scale);
if (noOutSamples <= nrSamples) { if (noOutSamples <= nrSamples) {
/* Divert output first half to overlap buffer if we already got enough /* Divert output first half to overlap buffer if we already got enough