Skip to content

Commit

Permalink
Saturate additions in FDKaacEnc_IntensityStereoProcessing
Browse files Browse the repository at this point in the history
This fixes a crash when encoding a sample from github issue #98.
  • Loading branch information
mstorsjo committed Nov 6, 2018
1 parent 2df6698 commit 35d6f66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libAACenc/src/intensity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 35d6f66

Please sign in to comment.