Skip to content

Commit 3557654

Browse files
cco3Android Git Automerger
authored andcommitted
am 66da3fd: am 972efaf: am 6db6ea0: Merge changes I00c852e4,Ib31bf028
* commit '66da3fdce4dc61f7d1c125eda9b2e065658cc0e5': stagefright aacenc: Avoid overflows when calculating normFactor stagefright aacenc: Avoid a division by zero
2 parents 36fde26 + 66da3fd commit 3557654

File tree

1 file changed

+2
-2
lines changed
  • media/libstagefright/codecs/aacenc/src

1 file changed

+2
-2
lines changed

media/libstagefright/codecs/aacenc/src/adj_thr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ static void correctThresh(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
438438
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
439439
Word32 redThrExp = thrExp[ch][sfbGrp+sfb] + redVal;
440440

441-
if (((*pahFlag < AH_ACTIVE) || (deltaPe > 0)) && (redThrExp > 0) ) {
441+
if (((*pahFlag < AH_ACTIVE) || (deltaPe > 0)) && (redThrExp > 0) && (redThrExp >= *psfbNActiveLines)) {
442442

443443
*psfbPeFactors = (*psfbNActiveLines) * (0x7fffffff / redThrExp);
444444
normFactor = L_add(normFactor, *psfbPeFactors);
@@ -466,7 +466,7 @@ static void correctThresh(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
466466
deltaSfbPe = *psfbPeFactors * deltaPe;
467467

468468
/* thr3(n) = thr2(n)*2^deltaSfbPe/b(n) */
469-
if (*psfbNActiveLines > 0) {
469+
if (*psfbNActiveLines > 0 && (normFactor* (*psfbNActiveLines)) != 0) {
470470
/* new threshold */
471471
Word32 thrFactor;
472472
sfbEn = psyOutChan->sfbEnergy[sfbGrp+sfb];

0 commit comments

Comments
 (0)