Saturate shift value in calculateSbrEnvelope(). Prevents too large shift values.

Bug: 131430997
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc
Change-Id: I3331ac9bc267cd3fa4c1178bc445998869f0d99b
This commit is contained in:
Fraunhofer IIS FDK 2019-08-09 17:09:36 +02:00 committed by Jean-Michel Trivi
parent a65911cd2e
commit 6f98eab350
1 changed files with 2 additions and 2 deletions

View File

@ -1477,7 +1477,7 @@ void calculateSbrEnvelope(
for (k = 0; k < noSubbands; k++) { for (k = 0; k < noSubbands; k++) {
int sc = scale_change - pNrgs->nrgGain_e[k] + (sc_change - 1); int sc = scale_change - pNrgs->nrgGain_e[k] + (sc_change - 1);
pNrgs->nrgGain[k] >>= sc; pNrgs->nrgGain[k] >>= fixMin(sc, DFRACT_BITS - 1);
pNrgs->nrgGain_e[k] += sc; pNrgs->nrgGain_e[k] += sc;
} }
@ -1485,7 +1485,7 @@ void calculateSbrEnvelope(
for (k = 0; k < noSubbands; k++) { for (k = 0; k < noSubbands; k++) {
int sc = int sc =
scale_change - h_sbr_cal_env->filtBuffer_e[k] + (sc_change - 1); scale_change - h_sbr_cal_env->filtBuffer_e[k] + (sc_change - 1);
h_sbr_cal_env->filtBuffer[k] >>= sc; h_sbr_cal_env->filtBuffer[k] >>= fixMin(sc, DFRACT_BITS - 1);
} }
} }