Loading lib_com/lsp_conv_poly_fx.c +78 −5 Original line number Diff line number Diff line Loading @@ -336,8 +336,10 @@ static Word32 b_inv_sq( Word16 m_den, exp_den; Word16 div_out; Word32 Ltmp; #ifdef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif exp_den = norm_l( in32 ); Loading @@ -345,14 +347,17 @@ static Word32 b_inv_sq( exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) ); m_den = mult_r( m_den, m_den ); #ifdef ISSUE_1796_replace_shl_o exp_den = shl_sat( exp_den, 1 ); #ifdef ISSUE_1836_replace_overflow_libcom exp_den = shl( exp_den, 1 ); div_out = div_s( 8192, m_den ); Ltmp = L_shl_sat( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/ //??sat #else exp_den = shl_o( exp_den, 1, &Overflow ); #endif div_out = div_s( 8192, m_den ); Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/ #endif return Ltmp; } Loading @@ -368,8 +373,10 @@ static Word32 inv_pow( Word32 mh; UWord16 ml; Word32 r0, s0; #ifdef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif IF( re == 0 ) Loading @@ -382,7 +389,11 @@ static Word32 inv_pow( { exp1 = norm_l( re ); tmp = extract_h( L_shl( re, exp1 ) ); #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); //??sat #else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); #endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); r0 = L_add( L_tmp, mh ); } Loading @@ -397,7 +408,11 @@ static Word32 inv_pow( { exp2 = norm_l( se ); tmp = extract_h( L_shl( se, exp2 ) ); #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); #else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); #endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); s0 = L_sub( L_tmp, mh ); } Loading Loading @@ -427,8 +442,8 @@ static Word32 inv_pow( } tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp ); exp1 = add( exp1, exp2 ); #ifdef ISSUE_1799_replace_L_shr_o L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ //??sat #else L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */ #endif Loading Loading @@ -509,8 +524,10 @@ static void spectautocorr_fx( UWord16 ml; Word32 r[M + 1]; Word16 exp0; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif /*---------------------------------------------------------------------* Loading @@ -533,7 +550,11 @@ static void spectautocorr_fx( move32(); FOR( i = 2; i < N - 1; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom r[0] = L_add_sat( r[0], G[i] ); #else r[0] = L_add_o( r[0], G[i], &Overflow ); #endif move32(); } Loading Loading @@ -567,18 +588,47 @@ static void spectautocorr_fx( move16(); /* 1.0 in Q15 */ FOR( i = 1; i < imid; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom gp = L_add_sat( G[i], G[N - i - 1] ); //??sat #else gp = L_add_o( G[i], G[N - i - 1], &Overflow ); #endif gn = L_sub( G[i], G[N - i - 1] ); /*r[1] = L_mac(r[1], x[i-1], gn);*/ Mpy_32_16_ss( gn, x[i - 1], &mh, &ml ); #ifdef ISSUE_1836_replace_overflow_libcom r[1] = L_add_sat( r[1], mh ); //??sat #else r[1] = L_add_o( r[1], mh, &Overflow ); #endif move32(); c[1] = x[i - 1]; move16(); FOR( j = 2; j < M; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat move16(); /*r[j] = L_mac(r[j], c[j], gp);*/ Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_sat( r[j], mh ); //??sat move32(); c[j + 1] = mult_r( c[j], x[i - 1] ); move16(); c[j + 1] = add_sat( c[j + 1], sub_sat( c[j + 1], c[j - 1] ) ); //??sat //??sat move16(); /*r[j+1] = L_mac(r[j+1], c[j+1], gn);*/ Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_sat( r[j + 1], mh ); //??sat move32(); #else c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); Loading @@ -598,33 +648,56 @@ static void spectautocorr_fx( Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_o( r[j + 1], mh, &Overflow ); move32(); #endif } c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); #ifdef ISSUE_1836_replace_overflow_libcom c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_sat( r[j], mh ); //??sat move32(); #else c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_o( r[j], mh, &Overflow ); move32(); #endif } /*---------------------------------------------------------------------* * Add the endpoints x = cos(0) = 1 and x = cos(pi) = -1 as * well as the lower half of the unit circle. *---------------------------------------------------------------------*/ #ifdef ISSUE_1836_replace_overflow_libcom gp = L_shr( L_add_sat( G[0], G[N - 1] ), 1 ); //??sat gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_sat( r[0], gp ); //??sat #else gp = L_shr( L_add_o( G[0], G[N - 1], &Overflow ), 1 ); gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_o( r[0], gp, &Overflow ); #endif move32(); exp0 = norm_l( r[0] ); L_Extract( L_shl( r[0], exp0 ), &rh[0], &rl[0] ); FOR( j = 1; j < M; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom L_Extract( L_shl( L_add_sat( r[j], gn), exp0 ), &rh[j], &rl[j] ); //??sat L_Extract( L_shl( L_add_sat( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] ); //??sat #else L_Extract( L_shl( L_add_o( r[j], gn, &Overflow ), exp0 ), &rh[j], &rl[j] ); L_Extract( L_shl( L_add_o( r[j + 1], gp, &Overflow ), exp0 ), &rh[j + 1], &rl[j + 1] ); #endif } return; Loading lib_com/lpc_tools_fx.c +1 −1 File changed.Contains only whitespace changes. Show changes lib_com/lsf_tools_fx.c +39 −39 File changed.Contains only whitespace changes. Show changes Loading
lib_com/lsp_conv_poly_fx.c +78 −5 Original line number Diff line number Diff line Loading @@ -336,8 +336,10 @@ static Word32 b_inv_sq( Word16 m_den, exp_den; Word16 div_out; Word32 Ltmp; #ifdef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif exp_den = norm_l( in32 ); Loading @@ -345,14 +347,17 @@ static Word32 b_inv_sq( exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) ); m_den = mult_r( m_den, m_den ); #ifdef ISSUE_1796_replace_shl_o exp_den = shl_sat( exp_den, 1 ); #ifdef ISSUE_1836_replace_overflow_libcom exp_den = shl( exp_den, 1 ); div_out = div_s( 8192, m_den ); Ltmp = L_shl_sat( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/ //??sat #else exp_den = shl_o( exp_den, 1, &Overflow ); #endif div_out = div_s( 8192, m_den ); Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/ #endif return Ltmp; } Loading @@ -368,8 +373,10 @@ static Word32 inv_pow( Word32 mh; UWord16 ml; Word32 r0, s0; #ifdef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif IF( re == 0 ) Loading @@ -382,7 +389,11 @@ static Word32 inv_pow( { exp1 = norm_l( re ); tmp = extract_h( L_shl( re, exp1 ) ); #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); //??sat #else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); #endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); r0 = L_add( L_tmp, mh ); } Loading @@ -397,7 +408,11 @@ static Word32 inv_pow( { exp2 = norm_l( se ); tmp = extract_h( L_shl( se, exp2 ) ); #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); #else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); #endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); s0 = L_sub( L_tmp, mh ); } Loading Loading @@ -427,8 +442,8 @@ static Word32 inv_pow( } tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp ); exp1 = add( exp1, exp2 ); #ifdef ISSUE_1799_replace_L_shr_o L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ //??sat #else L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */ #endif Loading Loading @@ -509,8 +524,10 @@ static void spectautocorr_fx( UWord16 ml; Word32 r[M + 1]; Word16 exp0; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif /*---------------------------------------------------------------------* Loading @@ -533,7 +550,11 @@ static void spectautocorr_fx( move32(); FOR( i = 2; i < N - 1; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom r[0] = L_add_sat( r[0], G[i] ); #else r[0] = L_add_o( r[0], G[i], &Overflow ); #endif move32(); } Loading Loading @@ -567,18 +588,47 @@ static void spectautocorr_fx( move16(); /* 1.0 in Q15 */ FOR( i = 1; i < imid; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom gp = L_add_sat( G[i], G[N - i - 1] ); //??sat #else gp = L_add_o( G[i], G[N - i - 1], &Overflow ); #endif gn = L_sub( G[i], G[N - i - 1] ); /*r[1] = L_mac(r[1], x[i-1], gn);*/ Mpy_32_16_ss( gn, x[i - 1], &mh, &ml ); #ifdef ISSUE_1836_replace_overflow_libcom r[1] = L_add_sat( r[1], mh ); //??sat #else r[1] = L_add_o( r[1], mh, &Overflow ); #endif move32(); c[1] = x[i - 1]; move16(); FOR( j = 2; j < M; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat move16(); /*r[j] = L_mac(r[j], c[j], gp);*/ Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_sat( r[j], mh ); //??sat move32(); c[j + 1] = mult_r( c[j], x[i - 1] ); move16(); c[j + 1] = add_sat( c[j + 1], sub_sat( c[j + 1], c[j - 1] ) ); //??sat //??sat move16(); /*r[j+1] = L_mac(r[j+1], c[j+1], gn);*/ Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_sat( r[j + 1], mh ); //??sat move32(); #else c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); Loading @@ -598,33 +648,56 @@ static void spectautocorr_fx( Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_o( r[j + 1], mh, &Overflow ); move32(); #endif } c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); #ifdef ISSUE_1836_replace_overflow_libcom c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_sat( r[j], mh ); //??sat move32(); #else c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_o( r[j], mh, &Overflow ); move32(); #endif } /*---------------------------------------------------------------------* * Add the endpoints x = cos(0) = 1 and x = cos(pi) = -1 as * well as the lower half of the unit circle. *---------------------------------------------------------------------*/ #ifdef ISSUE_1836_replace_overflow_libcom gp = L_shr( L_add_sat( G[0], G[N - 1] ), 1 ); //??sat gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_sat( r[0], gp ); //??sat #else gp = L_shr( L_add_o( G[0], G[N - 1], &Overflow ), 1 ); gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_o( r[0], gp, &Overflow ); #endif move32(); exp0 = norm_l( r[0] ); L_Extract( L_shl( r[0], exp0 ), &rh[0], &rl[0] ); FOR( j = 1; j < M; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom L_Extract( L_shl( L_add_sat( r[j], gn), exp0 ), &rh[j], &rl[j] ); //??sat L_Extract( L_shl( L_add_sat( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] ); //??sat #else L_Extract( L_shl( L_add_o( r[j], gn, &Overflow ), exp0 ), &rh[j], &rl[j] ); L_Extract( L_shl( L_add_o( r[j + 1], gp, &Overflow ), exp0 ), &rh[j + 1], &rl[j + 1] ); #endif } return; Loading