ref: 79e8f527b0344b0897a65be35e77f7885bd99409
parent: c41aeebea836cf2f3a67b3ac5d7bbfb0924ca1e7
author: Felicia Lim <flim@google.com>
date: Thu Jul 28 11:21:19 EDT 2016
Ensure that NLSF cannot be negative when computing a min distance between them Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
--- a/silk/NLSF_stabilize.c
+++ b/silk/NLSF_stabilize.c
@@ -130,7 +130,7 @@
/* Keep delta_min distance between the NLSFs */
for( i = 1; i < L; i++ )
- NLSF_Q15[i] = silk_max_int( NLSF_Q15[i], NLSF_Q15[i-1] + NDeltaMin_Q15[i] );
+ NLSF_Q15[i] = silk_max_int( NLSF_Q15[i], silk_ADD_SAT16( NLSF_Q15[i-1], NDeltaMin_Q15[i] ) );
/* Last NLSF should be no higher than 1 - NDeltaMin[L] */
NLSF_Q15[L-1] = silk_min_int( NLSF_Q15[L-1], (1<<15) - NDeltaMin_Q15[L] );