Loading lib_com/cldfb.c +32 −8 Original line number Diff line number Diff line Loading @@ -901,7 +901,7 @@ void cldfbAnalysis_ts_fx_fixed_q( const Word16 *ptr_pf_fx; Word16 ptr_pf_sf; Word32 *timeBuffer_fx, buffer_fx[( CLDFB_NO_CHANNELS_MAX * CLDFB_NO_COL_MAX ) + ( 9 * CLDFB_NO_CHANNELS_MAX )]; Word16 offset, frameSize; Word16 offset, frameSize, gb, hr, shift; offset = sub( h_cldfb->p_filter_length, h_cldfb->no_channels ); frameSize = i_mult( h_cldfb->no_channels, h_cldfb->no_col ); Loading Loading @@ -1071,10 +1071,33 @@ void cldfbAnalysis_ts_fx_fixed_q( *q_cldfb = sub( *q_cldfb, 2 ); move16(); gb = find_guarded_bits_fx( M1 ); hr = L_norm_arr( iBuffer_fx, M1 ); IF( LT_16( hr, gb ) ) { scale_sig32( iBuffer_fx, M1, sub( hr, gb ) ); } /* FFT of DCT IV */ fft_cldfb_fx( iBuffer_fx, M2 ); /* post modulation of DCT IV */ IF( LT_16( hr, gb ) ) { shift = sub( gb, hr ); FOR( k = 0; k < M2; k++ ) { /* do it inplace */ /*cplxMult(&imagBuffer[2*k],&imagBuffer[M1-1-(2*k)],iBuffer[2*k],iBuffer[2*k+1],rot_vctr_re[k],rot_vctr_im[k]);*/ imagBuffer_fx[2 * k] = L_shl( Msub_32_32( Mpy_32_32( iBuffer_fx[2 * k], rot_vctr_re_fx[k] ), iBuffer_fx[2 * k + 1], rot_vctr_im_fx[k] ), shift ); // q - 5 imagBuffer_fx[( M1 - 1 ) - ( k * 2 )] = L_shl( Madd_32_32( Mpy_32_32( iBuffer_fx[2 * k], rot_vctr_im_fx[k] ), iBuffer_fx[2 * k + 1], rot_vctr_re_fx[k] ), shift ); // q - 5 move32(); move32(); } } ELSE { FOR( k = 0; k < M2; k++ ) { /* do it inplace */ Loading @@ -1084,6 +1107,7 @@ void cldfbAnalysis_ts_fx_fixed_q( move32(); move32(); } } IF( EQ_32( h_cldfb->prototype, CLDFB_PROTOTYPE_5_00MS ) ) { Loading lib_com/gs_preech_fx.c +15 −27 Original line number Diff line number Diff line Loading @@ -177,9 +177,10 @@ void pre_echo_att_ivas_fx( move16(); Word16 ratio_fx; Word16 attack_pos_fx, i; Word32 L_tmp, L_tmp1; Word16 tmp, n1, n2, exp, frac1, frac2; Word32 L_tmp; Word16 tmp, tmp_e; Word32 etmp1_fx; Word16 etmp_e; Word16 att_len; test(); Loading Loading @@ -220,32 +221,19 @@ void pre_echo_att_ivas_fx( IF( GT_32( etmp_fx, *Last_frame_ener_fx ) && attack_pos_fx > 0 ) { /* Find the average energy before the attack */ L_tmp = sum32_fx( finc_fx, attack_pos_fx ); /*Q1 */ L_tmp1 = L_shr( L_mult( attack_pos_fx, attack_pos_fx ), 1 ); /*Q0 */ tmp = round_fx( Isqrt( L_tmp1 ) ); /*Q15 */ L_tmp = L_shr( L_tmp, 2 ); /*Q1 ; ATT_SEG_LEN=4 */ etmp_fx = Mult_32_16( L_tmp, tmp ); /*Q1 */ etmp_fx = sum32_fx( finc_fx, attack_pos_fx ); etmp_e = sub( 31, add( shl( Q_new, 1 ), 1 ) ); etmp_fx = L_add( etmp_fx, L_shr( 21474836 /*0.01 in Q31*/, etmp_e ) ); /* etmp = etmp + 0.01; (exp = etmp_e) */ etmp_fx = L_deposit_h( BASOP_Util_Divide3232_Scale( etmp_fx, L_mult0( attack_pos_fx, ATT_SEG_LEN ), &tmp_e ) ); tmp_e = add( tmp_e, sub( etmp_e, 31 ) ); etmp_e = tmp_e; move16(); etmp_fx = L_shr( etmp_fx, add( 1 - 4, shl( Q_new, 1 ) ) ); /* makes etmp i nQ4 as *Last_frame_ener_fx */ /* Find the correction factor and apply it before the attack */ /* ratio = (float)sqrt(*Last_frame_ener/etmp);*/ /* = isqrt(etmp/(*Last_frame_ener)) */ etmp_fx = L_max( etmp_fx, 1 ); *Last_frame_ener_fx = L_max( *Last_frame_ener_fx, 1 ); move32(); n1 = norm_l( etmp_fx ); n2 = norm_l( *Last_frame_ener_fx ); n1 = sub( n1, 1 ); exp = sub( n1, n2 ); frac1 = round_fx( L_shl( etmp_fx, n1 ) ); frac2 = round_fx_sat( L_shl_sat( *Last_frame_ener_fx, n2 ) ); L_tmp = L_mult0( 128, div_s( frac1, frac2 ) ); /* s = gain_out / gain_in */ L_tmp = L_shr( L_tmp, exp ); /* add exponent */ L_tmp = Isqrt( L_tmp ); ratio_fx = round_fx( L_shl( L_tmp, 9 ) ); tmp = BASOP_Util_Divide3232_Scale( *Last_frame_ener_fx, etmp_fx, &tmp_e ); /* numerator Q = 2 * Q_new + 1; denominator Q = 31 - tmp_e */ tmp_e = add( tmp_e, sub( sub( 31, etmp_e ), add( shl( Q_new, 1 ), 1 ) ) ); /* tmp_e = tmp_e + (31 - tmp_e) - (2 * Q_new + 1) */ tmp = Sqrt16( tmp, &tmp_e ); ratio_fx = shr( tmp, sub( 2, tmp_e ) ); /* Q13 */ /* Pre-echo atttenuation should never increase the energy */ ratio_fx = s_min( ratio_fx, 8192 /* 1 in Q13 */ ); /* Q13 */ Loading lib_com/ivas_dirac_com_fx.c +1 −1 Original line number Diff line number Diff line Loading @@ -1034,7 +1034,7 @@ void computeDiffuseness_fixed( exp1 = sub( 31, q_intensity_slow ); tmp = Sqrt32( p_tmp[i], &exp1 ); tmp = BASOP_Util_Divide3232_Scale_cadence( tmp, L_add( energy_slow[i], EPSILLON_FX ), &exp2 ); tmp = BASOP_Util_Divide3232_Scale_newton( tmp, L_add( energy_slow[i], EPSILLON_FX ), &exp2 ); q_tmp = add( sub( 31, exp2 ), sub( sub( 31, exp1 ), q_ene ) ); IF( LT_16( q_tmp, Q30 ) ) Loading lib_com/ivas_qspherical_com_fx.c +3 −3 Original line number Diff line number Diff line Loading @@ -314,9 +314,9 @@ Word16 quantize_phi_enc_fx( Word32 temp_res; Word16 temp_e; delta_phi_fx = BASOP_Util_Divide3232_Scale_cadence( 360, n, &temp_e ); delta_phi_fx = BASOP_Util_Divide3232_Scale_newton( 360, n, &temp_e ); delta_phi_fx = L_shl( delta_phi_fx, sub( temp_e, 9 ) ); inv_delta_phi_fx = BASOP_Util_Divide3232_Scale_cadence( n, 360, &temp_e ); inv_delta_phi_fx = BASOP_Util_Divide3232_Scale_newton( n, 360, &temp_e ); IF( EQ_16( n, 1 ) ) { Loading Loading @@ -661,7 +661,7 @@ Word16 quantize_phi_chan_compand_fx( /* quantize companded value */ // delta_phi = 360.0f / (float) n; delta_phi = BASOP_Util_Divide3232_Scale_cadence( 360, n, &tmp_e ); delta_phi = BASOP_Util_Divide3232_Scale_newton( 360, n, &tmp_e ); delta_phi = L_shr( delta_phi, sub( 9, tmp_e ) ); // Q22 // id_phi = (int16_t) round_f( ( phi / (float) delta_phi ) ); id_phi = BASOP_Util_Divide3232_Scale( phi, delta_phi, &tmp_e ); // Q15 Loading lib_com/ivas_sns_com_fx.c +10 −3 Original line number Diff line number Diff line Loading @@ -202,7 +202,14 @@ void sns_compute_scf_fx( -Q6 is for division with FDNS_NPTS and -Q1 is to reduce Q by one */ mean = W_shl_sat_l( sum, -Q7 ); // q_out nf = Mpy_32_32( mean, 214748 /* powf( 10.0f, -4.0f ) in Q31 */ ); // q_out nf = L_max( nf, L_shl( 256, sub( q_out, 40 ) ) /* powf( 2.0f, -32.0f ) in Q40 */ ); // q_out IF( LE_32( nf, L_shl_sat( 256, sub( q_out, 40 ) ) ) ) /* powf( 2.0f, -32.0f ) in Q40 */ { nf = 256; move32(); q_out = 40; move16(); } FOR( i = 0; i < FDNS_NPTS; i++ ) { Loading Loading
lib_com/cldfb.c +32 −8 Original line number Diff line number Diff line Loading @@ -901,7 +901,7 @@ void cldfbAnalysis_ts_fx_fixed_q( const Word16 *ptr_pf_fx; Word16 ptr_pf_sf; Word32 *timeBuffer_fx, buffer_fx[( CLDFB_NO_CHANNELS_MAX * CLDFB_NO_COL_MAX ) + ( 9 * CLDFB_NO_CHANNELS_MAX )]; Word16 offset, frameSize; Word16 offset, frameSize, gb, hr, shift; offset = sub( h_cldfb->p_filter_length, h_cldfb->no_channels ); frameSize = i_mult( h_cldfb->no_channels, h_cldfb->no_col ); Loading Loading @@ -1071,10 +1071,33 @@ void cldfbAnalysis_ts_fx_fixed_q( *q_cldfb = sub( *q_cldfb, 2 ); move16(); gb = find_guarded_bits_fx( M1 ); hr = L_norm_arr( iBuffer_fx, M1 ); IF( LT_16( hr, gb ) ) { scale_sig32( iBuffer_fx, M1, sub( hr, gb ) ); } /* FFT of DCT IV */ fft_cldfb_fx( iBuffer_fx, M2 ); /* post modulation of DCT IV */ IF( LT_16( hr, gb ) ) { shift = sub( gb, hr ); FOR( k = 0; k < M2; k++ ) { /* do it inplace */ /*cplxMult(&imagBuffer[2*k],&imagBuffer[M1-1-(2*k)],iBuffer[2*k],iBuffer[2*k+1],rot_vctr_re[k],rot_vctr_im[k]);*/ imagBuffer_fx[2 * k] = L_shl( Msub_32_32( Mpy_32_32( iBuffer_fx[2 * k], rot_vctr_re_fx[k] ), iBuffer_fx[2 * k + 1], rot_vctr_im_fx[k] ), shift ); // q - 5 imagBuffer_fx[( M1 - 1 ) - ( k * 2 )] = L_shl( Madd_32_32( Mpy_32_32( iBuffer_fx[2 * k], rot_vctr_im_fx[k] ), iBuffer_fx[2 * k + 1], rot_vctr_re_fx[k] ), shift ); // q - 5 move32(); move32(); } } ELSE { FOR( k = 0; k < M2; k++ ) { /* do it inplace */ Loading @@ -1084,6 +1107,7 @@ void cldfbAnalysis_ts_fx_fixed_q( move32(); move32(); } } IF( EQ_32( h_cldfb->prototype, CLDFB_PROTOTYPE_5_00MS ) ) { Loading
lib_com/gs_preech_fx.c +15 −27 Original line number Diff line number Diff line Loading @@ -177,9 +177,10 @@ void pre_echo_att_ivas_fx( move16(); Word16 ratio_fx; Word16 attack_pos_fx, i; Word32 L_tmp, L_tmp1; Word16 tmp, n1, n2, exp, frac1, frac2; Word32 L_tmp; Word16 tmp, tmp_e; Word32 etmp1_fx; Word16 etmp_e; Word16 att_len; test(); Loading Loading @@ -220,32 +221,19 @@ void pre_echo_att_ivas_fx( IF( GT_32( etmp_fx, *Last_frame_ener_fx ) && attack_pos_fx > 0 ) { /* Find the average energy before the attack */ L_tmp = sum32_fx( finc_fx, attack_pos_fx ); /*Q1 */ L_tmp1 = L_shr( L_mult( attack_pos_fx, attack_pos_fx ), 1 ); /*Q0 */ tmp = round_fx( Isqrt( L_tmp1 ) ); /*Q15 */ L_tmp = L_shr( L_tmp, 2 ); /*Q1 ; ATT_SEG_LEN=4 */ etmp_fx = Mult_32_16( L_tmp, tmp ); /*Q1 */ etmp_fx = sum32_fx( finc_fx, attack_pos_fx ); etmp_e = sub( 31, add( shl( Q_new, 1 ), 1 ) ); etmp_fx = L_add( etmp_fx, L_shr( 21474836 /*0.01 in Q31*/, etmp_e ) ); /* etmp = etmp + 0.01; (exp = etmp_e) */ etmp_fx = L_deposit_h( BASOP_Util_Divide3232_Scale( etmp_fx, L_mult0( attack_pos_fx, ATT_SEG_LEN ), &tmp_e ) ); tmp_e = add( tmp_e, sub( etmp_e, 31 ) ); etmp_e = tmp_e; move16(); etmp_fx = L_shr( etmp_fx, add( 1 - 4, shl( Q_new, 1 ) ) ); /* makes etmp i nQ4 as *Last_frame_ener_fx */ /* Find the correction factor and apply it before the attack */ /* ratio = (float)sqrt(*Last_frame_ener/etmp);*/ /* = isqrt(etmp/(*Last_frame_ener)) */ etmp_fx = L_max( etmp_fx, 1 ); *Last_frame_ener_fx = L_max( *Last_frame_ener_fx, 1 ); move32(); n1 = norm_l( etmp_fx ); n2 = norm_l( *Last_frame_ener_fx ); n1 = sub( n1, 1 ); exp = sub( n1, n2 ); frac1 = round_fx( L_shl( etmp_fx, n1 ) ); frac2 = round_fx_sat( L_shl_sat( *Last_frame_ener_fx, n2 ) ); L_tmp = L_mult0( 128, div_s( frac1, frac2 ) ); /* s = gain_out / gain_in */ L_tmp = L_shr( L_tmp, exp ); /* add exponent */ L_tmp = Isqrt( L_tmp ); ratio_fx = round_fx( L_shl( L_tmp, 9 ) ); tmp = BASOP_Util_Divide3232_Scale( *Last_frame_ener_fx, etmp_fx, &tmp_e ); /* numerator Q = 2 * Q_new + 1; denominator Q = 31 - tmp_e */ tmp_e = add( tmp_e, sub( sub( 31, etmp_e ), add( shl( Q_new, 1 ), 1 ) ) ); /* tmp_e = tmp_e + (31 - tmp_e) - (2 * Q_new + 1) */ tmp = Sqrt16( tmp, &tmp_e ); ratio_fx = shr( tmp, sub( 2, tmp_e ) ); /* Q13 */ /* Pre-echo atttenuation should never increase the energy */ ratio_fx = s_min( ratio_fx, 8192 /* 1 in Q13 */ ); /* Q13 */ Loading
lib_com/ivas_dirac_com_fx.c +1 −1 Original line number Diff line number Diff line Loading @@ -1034,7 +1034,7 @@ void computeDiffuseness_fixed( exp1 = sub( 31, q_intensity_slow ); tmp = Sqrt32( p_tmp[i], &exp1 ); tmp = BASOP_Util_Divide3232_Scale_cadence( tmp, L_add( energy_slow[i], EPSILLON_FX ), &exp2 ); tmp = BASOP_Util_Divide3232_Scale_newton( tmp, L_add( energy_slow[i], EPSILLON_FX ), &exp2 ); q_tmp = add( sub( 31, exp2 ), sub( sub( 31, exp1 ), q_ene ) ); IF( LT_16( q_tmp, Q30 ) ) Loading
lib_com/ivas_qspherical_com_fx.c +3 −3 Original line number Diff line number Diff line Loading @@ -314,9 +314,9 @@ Word16 quantize_phi_enc_fx( Word32 temp_res; Word16 temp_e; delta_phi_fx = BASOP_Util_Divide3232_Scale_cadence( 360, n, &temp_e ); delta_phi_fx = BASOP_Util_Divide3232_Scale_newton( 360, n, &temp_e ); delta_phi_fx = L_shl( delta_phi_fx, sub( temp_e, 9 ) ); inv_delta_phi_fx = BASOP_Util_Divide3232_Scale_cadence( n, 360, &temp_e ); inv_delta_phi_fx = BASOP_Util_Divide3232_Scale_newton( n, 360, &temp_e ); IF( EQ_16( n, 1 ) ) { Loading Loading @@ -661,7 +661,7 @@ Word16 quantize_phi_chan_compand_fx( /* quantize companded value */ // delta_phi = 360.0f / (float) n; delta_phi = BASOP_Util_Divide3232_Scale_cadence( 360, n, &tmp_e ); delta_phi = BASOP_Util_Divide3232_Scale_newton( 360, n, &tmp_e ); delta_phi = L_shr( delta_phi, sub( 9, tmp_e ) ); // Q22 // id_phi = (int16_t) round_f( ( phi / (float) delta_phi ) ); id_phi = BASOP_Util_Divide3232_Scale( phi, delta_phi, &tmp_e ); // Q15 Loading
lib_com/ivas_sns_com_fx.c +10 −3 Original line number Diff line number Diff line Loading @@ -202,7 +202,14 @@ void sns_compute_scf_fx( -Q6 is for division with FDNS_NPTS and -Q1 is to reduce Q by one */ mean = W_shl_sat_l( sum, -Q7 ); // q_out nf = Mpy_32_32( mean, 214748 /* powf( 10.0f, -4.0f ) in Q31 */ ); // q_out nf = L_max( nf, L_shl( 256, sub( q_out, 40 ) ) /* powf( 2.0f, -32.0f ) in Q40 */ ); // q_out IF( LE_32( nf, L_shl_sat( 256, sub( q_out, 40 ) ) ) ) /* powf( 2.0f, -32.0f ) in Q40 */ { nf = 256; move32(); q_out = 40; move16(); } FOR( i = 0; i < FDNS_NPTS; i++ ) { Loading