Commit 8e4d5d9d authored by Martin Storsjo's avatar Martin Storsjo

Use a saturating shift to avoid overflow

When the shift overflowed, asserts were triggered later, where
the values were assumed to be non-negative.
parent e036dbc8
......@@ -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++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment