Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/silk
diff options
context:
space:
mode:
authorTom Denton <tomdenton@google.com>2022-02-08 03:34:41 +0300
committerJean-Marc Valin <jmvalin@jmvalin.ca>2022-02-24 20:23:22 +0300
commit37aba6e9b382f7dbdb7916adbc335704cf2992e8 (patch)
tree4455e732147c8c8f27c626118ca70b1e95a8efed /silk
parent66d060c7734c9b780d0183f6565d474fc246b84b (diff)
Prevent int32 overflow when applying HARM FIR filter in NSQ.c by using a saturating sum. This matches behavior in NSQ_del_dec.c.
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
Diffstat (limited to 'silk')
-rw-r--r--silk/NSQ.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/silk/NSQ.c b/silk/NSQ.c
index 1d64d8e2..ab8f9b6c 100644
--- a/silk/NSQ.c
+++ b/silk/NSQ.c
@@ -262,7 +262,7 @@ void silk_noise_shape_quantizer(
tmp1 = silk_SUB32( tmp1, n_LF_Q12 ); /* Q12 */
if( lag > 0 ) {
/* Symmetric, packed FIR coefficients */
- n_LTP_Q13 = silk_SMULWB( silk_ADD32( shp_lag_ptr[ 0 ], shp_lag_ptr[ -2 ] ), HarmShapeFIRPacked_Q14 );
+ n_LTP_Q13 = silk_SMULWB( silk_ADD_SAT32( shp_lag_ptr[ 0 ], shp_lag_ptr[ -2 ] ), HarmShapeFIRPacked_Q14 );
n_LTP_Q13 = silk_SMLAWT( n_LTP_Q13, shp_lag_ptr[ -1 ], HarmShapeFIRPacked_Q14 );
n_LTP_Q13 = silk_LSHIFT( n_LTP_Q13, 1 );
shp_lag_ptr++;