Merge changes I00c852e4,Ib31bf028
* changes: stagefright aacenc: Avoid overflows when calculating normFactor stagefright aacenc: Avoid a division by zero
This commit is contained in:
@@ -438,7 +438,7 @@ static void correctThresh(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
|
|||||||
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
|
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
|
||||||
Word32 redThrExp = thrExp[ch][sfbGrp+sfb] + redVal;
|
Word32 redThrExp = thrExp[ch][sfbGrp+sfb] + redVal;
|
||||||
|
|
||||||
if (((*pahFlag < AH_ACTIVE) || (deltaPe > 0)) && (redThrExp > 0) ) {
|
if (((*pahFlag < AH_ACTIVE) || (deltaPe > 0)) && (redThrExp > 0) && (redThrExp >= *psfbNActiveLines)) {
|
||||||
|
|
||||||
*psfbPeFactors = (*psfbNActiveLines) * (0x7fffffff / redThrExp);
|
*psfbPeFactors = (*psfbNActiveLines) * (0x7fffffff / redThrExp);
|
||||||
normFactor = L_add(normFactor, *psfbPeFactors);
|
normFactor = L_add(normFactor, *psfbPeFactors);
|
||||||
@@ -466,7 +466,7 @@ static void correctThresh(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
|
|||||||
deltaSfbPe = *psfbPeFactors * deltaPe;
|
deltaSfbPe = *psfbPeFactors * deltaPe;
|
||||||
|
|
||||||
/* thr3(n) = thr2(n)*2^deltaSfbPe/b(n) */
|
/* thr3(n) = thr2(n)*2^deltaSfbPe/b(n) */
|
||||||
if (*psfbNActiveLines > 0) {
|
if (*psfbNActiveLines > 0 && (normFactor* (*psfbNActiveLines)) != 0) {
|
||||||
/* new threshold */
|
/* new threshold */
|
||||||
Word32 thrFactor;
|
Word32 thrFactor;
|
||||||
sfbEn = psyOutChan->sfbEnergy[sfbGrp+sfb];
|
sfbEn = psyOutChan->sfbEnergy[sfbGrp+sfb];
|
||||||
|
|||||||
Reference in New Issue
Block a user