Use a saturating shift to avoid overflow
When the shift overflowed, asserts were triggered later, where the values were assumed to be non-negative.
This commit is contained in:
parent
e036dbc8eb
commit
8e4d5d9d2f
@ -267,7 +267,7 @@ FDKaacEnc_CalcBandEnergyOptimShort(const FIXP_DBL *RESTRICT mdctSpectrum,
|
||||
FIXP_DBL spec = mdctSpectrum[j]<<leadingBits;
|
||||
tmp = fPow2AddDiv2(tmp, spec);
|
||||
}
|
||||
bandEnergy[i] = tmp<<1;
|
||||
bandEnergy[i] = scaleValueSaturate(tmp, 1);
|
||||
}
|
||||
|
||||
for(i=0; i<numBands; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user