Ensure that NLSF cannot be negative when computing a min distance between them
authorFelicia Lim <flim@google.com>
Thu, 28 Jul 2016 13:21:19 +0000 (15:21 +0200)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Thu, 28 Jul 2016 17:47:58 +0000 (13:47 -0400)
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
silk/NLSF_stabilize.c

index 1fa1ea3..8f3426b 100644 (file)
@@ -130,7 +130,7 @@ void silk_NLSF_stabilize(
 
         /* 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] );