aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec/src/usacdec_fac.cpp
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2018-12-26 18:18:55 -0800
committerandroid-build-merger <android-build-merger@google.com>2018-12-26 18:18:55 -0800
commit3f50499c9c8f95725c13e7eee25a3439822c7307 (patch)
treea46651fe03dbdc14c9cfc7fa56e638a37fe3a6a9 /libAACdec/src/usacdec_fac.cpp
parent0694a4e1e8ee8223325c67500a7f689a14df0eb1 (diff)
parent18d4dcf2551245c887962e34130cb24414b0b969 (diff)
downloadfdk-aac-3f50499c9c8f95725c13e7eee25a3439822c7307.tar.gz
fdk-aac-3f50499c9c8f95725c13e7eee25a3439822c7307.tar.bz2
fdk-aac-3f50499c9c8f95725c13e7eee25a3439822c7307.zip
Merge "Prevent overflow in usac filters" am: 4053380094 am: eaad782db3
am: 18d4dcf255 Change-Id: Id1736dd6af5b656c158896f6d9fcb117231351a4
Diffstat (limited to 'libAACdec/src/usacdec_fac.cpp')
-rw-r--r--libAACdec/src/usacdec_fac.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/libAACdec/src/usacdec_fac.cpp b/libAACdec/src/usacdec_fac.cpp
index 25d3119..c10a3fe 100644
--- a/libAACdec/src/usacdec_fac.cpp
+++ b/libAACdec/src/usacdec_fac.cpp
@@ -191,13 +191,11 @@ static void Syn_filt_zero(const FIXP_LPC a[], const INT a_exp, INT length,
L_tmp = (FIXP_DBL)0;
for (j = 0; j < fMin(i, M_LP_FILTER_ORDER); j++) {
- L_tmp -= fMultDiv2(a[j], x[i - (j + 1)]);
+ L_tmp -= fMultDiv2(a[j], x[i - (j + 1)]) >> (LP_FILTER_SCALE - 1);
}
- L_tmp = scaleValue(L_tmp, a_exp + 1);
-
- x[i] = scaleValueSaturate((x[i] >> 1) + (L_tmp >> 1),
- 1); /* Avoid overflow issues and saturate. */
+ L_tmp = scaleValue(L_tmp, a_exp + LP_FILTER_SCALE);
+ x[i] = fAddSaturate(x[i], L_tmp);
}
}