aboutsummaryrefslogtreecommitdiffstats
path: root/libAACenc/src
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2018-11-05 11:29:37 +0200
committerMartin Storsjo <martin@martin.st>2018-11-05 11:29:37 +0200
commit4d4845e1dbc7fa7e1bdf4eeb1e19056d089eb500 (patch)
treeafe0ab5bae069729e552831f039fd596cf3f75f1 /libAACenc/src
parent69a9b1a051bc3373d7ff3c348f99d564205af589 (diff)
downloadfdk-aac-4d4845e1dbc7fa7e1bdf4eeb1e19056d089eb500.tar.gz
fdk-aac-4d4845e1dbc7fa7e1bdf4eeb1e19056d089eb500.tar.bz2
fdk-aac-4d4845e1dbc7fa7e1bdf4eeb1e19056d089eb500.zip
Saturate additions in FDKaacEnc_IntensityStereoProcessing
This fixes a crash when encoding a sample from github issue #98.
Diffstat (limited to 'libAACenc/src')
-rw-r--r--libAACenc/src/intensity.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libAACenc/src/intensity.cpp b/libAACenc/src/intensity.cpp
index a160a4f..8cb1b45 100644
--- a/libAACenc/src/intensity.cpp
+++ b/libAACenc/src/intensity.cpp
@@ -747,9 +747,9 @@ void FDKaacEnc_IntensityStereoProcessing(
j++) {
s = ((mdctSpectrumLeft[j] << s0) >> 1) +
((mdctSpectrumRight[j] << s0) >> 1);
- es += fMultDiv2(s, s) >>
+ es = fAddSaturate(es, fMultDiv2(s, s) >>
(MDCT_SPEC_SF -
- 1); // scaled 2*(mdctScale - s0 + 1) + MDCT_SPEC_SF
+ 1)); // scaled 2*(mdctScale - s0 + 1) + MDCT_SPEC_SF
}
msMask[sfb + sfboffs] = 0;
tmp = fDivNorm(sfbEnergyLeft[sfb + sfboffs], es, &s1);