Loading lib_enc/ivas_stat_enc.h +2 −2 Original line number Diff line number Diff line Loading @@ -1179,7 +1179,7 @@ typedef struct stereo_dmx_evs_correlation_filter_structure { Word16 init_frmCntr; #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word32 isd_rate_s_fx; // Q31 #else Word16 isd_rate_s_fx; // Q15 Loading Loading @@ -1224,7 +1224,7 @@ typedef struct stereo_dmx_evs_enc_data_structure STEREO_DMX_EVS_POC_HANDLE hPOC; STEREO_DMX_EVS_PHA_HANDLE hPHA; #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx; // Q0 #else Word32 itd_fx; // Q16 Loading lib_enc/ivas_stereo_dmx_evs_fx.c +41 −21 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ #define STEREO_DMX_EVS_ISD_THRES_L_Q31 1932735283 #define STEREO_DMX_EVS_ISD_DIST_THRES_IPD_Q15 ONE_IN_Q14 #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA #define STEREO_DMX_EVS_ISD_FORGETTING_Q31 2040109465 #define STEREO_DMX_EVS_ISD_1MFORGETTING_Q15 1638 #define STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 773094113 Loading Loading @@ -161,7 +161,7 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd[], /* o : estimated itd Q0 */ #else Word32 itd[], /* o : estimated itd Q16 */ Loading Loading @@ -208,7 +208,7 @@ static void create_M_signal_fx( ); static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx[], /* o : estimated itd */ #else Word32 itd_fx[], /* o : estimated itd */ Loading Loading @@ -621,7 +621,7 @@ static void calc_poc_fx( Dr = L_add( specLr[i], specRr[i] ); // spec_e Di = L_add( specLi[i], specRi[i] ); // spec_e // if ( ( Nr * Nr + Ni * Ni ) > STEREO_DMX_EVS_ISD_THRES_H * ( Dr * Dr + Di * Di ) ) #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), STEREO_DMX_EVS_ISD_INVTHRES_H ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) #else IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), 1270700383 /*1/STEREO_DMX_EVS_ISD_THRES_H in Q31*/ ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) Loading @@ -629,7 +629,7 @@ static void calc_poc_fx( { isd_cnt_h = add( isd_cnt_h, 1 ); } #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA W_tmp = W_add( W_mult0_32_32( Mpy_32_32_r( Dr, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Dr ), W_mult0_32_32( Mpy_32_32_r( Di, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Di ) ); // Q62 IF( LT_64( W_add( W_mult0_32_32( Nr, Nr ), W_mult0_32_32( Ni, Ni ) ), W_tmp ) ) // Q62 #else Loading @@ -643,7 +643,7 @@ static void calc_poc_fx( isd_rate = BASOP_Util_Divide1616_Scale( isd_cnt_h, freq_8k, &isd_rate_e ); // Saturation to handle values close to 1.0f isd_rate = shl_sat( isd_rate, isd_rate_e ); // Q15 #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->isd_rate_s_fx = L_add( Mpy_32_32_r( STEREO_DMX_EVS_ISD_FORGETTING_Q31, hPHA->isd_rate_s_fx ), L_mult( STEREO_DMX_EVS_ISD_1MFORGETTING_Q15, isd_rate ) ); move32(); #else Loading @@ -651,7 +651,7 @@ static void calc_poc_fx( move16(); #endif #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q31 ) ) #else IF( GT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q15 ) ) Loading Loading @@ -680,7 +680,7 @@ static void calc_poc_fx( hPHA->prev_pha = STEREO_DMX_EVS_PHA_IPD; move32(); } #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA ELSE IF( LT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 ) ) #else ELSE IF( LT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q15 ) ) Loading Loading @@ -752,7 +752,7 @@ static void calc_poc_fx( /* Energy */ #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA // Left W_tmp = W_add( W_mult0_32_32( specLr[i], specLr[i] ), W_mult0_32_32( specLi[i], specLi[i] ) ); // Q(62-(2*specL_e)) -> Q(63 - ((2*specL_e) +1)) Loading Loading @@ -817,7 +817,7 @@ static void calc_poc_fx( tIPDr = L_sub( Mpy_32_32_r( specRr[i], IPDr ), Mpy_32_32_r( specRi[i], IPDi ) ); // spec_e tIPDi = L_add( Mpy_32_32_r( specRr[i], IPDi ), Mpy_32_32_r( specRi[i], IPDr ) ); // spec_e #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Nr = BASOP_Util_Add_Mant32Exp( Nr, Nr_e, L_add( Mpy_32_32_r( specLr[i], tIPDr ), Mpy_32_32_r( specLi[i], tIPDi ) ), 0, &Nr_e ); Ni = BASOP_Util_Add_Mant32Exp( Ni, Ni_e, L_sub( Mpy_32_32_r( specLi[i], tIPDr ), Mpy_32_32_r( specLr[i], tIPDi ) ), 0, &Ni_e ); Loading Loading @@ -865,7 +865,7 @@ static void calc_poc_fx( move32(); // Pn = (float) inv_sqrt( ( Pr[n] * Pr[n] + Pi[n] * Pi[n] ) + EPSILON ); #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Pn = L_add( L_shr( Mpy_32_32_r( Pr[n], Pr[n] ), 1 ), L_shr( Mpy_32_32_r( Pi[n], Pi[n] ), 1 ) ); Pn = BASOP_Util_Add_Mant32Exp( Pn, 1, EPSILON_FX_M, EPSILON_FX_E, &Pn_e ); Pn = Isqrt_lc( Pn, &Pn_e ); Loading Loading @@ -1084,16 +1084,17 @@ static void calc_poc_fx( FOR( i = 0; i < hPHA->pha_len; i++ ) { // hPHA->p_curr_taps[n][i] *= hPHA->win[i]; #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 #else #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef FIX_ISSUE_1153 hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 #else hPHA->p_curr_taps_fx[n][i] = L_shl( Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ), 1 ); // Q31 #endif #endif #endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA move32(); } Loading @@ -1101,16 +1102,35 @@ static void calc_poc_fx( move32(); energy_e = 0; move16(); #ifndef NONBE_FIX_1386_STEREO_DMX_EVS_PHA #ifdef FIX_ISSUE_1153 Word16 shift = L_norm_arr( hPHA->p_curr_taps_fx[n], hPHA->pha_len ); IF( shift ) { scale_sig32( hPHA->p_curr_taps_fx[n], hPHA->pha_len, 1 ); shift = 1; move16(); } #endif #endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA FOR( i = 0; i < hPHA->pha_len; i++ ) { #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), 0, &energy_e ); #else #ifdef FIX_ISSUE_1153 energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), shl( sub( 1, shift ), 1 ), &energy_e ); #else energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), 0, &energy_e ); #endif #endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA } // energy = (float) inv_sqrt( energy + EPSILON ); energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, EPSILON_FX_M, EPSILON_FX_E, &energy_e ); energy = ISqrt32( energy, &energy_e ); FOR( i = 0; i < hPHA->pha_len; i++ ) { #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), sub( energy_e, 1 ) ); // Q30 #else hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), energy_e ); // Q31 Loading Loading @@ -1217,7 +1237,7 @@ static void calc_poc_fx( *-------------------------------------------------------------------*/ static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx[], /* o : estimated itd Q0 */ #else Word32 itd_fx[], /* o : estimated itd Q16 */ Loading Loading @@ -1533,7 +1553,7 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd[], /* o : estimated itd Q0 */ #else Word32 itd[], /* o : estimated itd Q16 */ Loading Loading @@ -2078,7 +2098,7 @@ void stereo_dmx_evs_enc_fx( // ftmp += p_data_mem[n - m] * p_prev_taps[m]; fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_prev_taps[m] ) ); // Q25 } #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA fx_tmp = L_shl( fx_tmp, 1 ); // Q26 #endif mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); Loading @@ -2105,7 +2125,7 @@ void stereo_dmx_evs_enc_fx( // ftmp += p_data_mem[n - m] * p_curr_taps[m]; fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_curr_taps[m] ) ); // Q25 } #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA fx_tmp = L_shl( fx_tmp, 1 ); // Q26 #endif // dmx_pha_data[n] += ftmp * INV_SQRT_2; Loading Loading @@ -2137,7 +2157,7 @@ void stereo_dmx_evs_enc_fx( curr_prc = hStereoDmxEVS->hPHA->curr_prc; move32(); // if ( abs( (int16_t) hStereoDmxEVS->itd ) > hStereoDmxEVS->hPHA->prc_thres ) #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_16( abs_s( hStereoDmxEVS->itd_fx ), hStereoDmxEVS->hPHA->prc_thres ) ) #else IF( GT_16( abs_s( round_fx( hStereoDmxEVS->itd_fx ) ), hStereoDmxEVS->hPHA->prc_thres ) ) Loading Loading @@ -2264,7 +2284,7 @@ ivas_error stereo_dmx_evs_init_encoder_fx( STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS; Word16 n, input_frame; #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 m, len, pha_len, fad_len, fad_len2, rfft_ipd_coef_step, n0, input_frame_pha; Word32 *fad_g, fad_r, *ipd_ff; Word16 *win; Loading Loading @@ -2504,7 +2524,7 @@ ivas_error stereo_dmx_evs_init_encoder_fx( fad_len = hStereoDmxEVS->hPHA->fad_len; move16(); #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA set16_fx( hStereoDmxEVS->hPHA->win_fx, 29491 /*1.8f in Q14*/, pha_len ); hStereoDmxEVS->hPHA->win_fx[0] = ONE_IN_Q14; move16(); Loading Loading
lib_enc/ivas_stat_enc.h +2 −2 Original line number Diff line number Diff line Loading @@ -1179,7 +1179,7 @@ typedef struct stereo_dmx_evs_correlation_filter_structure { Word16 init_frmCntr; #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word32 isd_rate_s_fx; // Q31 #else Word16 isd_rate_s_fx; // Q15 Loading Loading @@ -1224,7 +1224,7 @@ typedef struct stereo_dmx_evs_enc_data_structure STEREO_DMX_EVS_POC_HANDLE hPOC; STEREO_DMX_EVS_PHA_HANDLE hPHA; #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx; // Q0 #else Word32 itd_fx; // Q16 Loading
lib_enc/ivas_stereo_dmx_evs_fx.c +41 −21 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ #define STEREO_DMX_EVS_ISD_THRES_L_Q31 1932735283 #define STEREO_DMX_EVS_ISD_DIST_THRES_IPD_Q15 ONE_IN_Q14 #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA #define STEREO_DMX_EVS_ISD_FORGETTING_Q31 2040109465 #define STEREO_DMX_EVS_ISD_1MFORGETTING_Q15 1638 #define STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 773094113 Loading Loading @@ -161,7 +161,7 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd[], /* o : estimated itd Q0 */ #else Word32 itd[], /* o : estimated itd Q16 */ Loading Loading @@ -208,7 +208,7 @@ static void create_M_signal_fx( ); static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx[], /* o : estimated itd */ #else Word32 itd_fx[], /* o : estimated itd */ Loading Loading @@ -621,7 +621,7 @@ static void calc_poc_fx( Dr = L_add( specLr[i], specRr[i] ); // spec_e Di = L_add( specLi[i], specRi[i] ); // spec_e // if ( ( Nr * Nr + Ni * Ni ) > STEREO_DMX_EVS_ISD_THRES_H * ( Dr * Dr + Di * Di ) ) #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), STEREO_DMX_EVS_ISD_INVTHRES_H ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) #else IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), 1270700383 /*1/STEREO_DMX_EVS_ISD_THRES_H in Q31*/ ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) Loading @@ -629,7 +629,7 @@ static void calc_poc_fx( { isd_cnt_h = add( isd_cnt_h, 1 ); } #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA W_tmp = W_add( W_mult0_32_32( Mpy_32_32_r( Dr, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Dr ), W_mult0_32_32( Mpy_32_32_r( Di, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Di ) ); // Q62 IF( LT_64( W_add( W_mult0_32_32( Nr, Nr ), W_mult0_32_32( Ni, Ni ) ), W_tmp ) ) // Q62 #else Loading @@ -643,7 +643,7 @@ static void calc_poc_fx( isd_rate = BASOP_Util_Divide1616_Scale( isd_cnt_h, freq_8k, &isd_rate_e ); // Saturation to handle values close to 1.0f isd_rate = shl_sat( isd_rate, isd_rate_e ); // Q15 #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->isd_rate_s_fx = L_add( Mpy_32_32_r( STEREO_DMX_EVS_ISD_FORGETTING_Q31, hPHA->isd_rate_s_fx ), L_mult( STEREO_DMX_EVS_ISD_1MFORGETTING_Q15, isd_rate ) ); move32(); #else Loading @@ -651,7 +651,7 @@ static void calc_poc_fx( move16(); #endif #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q31 ) ) #else IF( GT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q15 ) ) Loading Loading @@ -680,7 +680,7 @@ static void calc_poc_fx( hPHA->prev_pha = STEREO_DMX_EVS_PHA_IPD; move32(); } #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA ELSE IF( LT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 ) ) #else ELSE IF( LT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q15 ) ) Loading Loading @@ -752,7 +752,7 @@ static void calc_poc_fx( /* Energy */ #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA // Left W_tmp = W_add( W_mult0_32_32( specLr[i], specLr[i] ), W_mult0_32_32( specLi[i], specLi[i] ) ); // Q(62-(2*specL_e)) -> Q(63 - ((2*specL_e) +1)) Loading Loading @@ -817,7 +817,7 @@ static void calc_poc_fx( tIPDr = L_sub( Mpy_32_32_r( specRr[i], IPDr ), Mpy_32_32_r( specRi[i], IPDi ) ); // spec_e tIPDi = L_add( Mpy_32_32_r( specRr[i], IPDi ), Mpy_32_32_r( specRi[i], IPDr ) ); // spec_e #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Nr = BASOP_Util_Add_Mant32Exp( Nr, Nr_e, L_add( Mpy_32_32_r( specLr[i], tIPDr ), Mpy_32_32_r( specLi[i], tIPDi ) ), 0, &Nr_e ); Ni = BASOP_Util_Add_Mant32Exp( Ni, Ni_e, L_sub( Mpy_32_32_r( specLi[i], tIPDr ), Mpy_32_32_r( specLr[i], tIPDi ) ), 0, &Ni_e ); Loading Loading @@ -865,7 +865,7 @@ static void calc_poc_fx( move32(); // Pn = (float) inv_sqrt( ( Pr[n] * Pr[n] + Pi[n] * Pi[n] ) + EPSILON ); #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Pn = L_add( L_shr( Mpy_32_32_r( Pr[n], Pr[n] ), 1 ), L_shr( Mpy_32_32_r( Pi[n], Pi[n] ), 1 ) ); Pn = BASOP_Util_Add_Mant32Exp( Pn, 1, EPSILON_FX_M, EPSILON_FX_E, &Pn_e ); Pn = Isqrt_lc( Pn, &Pn_e ); Loading Loading @@ -1084,16 +1084,17 @@ static void calc_poc_fx( FOR( i = 0; i < hPHA->pha_len; i++ ) { // hPHA->p_curr_taps[n][i] *= hPHA->win[i]; #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 #else #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef FIX_ISSUE_1153 hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 #else hPHA->p_curr_taps_fx[n][i] = L_shl( Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ), 1 ); // Q31 #endif #endif #endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA move32(); } Loading @@ -1101,16 +1102,35 @@ static void calc_poc_fx( move32(); energy_e = 0; move16(); #ifndef NONBE_FIX_1386_STEREO_DMX_EVS_PHA #ifdef FIX_ISSUE_1153 Word16 shift = L_norm_arr( hPHA->p_curr_taps_fx[n], hPHA->pha_len ); IF( shift ) { scale_sig32( hPHA->p_curr_taps_fx[n], hPHA->pha_len, 1 ); shift = 1; move16(); } #endif #endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA FOR( i = 0; i < hPHA->pha_len; i++ ) { #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), 0, &energy_e ); #else #ifdef FIX_ISSUE_1153 energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), shl( sub( 1, shift ), 1 ), &energy_e ); #else energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), 0, &energy_e ); #endif #endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA } // energy = (float) inv_sqrt( energy + EPSILON ); energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, EPSILON_FX_M, EPSILON_FX_E, &energy_e ); energy = ISqrt32( energy, &energy_e ); FOR( i = 0; i < hPHA->pha_len; i++ ) { #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), sub( energy_e, 1 ) ); // Q30 #else hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), energy_e ); // Q31 Loading Loading @@ -1217,7 +1237,7 @@ static void calc_poc_fx( *-------------------------------------------------------------------*/ static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx[], /* o : estimated itd Q0 */ #else Word32 itd_fx[], /* o : estimated itd Q16 */ Loading Loading @@ -1533,7 +1553,7 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd[], /* o : estimated itd Q0 */ #else Word32 itd[], /* o : estimated itd Q16 */ Loading Loading @@ -2078,7 +2098,7 @@ void stereo_dmx_evs_enc_fx( // ftmp += p_data_mem[n - m] * p_prev_taps[m]; fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_prev_taps[m] ) ); // Q25 } #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA fx_tmp = L_shl( fx_tmp, 1 ); // Q26 #endif mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); Loading @@ -2105,7 +2125,7 @@ void stereo_dmx_evs_enc_fx( // ftmp += p_data_mem[n - m] * p_curr_taps[m]; fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_curr_taps[m] ) ); // Q25 } #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA fx_tmp = L_shl( fx_tmp, 1 ); // Q26 #endif // dmx_pha_data[n] += ftmp * INV_SQRT_2; Loading Loading @@ -2137,7 +2157,7 @@ void stereo_dmx_evs_enc_fx( curr_prc = hStereoDmxEVS->hPHA->curr_prc; move32(); // if ( abs( (int16_t) hStereoDmxEVS->itd ) > hStereoDmxEVS->hPHA->prc_thres ) #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_16( abs_s( hStereoDmxEVS->itd_fx ), hStereoDmxEVS->hPHA->prc_thres ) ) #else IF( GT_16( abs_s( round_fx( hStereoDmxEVS->itd_fx ) ), hStereoDmxEVS->hPHA->prc_thres ) ) Loading Loading @@ -2264,7 +2284,7 @@ ivas_error stereo_dmx_evs_init_encoder_fx( STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS; Word16 n, input_frame; #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 m, len, pha_len, fad_len, fad_len2, rfft_ipd_coef_step, n0, input_frame_pha; Word32 *fad_g, fad_r, *ipd_ff; Word16 *win; Loading Loading @@ -2504,7 +2524,7 @@ ivas_error stereo_dmx_evs_init_encoder_fx( fad_len = hStereoDmxEVS->hPHA->fad_len; move16(); #ifdef FIX_1386_STEREO_DMX_EVS_PHA #ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA set16_fx( hStereoDmxEVS->hPHA->win_fx, 29491 /*1.8f in Q14*/, pha_len ); hStereoDmxEVS->hPHA->win_fx[0] = ONE_IN_Q14; move16(); Loading