diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2021-04-30 23:52:10 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-04-30 23:52:10 +0000 |
commit | ab332a940d511e4995ca1b9f8051a5093f4828bd (patch) | |
tree | 7ff384d92bb6caf2ad80e9b9702366ab639a95c2 /libSACdec/src | |
parent | 38afdcc7d089ff7033fef5c2efc55f881e51d2e8 (diff) | |
parent | ecc0e332069862da177c745137493545dd0cd63b (diff) | |
download | fdk-aac-ab332a940d511e4995ca1b9f8051a5093f4828bd.tar.gz fdk-aac-ab332a940d511e4995ca1b9f8051a5093f4828bd.tar.bz2 fdk-aac-ab332a940d511e4995ca1b9f8051a5093f4828bd.zip |
Merge "Avoid signed integer overflow in combineSignalCplxScale2()." into sc-dev
Diffstat (limited to 'libSACdec/src')
-rw-r--r-- | libSACdec/src/sac_stp.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libSACdec/src/sac_stp.cpp b/libSACdec/src/sac_stp.cpp index b328c82..be332c7 100644 --- a/libSACdec/src/sac_stp.cpp +++ b/libSACdec/src/sac_stp.cpp @@ -252,12 +252,15 @@ inline void combineSignalCplxScale2(FIXP_DBL *hybOutputRealDry, int n; for (n = bands - 1; n >= 0; n--) { - *hybOutputRealDry = - *hybOutputRealDry + - (fMultDiv2(*hybOutputRealWet, scaleX) << (SF_SCALE + 1)); - *hybOutputImagDry = - *hybOutputImagDry + - (fMultDiv2(*hybOutputImagWet, scaleX) << (SF_SCALE + 1)); + *hybOutputRealDry = SATURATE_LEFT_SHIFT( + (*hybOutputRealDry >> 1) + + (fMultDiv2(*hybOutputRealWet, scaleX) << SF_SCALE), + 1, DFRACT_BITS); + *hybOutputImagDry = SATURATE_LEFT_SHIFT( + (*hybOutputImagDry >> 1) + + (fMultDiv2(*hybOutputImagWet, scaleX) << SF_SCALE), + 1, DFRACT_BITS); + ; hybOutputRealDry++, hybOutputRealWet++; hybOutputImagDry++, hybOutputImagWet++; } |