aboutsummaryrefslogtreecommitdiffstats
path: root/libSACdec
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2021-05-07 21:00:26 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-05-07 21:00:26 +0000
commitb0d57f75466ba62143aee79c4bd2926c24e46a46 (patch)
treedbb6b53ef3e9a97c4258ae96224fe281a3fe3104 /libSACdec
parentc0daf696e2509b7a778daa5a1980b31fa411d53b (diff)
parent1b074faaa8b6a975f32849ed2a1152e7c8f8aab9 (diff)
downloadfdk-aac-b0d57f75466ba62143aee79c4bd2926c24e46a46.tar.gz
fdk-aac-b0d57f75466ba62143aee79c4bd2926c24e46a46.tar.bz2
fdk-aac-b0d57f75466ba62143aee79c4bd2926c24e46a46.zip
Adapt scaling in combineSignalCplxScale*() to prevent signed integer overflows. am: 773ff1d3e8 am: 1b074faaa8
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/14470257 Change-Id: I304d50b4f3c7a5e2451ddf0a5407ade7fef70c07
Diffstat (limited to 'libSACdec')
-rw-r--r--libSACdec/src/sac_stp.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/libSACdec/src/sac_stp.cpp b/libSACdec/src/sac_stp.cpp
index be332c7..0e6affa 100644
--- a/libSACdec/src/sac_stp.cpp
+++ b/libSACdec/src/sac_stp.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2021 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -229,15 +229,13 @@ inline void combineSignalCplxScale1(FIXP_DBL *hybOutputRealDry,
int n;
FIXP_DBL scaleY;
for (n = bands - 1; n >= 0; n--) {
- scaleY = fMultDiv2(scaleX, *pBP);
+ scaleY = fMult(scaleX, *pBP);
*hybOutputRealDry = SATURATE_LEFT_SHIFT(
- (*hybOutputRealDry >> 1) +
- (fMultDiv2(*hybOutputRealWet, scaleY) << (SF_SCALE + 1)),
- 1, DFRACT_BITS);
+ (*hybOutputRealDry >> SF_SCALE) + fMult(*hybOutputRealWet, scaleY),
+ SF_SCALE, DFRACT_BITS);
*hybOutputImagDry = SATURATE_LEFT_SHIFT(
- (*hybOutputImagDry >> 1) +
- (fMultDiv2(*hybOutputImagWet, scaleY) << (SF_SCALE + 1)),
- 1, DFRACT_BITS);
+ (*hybOutputImagDry >> SF_SCALE) + fMult(*hybOutputImagWet, scaleY),
+ SF_SCALE, DFRACT_BITS);
hybOutputRealDry++, hybOutputRealWet++;
hybOutputImagDry++, hybOutputImagWet++;
pBP++;
@@ -253,14 +251,11 @@ inline void combineSignalCplxScale2(FIXP_DBL *hybOutputRealDry,
for (n = bands - 1; n >= 0; n--) {
*hybOutputRealDry = SATURATE_LEFT_SHIFT(
- (*hybOutputRealDry >> 1) +
- (fMultDiv2(*hybOutputRealWet, scaleX) << SF_SCALE),
- 1, DFRACT_BITS);
+ (*hybOutputRealDry >> SF_SCALE) + fMult(*hybOutputRealWet, scaleX),
+ SF_SCALE, DFRACT_BITS);
*hybOutputImagDry = SATURATE_LEFT_SHIFT(
- (*hybOutputImagDry >> 1) +
- (fMultDiv2(*hybOutputImagWet, scaleX) << SF_SCALE),
- 1, DFRACT_BITS);
- ;
+ (*hybOutputImagDry >> SF_SCALE) + fMult(*hybOutputImagWet, scaleX),
+ SF_SCALE, DFRACT_BITS);
hybOutputRealDry++, hybOutputRealWet++;
hybOutputImagDry++, hybOutputImagWet++;
}