Skip to content

Commit 6db6ea0

Browse files
cco3android code review
authored andcommitted
Merge changes I00c852e4,Ib31bf028
* changes: stagefright aacenc: Avoid overflows when calculating normFactor stagefright aacenc: Avoid a division by zero
2 parents 34ccd7a + 27bd8da commit 6db6ea0

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)