mirror of
https://github.com/xiph/opus.git
synced 2025-05-31 15:47:43 +00:00
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
This commit is contained in:
parent
c9f857ef60
commit
ac76b1503f
2 changed files with 19 additions and 2 deletions
|
@ -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 ] );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue