mirror of https://github.com/mstorsjo/fdk-aac.git
Adapt scaling in combineSignalCplxScale*() to prevent signed integer overflows. am: 773ff1d3e8
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/14470257 Change-Id: Iac3f458c5f7381667bb72edb0246a38e8954ab13
This commit is contained in:
commit
6bfd703af9
|
@ -1,7 +1,7 @@
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
Software License for The Fraunhofer FDK AAC Codec Library for Android
|
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.
|
Forschung e.V. All rights reserved.
|
||||||
|
|
||||||
1. INTRODUCTION
|
1. INTRODUCTION
|
||||||
|
@ -229,15 +229,13 @@ inline void combineSignalCplxScale1(FIXP_DBL *hybOutputRealDry,
|
||||||
int n;
|
int n;
|
||||||
FIXP_DBL scaleY;
|
FIXP_DBL scaleY;
|
||||||
for (n = bands - 1; n >= 0; n--) {
|
for (n = bands - 1; n >= 0; n--) {
|
||||||
scaleY = fMultDiv2(scaleX, *pBP);
|
scaleY = fMult(scaleX, *pBP);
|
||||||
*hybOutputRealDry = SATURATE_LEFT_SHIFT(
|
*hybOutputRealDry = SATURATE_LEFT_SHIFT(
|
||||||
(*hybOutputRealDry >> 1) +
|
(*hybOutputRealDry >> SF_SCALE) + fMult(*hybOutputRealWet, scaleY),
|
||||||
(fMultDiv2(*hybOutputRealWet, scaleY) << (SF_SCALE + 1)),
|
SF_SCALE, DFRACT_BITS);
|
||||||
1, DFRACT_BITS);
|
|
||||||
*hybOutputImagDry = SATURATE_LEFT_SHIFT(
|
*hybOutputImagDry = SATURATE_LEFT_SHIFT(
|
||||||
(*hybOutputImagDry >> 1) +
|
(*hybOutputImagDry >> SF_SCALE) + fMult(*hybOutputImagWet, scaleY),
|
||||||
(fMultDiv2(*hybOutputImagWet, scaleY) << (SF_SCALE + 1)),
|
SF_SCALE, DFRACT_BITS);
|
||||||
1, DFRACT_BITS);
|
|
||||||
hybOutputRealDry++, hybOutputRealWet++;
|
hybOutputRealDry++, hybOutputRealWet++;
|
||||||
hybOutputImagDry++, hybOutputImagWet++;
|
hybOutputImagDry++, hybOutputImagWet++;
|
||||||
pBP++;
|
pBP++;
|
||||||
|
@ -253,14 +251,11 @@ inline void combineSignalCplxScale2(FIXP_DBL *hybOutputRealDry,
|
||||||
|
|
||||||
for (n = bands - 1; n >= 0; n--) {
|
for (n = bands - 1; n >= 0; n--) {
|
||||||
*hybOutputRealDry = SATURATE_LEFT_SHIFT(
|
*hybOutputRealDry = SATURATE_LEFT_SHIFT(
|
||||||
(*hybOutputRealDry >> 1) +
|
(*hybOutputRealDry >> SF_SCALE) + fMult(*hybOutputRealWet, scaleX),
|
||||||
(fMultDiv2(*hybOutputRealWet, scaleX) << SF_SCALE),
|
SF_SCALE, DFRACT_BITS);
|
||||||
1, DFRACT_BITS);
|
|
||||||
*hybOutputImagDry = SATURATE_LEFT_SHIFT(
|
*hybOutputImagDry = SATURATE_LEFT_SHIFT(
|
||||||
(*hybOutputImagDry >> 1) +
|
(*hybOutputImagDry >> SF_SCALE) + fMult(*hybOutputImagWet, scaleX),
|
||||||
(fMultDiv2(*hybOutputImagWet, scaleX) << SF_SCALE),
|
SF_SCALE, DFRACT_BITS);
|
||||||
1, DFRACT_BITS);
|
|
||||||
;
|
|
||||||
hybOutputRealDry++, hybOutputRealWet++;
|
hybOutputRealDry++, hybOutputRealWet++;
|
||||||
hybOutputImagDry++, hybOutputImagWet++;
|
hybOutputImagDry++, hybOutputImagWet++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue