From f4fc574fdd957bdc222e3d28d13401748215b167 Mon Sep 17 00:00:00 2001 From: Fraunhofer IIS FDK Date: Thu, 20 Dec 2018 15:52:46 +0100 Subject: Prevent energy overflow in acelp calc_period_factor() Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: I5a28fcb09a1b0b0d1f8861642c64185937021154 --- libAACdec/src/usacdec_acelp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libAACdec') diff --git a/libAACdec/src/usacdec_acelp.cpp b/libAACdec/src/usacdec_acelp.cpp index 9fecebf..c836c6a 100644 --- a/libAACdec/src/usacdec_acelp.cpp +++ b/libAACdec/src/usacdec_acelp.cpp @@ -309,7 +309,7 @@ static FIXP_DBL calc_period_factor(FIXP_DBL exc[], FIXP_SGL gain_pit, ener_exc = (FIXP_DBL)0; for (int i = 0; i < L_SUBFR; i++) { ener_exc += fPow2Div2(exc[i]) >> s; - if (ener_exc > FL2FXCONST_DBL(0.5f)) { + if (ener_exc >= FL2FXCONST_DBL(0.5f)) { ener_exc >>= 1; s++; } -- cgit v1.2.3