Skip to content
Snippets Groups Projects
Commit ac76b150 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

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
parent c9f857ef
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,11 @@ opus_int32 silk_schur64( /* O returns residual ene
}
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 @@ opus_int32 silk_schur64( /* O returns residual ene
}
}
return( C[ 0 ][ 1 ] );
for(; k < order; k++ ) {
rc_Q16[ k ] = 0;
}
return silk_max_32( 1, C[ 0 ][ 1 ] );
}
......@@ -68,6 +68,10 @@ opus_int32 silk_schur( /* O Returns residual ene
}
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 @@ opus_int32 silk_schur( /* O Returns residual ene
}
}
for(; k < order; k++ ) {
rc_Q15[ k ] = 0;
}
/* return residual energy */
return C[ 0 ][ 1 ];
return silk_max_32( 1, C[ 0 ][ 1 ] );
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment