ref: ac76b1503f759201f03dc6acb7bf00bd39f560d3
parent: c9f857ef60fcd6331a47627822ba07f5fb9dd1a0
author: Jean-Marc Valin <[email protected]>
date: Thu May 9 12:17:13 EDT 2013
Fixes an assertion failure in SILK We stop the schur recursion before any reflection coefficient goes outside of ]-1,1[ and we force reporting a residual energy of at least 1. Assertion was: Fatal (internal) error in ../silk/fixed/noise_shape_analysis_FIX.c, line 290: assertion failed: nrg >= 0 triggered by: opus_demo voip 16000 1 12500 -bandwidth WB -complexity 10 pl04f087.stp-crash out.pcm
--- a/silk/fixed/schur64_FIX.c
+++ b/silk/fixed/schur64_FIX.c
@@ -56,6 +56,11 @@
}
for( k = 0; k < order; k++ ) {
+ /* Check that we won't be getting an unstable rc, otherwise stop here. */
+ if (silk_abs_int32(C[ k + 1 ][ 0 ]) >= C[ 0 ][ 1 ]) {
+ break;
+ }
+
/* Get reflection coefficient: divide two Q30 values and get result in Q31 */
rc_tmp_Q31 = silk_DIV32_varQ( -C[ k + 1 ][ 0 ], C[ 0 ][ 1 ], 31 );
@@ -73,5 +78,9 @@
}
}
- return( C[ 0 ][ 1 ] );
+ for(; k < order; k++ ) {
+ rc_Q16[ k ] = 0;
+ }
+
+ return silk_max_32( 1, C[ 0 ][ 1 ] );
}
--- a/silk/fixed/schur_FIX.c
+++ b/silk/fixed/schur_FIX.c
@@ -68,6 +68,10 @@
}
for( k = 0; k < order; k++ ) {
+ /* Check that we won't be getting an unstable rc, otherwise stop here. */
+ if (silk_abs_int32(C[ k + 1 ][ 0 ]) >= C[ 0 ][ 1 ]) {
+ break;
+ }
/* Get reflection coefficient */
rc_tmp_Q15 = -silk_DIV32_16( C[ k + 1 ][ 0 ], silk_max_32( silk_RSHIFT( C[ 0 ][ 1 ], 15 ), 1 ) );
@@ -87,6 +91,10 @@
}
}
+ for(; k < order; k++ ) {
+ rc_Q15[ k ] = 0;
+ }
+
/* return residual energy */
- return C[ 0 ][ 1 ];
+ return silk_max_32( 1, C[ 0 ][ 1 ] );
}