Loading lib_com/hp50_fx.c +70 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,11 @@ #include "prot_fx.h" #include "wmc_auto.h" #ifndef ISSUE_1836_FILEACTIVE_hp50_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif #define HP20_COEFF_SCALE ( 2 ) /* Loading Loading @@ -86,9 +91,11 @@ static void filter_2nd_order( Word16 i; Word16 x2, x1; Word32 L_sum, L_y1, L_y2; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif /* Loading @@ -107,10 +114,18 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[0], a2 ) ); /* y2*a2 */ L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[1], a1 ) ); /* y1*a1 */ #ifdef ISSUE_1836_replace_overflow_libcom L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[0] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); //??sat //??sat #else L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[0] = round_fx_o( L_shl_o( L_y2, prescale, &Overflow ), &Overflow ); #endif BASOP_SATURATE_WARNING_ON_EVS BASOP_SATURATE_ERROR_ON_EVS Loading @@ -121,10 +136,17 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[1], a2 ) ); /* y2*a2 */ L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) ); /* y1*a1 */ #ifdef ISSUE_1836_replace_overflow_libcom L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[stride] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); //??sat #else L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[stride] = round_fx_o( L_shl_o( L_y1, prescale, &Overflow ), &Overflow ); #endif BASOP_SATURATE_WARNING_ON_EVS move16(); Loading @@ -140,10 +162,17 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a2 ) ); L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y1, a1 ) ); #ifdef ISSUE_1836_replace_overflow_libcom L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( i, stride )] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); //??sat #else L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( i, stride )] = round_fx_o( L_shl_o( L_y2, prescale, &Overflow ), &Overflow ); #endif BASOP_SATURATE_WARNING_ON_EVS /* y[i+1] = b2*x[i-1] + b1*x[i-0] + b2*x[i+1] + a2*y[i-1] + a1*y[i+0]; */ BASOP_SATURATE_ERROR_ON_EVS Loading @@ -154,10 +183,17 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y1, a2 ) ); L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) ); #ifdef ISSUE_1836_replace_overflow_libcom L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( add( i, 1 ), stride )] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); //??sat #else L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( add( i, 1 ), stride )] = round_fx_o( L_shl_o( L_y1, prescale, &Overflow ), &Overflow ); #endif BASOP_SATURATE_WARNING_ON_EVS move16(); } Loading Loading @@ -190,9 +226,11 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * { Word32 a1, b1, a2, b2; Word16 prescale, prescaleOld, diff; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif prescale = getScaleFactor16( signal, lg ); Loading @@ -202,7 +240,11 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * { prescale = s_min( prescale, diff ); } #ifdef ISSUE_1836_replace_overflow_libcom diff = norm_l( L_shl_sat( mem[3], prescaleOld ) ); //??sat #else diff = norm_l( L_shl_o( mem[3], prescaleOld, &Overflow ) ); #endif if ( mem[3] != 0 ) { prescale = s_min( prescale, diff ); Loading @@ -212,6 +254,15 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * IF( prescale != prescaleOld ) { diff = sub( prescale, prescaleOld ); #ifdef ISSUE_1836_replace_overflow_libcom mem[0] = L_shr_sat( mem[0], diff ); //??sat move32(); mem[1] = L_shr_sat( mem[1], diff ); //??sat move32(); mem[2] = L_shr_sat( mem[2], diff ); //??sat move32(); mem[3] = L_shr_sat( mem[3], diff ); //?sat #else mem[0] = L_shr_o( mem[0], diff, &Overflow ); move32(); mem[1] = L_shr_o( mem[1], diff, &Overflow ); Loading @@ -219,6 +270,7 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * mem[2] = L_shr_o( mem[2], diff, &Overflow ); move32(); mem[3] = L_shr_o( mem[3], diff, &Overflow ); #endif move32(); mem[4] = L_deposit_l( prescale ); } Loading Loading @@ -303,7 +355,9 @@ void hp20_fx_32( Word32 i; Word32 a1_fx, a2_fx, b1_fx, b2_fx; Word32 diff_pos, diff_neg; #ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; #endif Word16 prescale, prescaleOld, prescale_current_frame, diff; prescale = getScaleFactor32( signal_fx, lg ); Loading @@ -312,8 +366,14 @@ void hp20_fx_32( prescaleOld = extract_l( mem_fx[4] ); #ifdef ISSUE_1836_replace_overflow_libcom diff_pos = norm_l( L_shl_sat( L_max( mem_fx[2], mem_fx[3] ), prescaleOld ) ); //??sat diff_neg = norm_l( L_shl_sat( L_min( mem_fx[2], mem_fx[3] ), prescaleOld ) ); //??sat #else diff_pos = norm_l( L_shl_o( L_max( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); diff_neg = norm_l( L_shl_o( L_min( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); #endif diff = L_max( diff_pos, diff_neg ); Loading @@ -325,6 +385,15 @@ void hp20_fx_32( prescale = s_min( 3, sub( 1 + HP20_COEFF_SCALE, prescale ) ); diff = sub( prescale, prescaleOld ); #ifdef ISSUE_1836_replace_overflow_libcom mem_fx[0] = L_shr_sat( mem_fx[0], diff ); move32(); mem_fx[1] = L_shr_sat( mem_fx[1], diff ); move32(); mem_fx[2] = L_shr_sat( mem_fx[2], diff ); move32(); mem_fx[3] = L_shr_sat( mem_fx[3], diff ); #else mem_fx[0] = L_shr_o( mem_fx[0], diff, &Overflow ); move32(); mem_fx[1] = L_shr_o( mem_fx[1], diff, &Overflow ); Loading @@ -332,6 +401,7 @@ void hp20_fx_32( mem_fx[2] = L_shr_o( mem_fx[2], diff, &Overflow ); move32(); mem_fx[3] = L_shr_o( mem_fx[3], diff, &Overflow ); #endif move32(); mem_fx[4] = L_deposit_l( prescale_current_frame ); move32(); Loading lib_com/hq2_bit_alloc_fx.c +13 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,13 @@ #include "prot_fx.h" #include "rom_com.h" #ifndef ISSUE_1836_FILEACTIVE_hq2_bit_alloc_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif #define MIN_BITS_FIX 0 /* QRk=18 */ #define HQ_16k40_BIT ( HQ_16k40 / 50 ) /* 16400/50=328 */ #define Qbf 14 /* Q value for bits_fact */ Loading Loading @@ -312,9 +319,11 @@ void hq2_bit_alloc_har_fx( Word16 exp_shift; #ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow; Overflow = 0; move32(); #endif L_THR1 = L_shl( L_deposit_l( THR1 ), SWB_BWE_LR_QRk ); L_THR2 = L_shl( L_deposit_l( THR2 ), SWB_BWE_LR_QRk ); Loading Loading @@ -570,9 +579,13 @@ void hq2_bit_alloc_har_fx( L_temp = Mult_32_16( L_Ravg_sub[GRP_SB - 1], sub( GRP_SB, 1 ) ); /* Qbe+0+1 */ L_temp = Mult_32_16( L_temp, Inv_norm_sum_fx ); /* Qbe+1+QIpb+1 */ #ifdef ISSUE_1836_replace_overflow_libcom lf_hf_ge_r_fx = round_fx_sat( L_shl_sat( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ) ) ); //??sat #else lf_hf_ge_r_fx = round_fx_o( L_shl_o( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ), &Overflow ), &Overflow ); Overflow = 0; /* reset BASOP Overflow */ move32(); #endif exp_normn = norm_s( norm_sum_fx ); exp_normn = sub( exp_normn, 1 ); Loading lib_com/hq2_core_com_fx.c +27 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,13 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" #ifndef ISSUE_1836_FILEACTIVE_hq2_core_com_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*--------------------------------------------------------------------------* * mdct_spectrum_denorm() * Loading Loading @@ -88,9 +95,11 @@ void mdct_spectrum_denorm_fx( Word16 cond_fx; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); /* allow overflow happen. */ #endif #endif exp_safe = 4; /* safe bit for overflow */ Loading Loading @@ -163,8 +172,12 @@ void mdct_spectrum_denorm_fx( pd_fx = div_s( shl( npulses[k], exp_normn ), shl( band_width[k], exp_normd ) ); /* 15 + (exp_norm - exp_normd) */ Qpd = add( sub( exp_normn, exp_normd ), 15 ); #ifdef ISSUE_1836_replace_overflow_libcom cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ //??sat #else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ Overflow = 0; #endif move16(); /* allow overflow happen. */ IF( cond_fx < 0 ) { Loading Loading @@ -196,7 +209,11 @@ void mdct_spectrum_denorm_fx( /*gamma *= gain_tweak; */ L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */ exp_norm = norm_l( L_tmp ); #ifdef ISSUE_1836_replace_overflow_libcom gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); //??sat #else gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow ); #endif Qgamma = sub( add( add( Qgamma, Qtweak ), exp_norm ), 15 ); /*Qgamma+Qtweak+1+exp_norm-16; */ } Loading Loading @@ -260,9 +277,11 @@ void mdct_spectrum_denorm_ivas_fx( Word16 cond_fx; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); /* allow overflow happen. */ #endif #endif exp_safe = 4; /* safe bit for overflow */ Loading Loading @@ -335,8 +354,12 @@ void mdct_spectrum_denorm_ivas_fx( pd_fx = div_s( shl( npulses[k], exp_normn ), shl( band_width[k], exp_normd ) ); /* 15 + (exp_normn + exp_normd) */ Qpd = add( sub( exp_normn, exp_normd ), 15 ); #ifdef ISSUE_1836_replace_overflow_libcom cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ //??sat #else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ Overflow = 0; #endif move16(); /* allow overflow happen. */ IF( cond_fx < 0 ) { Loading Loading @@ -368,7 +391,11 @@ void mdct_spectrum_denorm_ivas_fx( /*gamma *= gain_tweak; */ L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */ exp_norm = norm_l( L_tmp ); #ifdef ISSUE_1836_replace_overflow_libcom gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); //??sat #else gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow ); #endif Qgamma = sub( add( add( Qgamma, Qtweak ), exp_norm ), 15 ); /*Qgamma+Qtweak+1+exp_norm-16; */ } Loading lib_com/hq2_noise_inject_fx.c +55 −11 Original line number Diff line number Diff line Loading @@ -36,6 +36,12 @@ #include "oper_32b.h" #include "move.h" #ifndef ISSUE_1836_FILEACTIVE_hq2_noise_inject_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*--------------------------------------------------------------------------* * hq2_noise_inject() * Loading Loading @@ -80,9 +86,11 @@ void hq2_noise_inject_fx( Word16 i, j, k, ni_end_band, satur, count[BANDS_MAX], max_pos_pulse, pos; Word16 sb = bands; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif satur = 0; Loading @@ -90,7 +98,11 @@ void hq2_noise_inject_fx( FOR( i = 0; i < bands; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom Ep_fx[i] = L_shl_sat( Ep_fx[i], 6 ); /* Q-6 -> Q0 */ //??sat #else Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */ #endif move32(); } Loading Loading @@ -155,7 +167,11 @@ void hq2_noise_inject_fx( Q_env_fx[k] = sub( 31, exp2 ); move16(); tmp = sub( 17, Q_env_fx[k] ); #ifdef ISSUE_1836_replace_overflow_libcom env_fx2[k] = extract_h( L_shl_sat( env_fx[k], tmp ) ); /*Q1 */ //??sat #else env_fx2[k] = extract_h( L_shl_o( env_fx[k], tmp, &Overflow ) ); /*Q1 */ #endif peak_fx[k] = 0; move16(); count[k] = 0; Loading @@ -166,7 +182,11 @@ void hq2_noise_inject_fx( FOR( i = band_start[k]; i <= band_end[k]; i++ ) { L_tmp = L_mult0( y2hat_fx[i], y2hat_fx[i] ); /* Q0 */ #ifdef ISSUE_1836_replace_overflow_libcom Ep_fx[k] = L_sub_sat( Ep_fx[k], L_tmp ); //??sat #else Ep_fx[k] = L_sub_o( Ep_fx[k], L_tmp, &Overflow ); #endif move32(); /* Q0 */ IF( GT_16( abs_s( y2hat_fx[i] ), peak_fx[k] ) ) { Loading Loading @@ -387,7 +407,11 @@ void hq2_noise_inject_fx( ELSE IF( count[k - 1] == 0 && tmp4 > 0 ) { L_tmp = L_mult( env_fx2[k - 1], tmp ); /* Q(1+Q_speech+1 = Q_speech+2) */ #ifdef ISSUE_1836_replace_overflow_libcom fac_fx = extract_h( L_shl_sat( L_tmp, sub( 26, Q_speech ) ) ); /*Q12 */ #else fac_fx = extract_h( L_shl_o( L_tmp, sub( 26, Q_speech ), &Overflow ) ); /*Q12 */ #endif } } Loading Loading @@ -467,7 +491,11 @@ void hq2_noise_inject_fx( } L_tmp = Mult_32_16( Ep_fx[k], fac_fx ); /*Q(Q_Ep_fx[k]+12-15 = Q_Ep_fx[k]-3) */ #ifdef ISSUE_1836_replace_overflow_libcom ni_gain_fx[k] = L_shr_sat( L_tmp, sub( Q_Ep_fx[k], 20 ) ); //??sat #else ni_gain_fx[k] = L_shr_o( L_tmp, sub( Q_Ep_fx[k], 20 ), &Overflow ); #endif move32(); /*Q17 */ } ELSE Loading Loading @@ -589,14 +617,22 @@ void hq2_noise_inject_fx( L_tmp = Mult_32_16( Ep_fx[k], tmp ); /*Q(Q_Ep_fx[k]+28-Q_speech-15 = Q_Ep_fx[k]+13-Q_speech) */ tmp = sub( Q_Ep_fx[k], Q_speech ); tmp = sub( 15, tmp ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat #else tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ #endif } ELSE { tmp = 0x7fff; /*Q0 */ L_tmp = Mult_32_16( Ep_fx[k], tmp ); /*Q(Q_Ep_fx[k]+0-15 = Q_Ep_fx[k]-15) */ tmp = sub( 43, Q_Ep_fx[k] ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat #else tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ #endif } fac_fx = s_max( tmp, 4096 /* 1 in Q12 */ ); /*Q12 */ Loading @@ -608,7 +644,11 @@ void hq2_noise_inject_fx( IF( band_width[k] != 0 ) { Q_speech = norm_s( band_width[k] ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = shl_sat( band_width[k], Q_speech ); /*Q(Q_speech) */ //??sat #else tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ #endif tmp = div_s( 16384 /* 0.5 in Q15 */, tmp ); /*Q(15+14-Q_speech) */ } ELSE Loading @@ -621,7 +661,11 @@ void hq2_noise_inject_fx( tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */ L_tmp = L_mult( tmp1, j ); /*Q13 */ L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = extract_h( L_shl_sat( L_tmp, add( 1, Q_speech ) ) ); /*Q12 */ //??sat #else tmp = extract_h( L_shl_o( L_tmp, add( 1, Q_speech ), &Overflow ) ); /*Q12 */ #endif tmp = sub( fac_fx, tmp ); /*Q12 */ L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ L_y2[i] = L_add( L_y2[i], L_shr( Mult_32_16( L_tmp, rand_fx ), 2 ) ); Loading lib_com/ifft_rel_fx.c +82 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,13 @@ #include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" #ifndef ISSUE_1836_FILEACTIVE_ifft_rel_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*-----------------------------------------------------------------* * Local constants *-----------------------------------------------------------------*/ Loading Loading @@ -77,10 +84,12 @@ void ifft_rel_fx( Word16 cc1, cc3, ss1, ss3; Word16 tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif /*-----------------------------------------------------------------* Loading Loading @@ -108,6 +117,17 @@ void ifft_rel_fx( FOR( i = is; i < n; i += id ) { #ifdef ISSUE_1836_replace_overflow_libcom t1 = sub_sat( *xi1, *xi3 ); /*Qx*/ //??sat *xi1 = add_sat( *xi1, *xi3 ); /*Qx*/ //??sat move16(); *xi2 = shl_sat( *xi2, 1 ); /*Qx*/ //??sat move16(); *xi3 = sub_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/ //??sat move16(); *xi4 = add_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/ //??sat move16(); #else t1 = sub_o( *xi1, *xi3, &Overflow ); /*Qx*/ *xi1 = add_o( *xi1, *xi3, &Overflow ); /*Qx*/ move16(); Loading @@ -117,9 +137,23 @@ void ifft_rel_fx( move16(); *xi4 = add_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/ move16(); #endif IF( NE_16( n4, 1 ) ) { #ifdef ISSUE_1836_replace_overflow_libcom t1 = mult_r( sub_sat( *( xi2 + n8 ), *( xi1 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ //??sat t2 = mult_r( add_sat( *( xi4 + n8 ), *( xi3 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ //??sat *( xi1 + n8 ) = add_sat( *( xi1 + n8 ), *( xi2 + n8 ) ); /*Qx*/ //??sat move16(); *( xi2 + n8 ) = sub_sat( *( xi4 + n8 ), *( xi3 + n8 ) ); /*Qx*/ //??sat move16(); *( xi3 + n8 ) = negate( shl_sat( add_sat( t2, t1 ), 1 ) ); /*Qx*/ //??sat move16(); *( xi4 + n8 ) = shl_sat( sub_sat( t1, t2 ), 1 ); /*Qx*/ //??sat move16(); #else t1 = mult_r( sub_o( *( xi2 + n8 ), *( xi1 + n8 ), &Overflow ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ t2 = mult_r( add_o( *( xi4 + n8 ), *( xi3 + n8 ), &Overflow ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ Loading @@ -131,6 +165,7 @@ void ifft_rel_fx( move16(); *( xi4 + n8 ) = shl_o( sub_o( t1, t2, &Overflow ), 1, &Overflow ); /*Qx*/ move16(); #endif } xi1 += id; xi2 += id; Loading Loading @@ -178,6 +213,45 @@ void ifft_rel_fx( FOR( i = is; i < n; i += id ) { #ifdef ISSUE_1836_replace_overflow_libcom t1 = sub_sat( *xup1, *xdn6 ); /*Qx*/ //??sat *xup1 = add_sat( *xup1, *xdn6 ); /*Qx*/ //??sat move16(); xup1 += n4; xdn6 -= n4; t2 = sub_sat( *xdn6, *xup1 ); /*Qx*/ //??sat *xdn6 = add_sat( *xup1, *xdn6 ); /*Qx*/ //??sat move16(); xdn6 += n4; t3 = add_sat( *xdn8, *xup3 ); /*Qx*/ //??sat *xdn6 = sub_sat( *xdn8, *xup3 ); /*Qx*/ //??sat move16(); xup3 += n4; xdn8 -= n4; t4 = add_sat( *xup3, *xdn8 ); /*Qx*/ //??sat *xup1 = sub_sat( *xup3, *xdn8 ); /*Qx*/ //??sat move16(); t5 = sub_sat( t1, t4 ); /*Qx*/ //??sat t1 = add_sat( t1, t4 ); /*Qx*/ //??sat t4 = sub_sat( t2, t3 ); /*Qx*/ //??sat t2 = add_sat( t2, t3 ); /*Qx*/ //??sat *xup3 = sub_sat( mult_r( t1, cc3 ), mult_r( t2, ss3 ) ); /*Qx*/ //??sat move16(); xup3 -= n4; *xup3 = add_sat( mult_r( t5, cc1 ), mult_r( t4, ss1 ) ); /*Qx*/ //??sat move16(); *xdn8 = sub_sat( mult_r( t5, ss1 ), mult_r( t4, cc1 ) ); /*Qx*/ //??sat move16(); xdn8 += n4; *xdn8 = add_sat( mult_r( t2, cc3 ), mult_r( t1, ss3 ) ); /*Qx*/ //??sat move16(); #else t1 = sub_o( *xup1, *xdn6, &Overflow ); /*Qx*/ *xup1 = add_o( *xup1, *xdn6, &Overflow ); /*Qx*/ move16(); Loading Loading @@ -215,6 +289,7 @@ void ifft_rel_fx( xdn8 += n4; *xdn8 = add_o( mult_r( t2, cc3 ), mult_r( t1, ss3 ), &Overflow ); /*Qx*/ move16(); #endif xup1 -= n4; xup1 += id; Loading Loading @@ -245,10 +320,17 @@ void ifft_rel_fx( { r1 = *xi0; move16(); #ifdef ISSUE_1836_replace_overflow_libcom *xi0 = add_sat( r1, *xi1 ); /*Qx*/ //??sat move16(); *xi1 = sub_sat( r1, *xi1 ); /*Qx*/ //??sat move16(); #else *xi0 = add_o( r1, *xi1, &Overflow ); /*Qx*/ move16(); *xi1 = sub_o( r1, *xi1, &Overflow ); /*Qx*/ move16(); #endif xi0 += id; xi1 += id; } Loading Loading
lib_com/hp50_fx.c +70 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,11 @@ #include "prot_fx.h" #include "wmc_auto.h" #ifndef ISSUE_1836_FILEACTIVE_hp50_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif #define HP20_COEFF_SCALE ( 2 ) /* Loading Loading @@ -86,9 +91,11 @@ static void filter_2nd_order( Word16 i; Word16 x2, x1; Word32 L_sum, L_y1, L_y2; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif /* Loading @@ -107,10 +114,18 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[0], a2 ) ); /* y2*a2 */ L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[1], a1 ) ); /* y1*a1 */ #ifdef ISSUE_1836_replace_overflow_libcom L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[0] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); //??sat //??sat #else L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[0] = round_fx_o( L_shl_o( L_y2, prescale, &Overflow ), &Overflow ); #endif BASOP_SATURATE_WARNING_ON_EVS BASOP_SATURATE_ERROR_ON_EVS Loading @@ -121,10 +136,17 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[1], a2 ) ); /* y2*a2 */ L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) ); /* y1*a1 */ #ifdef ISSUE_1836_replace_overflow_libcom L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[stride] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); //??sat #else L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[stride] = round_fx_o( L_shl_o( L_y1, prescale, &Overflow ), &Overflow ); #endif BASOP_SATURATE_WARNING_ON_EVS move16(); Loading @@ -140,10 +162,17 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a2 ) ); L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y1, a1 ) ); #ifdef ISSUE_1836_replace_overflow_libcom L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( i, stride )] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); //??sat #else L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( i, stride )] = round_fx_o( L_shl_o( L_y2, prescale, &Overflow ), &Overflow ); #endif BASOP_SATURATE_WARNING_ON_EVS /* y[i+1] = b2*x[i-1] + b1*x[i-0] + b2*x[i+1] + a2*y[i-1] + a1*y[i+0]; */ BASOP_SATURATE_ERROR_ON_EVS Loading @@ -154,10 +183,17 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y1, a2 ) ); L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) ); #ifdef ISSUE_1836_replace_overflow_libcom L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( add( i, 1 ), stride )] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); //??sat #else L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( add( i, 1 ), stride )] = round_fx_o( L_shl_o( L_y1, prescale, &Overflow ), &Overflow ); #endif BASOP_SATURATE_WARNING_ON_EVS move16(); } Loading Loading @@ -190,9 +226,11 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * { Word32 a1, b1, a2, b2; Word16 prescale, prescaleOld, diff; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif prescale = getScaleFactor16( signal, lg ); Loading @@ -202,7 +240,11 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * { prescale = s_min( prescale, diff ); } #ifdef ISSUE_1836_replace_overflow_libcom diff = norm_l( L_shl_sat( mem[3], prescaleOld ) ); //??sat #else diff = norm_l( L_shl_o( mem[3], prescaleOld, &Overflow ) ); #endif if ( mem[3] != 0 ) { prescale = s_min( prescale, diff ); Loading @@ -212,6 +254,15 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * IF( prescale != prescaleOld ) { diff = sub( prescale, prescaleOld ); #ifdef ISSUE_1836_replace_overflow_libcom mem[0] = L_shr_sat( mem[0], diff ); //??sat move32(); mem[1] = L_shr_sat( mem[1], diff ); //??sat move32(); mem[2] = L_shr_sat( mem[2], diff ); //??sat move32(); mem[3] = L_shr_sat( mem[3], diff ); //?sat #else mem[0] = L_shr_o( mem[0], diff, &Overflow ); move32(); mem[1] = L_shr_o( mem[1], diff, &Overflow ); Loading @@ -219,6 +270,7 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * mem[2] = L_shr_o( mem[2], diff, &Overflow ); move32(); mem[3] = L_shr_o( mem[3], diff, &Overflow ); #endif move32(); mem[4] = L_deposit_l( prescale ); } Loading Loading @@ -303,7 +355,9 @@ void hp20_fx_32( Word32 i; Word32 a1_fx, a2_fx, b1_fx, b2_fx; Word32 diff_pos, diff_neg; #ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; #endif Word16 prescale, prescaleOld, prescale_current_frame, diff; prescale = getScaleFactor32( signal_fx, lg ); Loading @@ -312,8 +366,14 @@ void hp20_fx_32( prescaleOld = extract_l( mem_fx[4] ); #ifdef ISSUE_1836_replace_overflow_libcom diff_pos = norm_l( L_shl_sat( L_max( mem_fx[2], mem_fx[3] ), prescaleOld ) ); //??sat diff_neg = norm_l( L_shl_sat( L_min( mem_fx[2], mem_fx[3] ), prescaleOld ) ); //??sat #else diff_pos = norm_l( L_shl_o( L_max( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); diff_neg = norm_l( L_shl_o( L_min( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); #endif diff = L_max( diff_pos, diff_neg ); Loading @@ -325,6 +385,15 @@ void hp20_fx_32( prescale = s_min( 3, sub( 1 + HP20_COEFF_SCALE, prescale ) ); diff = sub( prescale, prescaleOld ); #ifdef ISSUE_1836_replace_overflow_libcom mem_fx[0] = L_shr_sat( mem_fx[0], diff ); move32(); mem_fx[1] = L_shr_sat( mem_fx[1], diff ); move32(); mem_fx[2] = L_shr_sat( mem_fx[2], diff ); move32(); mem_fx[3] = L_shr_sat( mem_fx[3], diff ); #else mem_fx[0] = L_shr_o( mem_fx[0], diff, &Overflow ); move32(); mem_fx[1] = L_shr_o( mem_fx[1], diff, &Overflow ); Loading @@ -332,6 +401,7 @@ void hp20_fx_32( mem_fx[2] = L_shr_o( mem_fx[2], diff, &Overflow ); move32(); mem_fx[3] = L_shr_o( mem_fx[3], diff, &Overflow ); #endif move32(); mem_fx[4] = L_deposit_l( prescale_current_frame ); move32(); Loading
lib_com/hq2_bit_alloc_fx.c +13 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,13 @@ #include "prot_fx.h" #include "rom_com.h" #ifndef ISSUE_1836_FILEACTIVE_hq2_bit_alloc_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif #define MIN_BITS_FIX 0 /* QRk=18 */ #define HQ_16k40_BIT ( HQ_16k40 / 50 ) /* 16400/50=328 */ #define Qbf 14 /* Q value for bits_fact */ Loading Loading @@ -312,9 +319,11 @@ void hq2_bit_alloc_har_fx( Word16 exp_shift; #ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow; Overflow = 0; move32(); #endif L_THR1 = L_shl( L_deposit_l( THR1 ), SWB_BWE_LR_QRk ); L_THR2 = L_shl( L_deposit_l( THR2 ), SWB_BWE_LR_QRk ); Loading Loading @@ -570,9 +579,13 @@ void hq2_bit_alloc_har_fx( L_temp = Mult_32_16( L_Ravg_sub[GRP_SB - 1], sub( GRP_SB, 1 ) ); /* Qbe+0+1 */ L_temp = Mult_32_16( L_temp, Inv_norm_sum_fx ); /* Qbe+1+QIpb+1 */ #ifdef ISSUE_1836_replace_overflow_libcom lf_hf_ge_r_fx = round_fx_sat( L_shl_sat( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ) ) ); //??sat #else lf_hf_ge_r_fx = round_fx_o( L_shl_o( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ), &Overflow ), &Overflow ); Overflow = 0; /* reset BASOP Overflow */ move32(); #endif exp_normn = norm_s( norm_sum_fx ); exp_normn = sub( exp_normn, 1 ); Loading
lib_com/hq2_core_com_fx.c +27 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,13 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" #ifndef ISSUE_1836_FILEACTIVE_hq2_core_com_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*--------------------------------------------------------------------------* * mdct_spectrum_denorm() * Loading Loading @@ -88,9 +95,11 @@ void mdct_spectrum_denorm_fx( Word16 cond_fx; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); /* allow overflow happen. */ #endif #endif exp_safe = 4; /* safe bit for overflow */ Loading Loading @@ -163,8 +172,12 @@ void mdct_spectrum_denorm_fx( pd_fx = div_s( shl( npulses[k], exp_normn ), shl( band_width[k], exp_normd ) ); /* 15 + (exp_norm - exp_normd) */ Qpd = add( sub( exp_normn, exp_normd ), 15 ); #ifdef ISSUE_1836_replace_overflow_libcom cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ //??sat #else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ Overflow = 0; #endif move16(); /* allow overflow happen. */ IF( cond_fx < 0 ) { Loading Loading @@ -196,7 +209,11 @@ void mdct_spectrum_denorm_fx( /*gamma *= gain_tweak; */ L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */ exp_norm = norm_l( L_tmp ); #ifdef ISSUE_1836_replace_overflow_libcom gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); //??sat #else gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow ); #endif Qgamma = sub( add( add( Qgamma, Qtweak ), exp_norm ), 15 ); /*Qgamma+Qtweak+1+exp_norm-16; */ } Loading Loading @@ -260,9 +277,11 @@ void mdct_spectrum_denorm_ivas_fx( Word16 cond_fx; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); /* allow overflow happen. */ #endif #endif exp_safe = 4; /* safe bit for overflow */ Loading Loading @@ -335,8 +354,12 @@ void mdct_spectrum_denorm_ivas_fx( pd_fx = div_s( shl( npulses[k], exp_normn ), shl( band_width[k], exp_normd ) ); /* 15 + (exp_normn + exp_normd) */ Qpd = add( sub( exp_normn, exp_normd ), 15 ); #ifdef ISSUE_1836_replace_overflow_libcom cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ //??sat #else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ Overflow = 0; #endif move16(); /* allow overflow happen. */ IF( cond_fx < 0 ) { Loading Loading @@ -368,7 +391,11 @@ void mdct_spectrum_denorm_ivas_fx( /*gamma *= gain_tweak; */ L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */ exp_norm = norm_l( L_tmp ); #ifdef ISSUE_1836_replace_overflow_libcom gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); //??sat #else gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow ); #endif Qgamma = sub( add( add( Qgamma, Qtweak ), exp_norm ), 15 ); /*Qgamma+Qtweak+1+exp_norm-16; */ } Loading
lib_com/hq2_noise_inject_fx.c +55 −11 Original line number Diff line number Diff line Loading @@ -36,6 +36,12 @@ #include "oper_32b.h" #include "move.h" #ifndef ISSUE_1836_FILEACTIVE_hq2_noise_inject_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*--------------------------------------------------------------------------* * hq2_noise_inject() * Loading Loading @@ -80,9 +86,11 @@ void hq2_noise_inject_fx( Word16 i, j, k, ni_end_band, satur, count[BANDS_MAX], max_pos_pulse, pos; Word16 sb = bands; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif satur = 0; Loading @@ -90,7 +98,11 @@ void hq2_noise_inject_fx( FOR( i = 0; i < bands; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom Ep_fx[i] = L_shl_sat( Ep_fx[i], 6 ); /* Q-6 -> Q0 */ //??sat #else Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */ #endif move32(); } Loading Loading @@ -155,7 +167,11 @@ void hq2_noise_inject_fx( Q_env_fx[k] = sub( 31, exp2 ); move16(); tmp = sub( 17, Q_env_fx[k] ); #ifdef ISSUE_1836_replace_overflow_libcom env_fx2[k] = extract_h( L_shl_sat( env_fx[k], tmp ) ); /*Q1 */ //??sat #else env_fx2[k] = extract_h( L_shl_o( env_fx[k], tmp, &Overflow ) ); /*Q1 */ #endif peak_fx[k] = 0; move16(); count[k] = 0; Loading @@ -166,7 +182,11 @@ void hq2_noise_inject_fx( FOR( i = band_start[k]; i <= band_end[k]; i++ ) { L_tmp = L_mult0( y2hat_fx[i], y2hat_fx[i] ); /* Q0 */ #ifdef ISSUE_1836_replace_overflow_libcom Ep_fx[k] = L_sub_sat( Ep_fx[k], L_tmp ); //??sat #else Ep_fx[k] = L_sub_o( Ep_fx[k], L_tmp, &Overflow ); #endif move32(); /* Q0 */ IF( GT_16( abs_s( y2hat_fx[i] ), peak_fx[k] ) ) { Loading Loading @@ -387,7 +407,11 @@ void hq2_noise_inject_fx( ELSE IF( count[k - 1] == 0 && tmp4 > 0 ) { L_tmp = L_mult( env_fx2[k - 1], tmp ); /* Q(1+Q_speech+1 = Q_speech+2) */ #ifdef ISSUE_1836_replace_overflow_libcom fac_fx = extract_h( L_shl_sat( L_tmp, sub( 26, Q_speech ) ) ); /*Q12 */ #else fac_fx = extract_h( L_shl_o( L_tmp, sub( 26, Q_speech ), &Overflow ) ); /*Q12 */ #endif } } Loading Loading @@ -467,7 +491,11 @@ void hq2_noise_inject_fx( } L_tmp = Mult_32_16( Ep_fx[k], fac_fx ); /*Q(Q_Ep_fx[k]+12-15 = Q_Ep_fx[k]-3) */ #ifdef ISSUE_1836_replace_overflow_libcom ni_gain_fx[k] = L_shr_sat( L_tmp, sub( Q_Ep_fx[k], 20 ) ); //??sat #else ni_gain_fx[k] = L_shr_o( L_tmp, sub( Q_Ep_fx[k], 20 ), &Overflow ); #endif move32(); /*Q17 */ } ELSE Loading Loading @@ -589,14 +617,22 @@ void hq2_noise_inject_fx( L_tmp = Mult_32_16( Ep_fx[k], tmp ); /*Q(Q_Ep_fx[k]+28-Q_speech-15 = Q_Ep_fx[k]+13-Q_speech) */ tmp = sub( Q_Ep_fx[k], Q_speech ); tmp = sub( 15, tmp ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat #else tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ #endif } ELSE { tmp = 0x7fff; /*Q0 */ L_tmp = Mult_32_16( Ep_fx[k], tmp ); /*Q(Q_Ep_fx[k]+0-15 = Q_Ep_fx[k]-15) */ tmp = sub( 43, Q_Ep_fx[k] ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat #else tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ #endif } fac_fx = s_max( tmp, 4096 /* 1 in Q12 */ ); /*Q12 */ Loading @@ -608,7 +644,11 @@ void hq2_noise_inject_fx( IF( band_width[k] != 0 ) { Q_speech = norm_s( band_width[k] ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = shl_sat( band_width[k], Q_speech ); /*Q(Q_speech) */ //??sat #else tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ #endif tmp = div_s( 16384 /* 0.5 in Q15 */, tmp ); /*Q(15+14-Q_speech) */ } ELSE Loading @@ -621,7 +661,11 @@ void hq2_noise_inject_fx( tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */ L_tmp = L_mult( tmp1, j ); /*Q13 */ L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = extract_h( L_shl_sat( L_tmp, add( 1, Q_speech ) ) ); /*Q12 */ //??sat #else tmp = extract_h( L_shl_o( L_tmp, add( 1, Q_speech ), &Overflow ) ); /*Q12 */ #endif tmp = sub( fac_fx, tmp ); /*Q12 */ L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ L_y2[i] = L_add( L_y2[i], L_shr( Mult_32_16( L_tmp, rand_fx ), 2 ) ); Loading
lib_com/ifft_rel_fx.c +82 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,13 @@ #include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" #ifndef ISSUE_1836_FILEACTIVE_ifft_rel_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*-----------------------------------------------------------------* * Local constants *-----------------------------------------------------------------*/ Loading Loading @@ -77,10 +84,12 @@ void ifft_rel_fx( Word16 cc1, cc3, ss1, ss3; Word16 tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif /*-----------------------------------------------------------------* Loading Loading @@ -108,6 +117,17 @@ void ifft_rel_fx( FOR( i = is; i < n; i += id ) { #ifdef ISSUE_1836_replace_overflow_libcom t1 = sub_sat( *xi1, *xi3 ); /*Qx*/ //??sat *xi1 = add_sat( *xi1, *xi3 ); /*Qx*/ //??sat move16(); *xi2 = shl_sat( *xi2, 1 ); /*Qx*/ //??sat move16(); *xi3 = sub_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/ //??sat move16(); *xi4 = add_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/ //??sat move16(); #else t1 = sub_o( *xi1, *xi3, &Overflow ); /*Qx*/ *xi1 = add_o( *xi1, *xi3, &Overflow ); /*Qx*/ move16(); Loading @@ -117,9 +137,23 @@ void ifft_rel_fx( move16(); *xi4 = add_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/ move16(); #endif IF( NE_16( n4, 1 ) ) { #ifdef ISSUE_1836_replace_overflow_libcom t1 = mult_r( sub_sat( *( xi2 + n8 ), *( xi1 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ //??sat t2 = mult_r( add_sat( *( xi4 + n8 ), *( xi3 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ //??sat *( xi1 + n8 ) = add_sat( *( xi1 + n8 ), *( xi2 + n8 ) ); /*Qx*/ //??sat move16(); *( xi2 + n8 ) = sub_sat( *( xi4 + n8 ), *( xi3 + n8 ) ); /*Qx*/ //??sat move16(); *( xi3 + n8 ) = negate( shl_sat( add_sat( t2, t1 ), 1 ) ); /*Qx*/ //??sat move16(); *( xi4 + n8 ) = shl_sat( sub_sat( t1, t2 ), 1 ); /*Qx*/ //??sat move16(); #else t1 = mult_r( sub_o( *( xi2 + n8 ), *( xi1 + n8 ), &Overflow ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ t2 = mult_r( add_o( *( xi4 + n8 ), *( xi3 + n8 ), &Overflow ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ Loading @@ -131,6 +165,7 @@ void ifft_rel_fx( move16(); *( xi4 + n8 ) = shl_o( sub_o( t1, t2, &Overflow ), 1, &Overflow ); /*Qx*/ move16(); #endif } xi1 += id; xi2 += id; Loading Loading @@ -178,6 +213,45 @@ void ifft_rel_fx( FOR( i = is; i < n; i += id ) { #ifdef ISSUE_1836_replace_overflow_libcom t1 = sub_sat( *xup1, *xdn6 ); /*Qx*/ //??sat *xup1 = add_sat( *xup1, *xdn6 ); /*Qx*/ //??sat move16(); xup1 += n4; xdn6 -= n4; t2 = sub_sat( *xdn6, *xup1 ); /*Qx*/ //??sat *xdn6 = add_sat( *xup1, *xdn6 ); /*Qx*/ //??sat move16(); xdn6 += n4; t3 = add_sat( *xdn8, *xup3 ); /*Qx*/ //??sat *xdn6 = sub_sat( *xdn8, *xup3 ); /*Qx*/ //??sat move16(); xup3 += n4; xdn8 -= n4; t4 = add_sat( *xup3, *xdn8 ); /*Qx*/ //??sat *xup1 = sub_sat( *xup3, *xdn8 ); /*Qx*/ //??sat move16(); t5 = sub_sat( t1, t4 ); /*Qx*/ //??sat t1 = add_sat( t1, t4 ); /*Qx*/ //??sat t4 = sub_sat( t2, t3 ); /*Qx*/ //??sat t2 = add_sat( t2, t3 ); /*Qx*/ //??sat *xup3 = sub_sat( mult_r( t1, cc3 ), mult_r( t2, ss3 ) ); /*Qx*/ //??sat move16(); xup3 -= n4; *xup3 = add_sat( mult_r( t5, cc1 ), mult_r( t4, ss1 ) ); /*Qx*/ //??sat move16(); *xdn8 = sub_sat( mult_r( t5, ss1 ), mult_r( t4, cc1 ) ); /*Qx*/ //??sat move16(); xdn8 += n4; *xdn8 = add_sat( mult_r( t2, cc3 ), mult_r( t1, ss3 ) ); /*Qx*/ //??sat move16(); #else t1 = sub_o( *xup1, *xdn6, &Overflow ); /*Qx*/ *xup1 = add_o( *xup1, *xdn6, &Overflow ); /*Qx*/ move16(); Loading Loading @@ -215,6 +289,7 @@ void ifft_rel_fx( xdn8 += n4; *xdn8 = add_o( mult_r( t2, cc3 ), mult_r( t1, ss3 ), &Overflow ); /*Qx*/ move16(); #endif xup1 -= n4; xup1 += id; Loading Loading @@ -245,10 +320,17 @@ void ifft_rel_fx( { r1 = *xi0; move16(); #ifdef ISSUE_1836_replace_overflow_libcom *xi0 = add_sat( r1, *xi1 ); /*Qx*/ //??sat move16(); *xi1 = sub_sat( r1, *xi1 ); /*Qx*/ //??sat move16(); #else *xi0 = add_o( r1, *xi1, &Overflow ); /*Qx*/ move16(); *xi1 = sub_o( r1, *xi1, &Overflow ); /*Qx*/ move16(); #endif xi0 += id; xi1 += id; } Loading