ref: 6be769c3f3f05a9fa090ac8b8371cc4fa7cd1e1b
parent: 1a94b2b8797a3c289ac23bd42cda9a37b73ca112
author: Jean-Marc Valin <[email protected]>
date: Fri Jul 15 06:55:59 EDT 2016
Apply 02f3ac225f99 fix for divide-by-zero to the SSE4.1 version of silk_burg_modified()
--- a/silk/fixed/x86/burg_modified_FIX_sse.c
+++ b/silk/fixed/x86/burg_modified_FIX_sse.c
@@ -300,12 +300,14 @@
/* Max prediction gain exceeded; set reflection coefficient such that max prediction gain is exactly hit */
tmp2 = ( (opus_int32)1 << 30 ) - silk_DIV32_varQ( minInvGain_Q30, invGain_Q30, 30 ); /* Q30 */
rc_Q31 = silk_SQRT_APPROX( tmp2 ); /* Q15 */
- /* Newton-Raphson iteration */
- rc_Q31 = silk_RSHIFT32( rc_Q31 + silk_DIV32( tmp2, rc_Q31 ), 1 ); /* Q15 */
- rc_Q31 = silk_LSHIFT32( rc_Q31, 16 ); /* Q31 */
- if( num < 0 ) {
- /* Ensure adjusted reflection coefficients has the original sign */
- rc_Q31 = -rc_Q31;
+ if( rc_Q31 > 0 ) {
+ /* Newton-Raphson iteration */
+ rc_Q31 = silk_RSHIFT32( rc_Q31 + silk_DIV32( tmp2, rc_Q31 ), 1 ); /* Q15 */
+ rc_Q31 = silk_LSHIFT32( rc_Q31, 16 ); /* Q31 */
+ if( num < 0 ) {
+ /* Ensure adjusted reflection coefficients has the original sign */
+ rc_Q31 = -rc_Q31;
+ }
}
invGain_Q30 = minInvGain_Q30;
reached_max_gain = 1;