Saturate additions in spectralChange

This fixes a crash.
This commit is contained in:
Martin Storsjo 2017-03-14 14:29:20 +02:00
parent ec01f65d98
commit 36a85bf987
1 changed files with 2 additions and 2 deletions

View File

@ -200,12 +200,12 @@ static FIXP_DBL spectralChange(
/* Sum up energies in first half */
for (i = start; i < border; i++) {
accu1 += scaleValue(Energies[i][j], -energies_e_diff[i]);
accu1 = fAddSaturate(accu1, scaleValue(Energies[i][j], -energies_e_diff[i]));
}
/* Sum up energies in second half */
for (i = border; i < stop; i++) {
accu2 += scaleValue(Energies[i][j], -energies_e_diff[i]);
accu2 = fAddSaturate(accu2, scaleValue(Energies[i][j], -energies_e_diff[i]));
}
/* Ensure certain energy to prevent division by zero and to prevent