Loading lib_com/options.h +0 −3 Original line number Diff line number Diff line Loading @@ -175,7 +175,4 @@ #define DOT_PROD_CHOLESKY_64BIT /* FhG: Issue 1323, optimized 64 bit implementation of dot_product_cholesky() */ #define OPT_BASOP_ADD_v1 /* optimizations to avoid usage of BASOP_Util_Add_MantExp */ #define FIX_ISSUE_1327 /* Ittiam: Fix for issue 1327: Glitch when stereo is switching from TD to FD*/ #define NONBE_FIX_1402_WAVEADJUST /* VA: BASOP iisue 1402: fix waveform adjustment decoder PLC */ #define FIX_ISSUE_1376 /* VA: Fix for issue 1376 (issue with GSC excitation) */ #define OPT_SBA_AVOID_SPAR_RESCALE /* Optimization made to spar decoder and IGF */ #endif lib_enc/ivas_stat_enc.h +8 −1 Original line number Diff line number Diff line Loading @@ -1183,7 +1183,11 @@ typedef struct stereo_dmx_evs_correlation_filter_structure { Word16 init_frmCntr; #ifdef FIX_1386_STEREO_DMX_EVS_PHA Word32 isd_rate_s_fx; // Q31 #else Word16 isd_rate_s_fx; // Q15 #endif Word32 iccr_s_fx; // Q31 Word32 ipd_ff_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 Word32 Pr_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 Loading Loading @@ -1224,8 +1228,11 @@ 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 Word16 itd_fx; // Q0 #else Word32 itd_fx; // Q16 #endif Word32 pre_dmx_energy_fx[1]; Word16 pre_dmx_energy_fx_e[1]; Loading lib_enc/ivas_stereo_dmx_evs_fx.c +167 −28 Original line number Diff line number Diff line Loading @@ -65,12 +65,20 @@ #define Q_BAND_FX 536870912 /*Q31*/ #define STEREO_DMX_EVS_ISD_FORGETTING_Q15 31129 #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 #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 #define STEREO_DMX_EVS_ISD_DIST_HYST_H_Q31 923417968 #define STEREO_DMX_EVS_ISD_INVTHRES_H 1270700383 #else #define STEREO_DMX_EVS_ISD_FORGETTING_Q15 31129 #define STEREO_DMX_EVS_ISD_DIST_HYST_L_Q15 11796 #define STEREO_DMX_EVS_ISD_DIST_HYST_H_Q15 14090 #endif #define STEREO_DMX_EVS_ICCR_FORGETTING_Q31 1503238554 #define STEREO_DMX_EVS_ICCR_HYST_L_Q31 1610612736 Loading Loading @@ -153,7 +161,11 @@ 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 Word16 itd[], /* o : estimated itd Q0 */ #else Word32 itd[], /* o : estimated itd Q16 */ #endif const Word16 input_frame /* i : input frame length per channel */ ); static void adapt_gain_fx( Loading Loading @@ -196,7 +208,11 @@ 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 Word16 itd_fx[], /* o : estimated itd */ #else Word32 itd_fx[], /* o : estimated itd */ #endif const Word16 input_frame, /* i : input frame length per channel */ const Word32 ratio_fixed /* i : adapting ratio */ ); Loading Loading @@ -605,11 +621,20 @@ 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 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 ) ) ) ) #endif { isd_cnt_h = add( isd_cnt_h, 1 ); } #ifdef 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 IF( LT_32( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), Mpy_32_32_r( STEREO_DMX_EVS_ISD_THRES_L_Q31, L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) ) #endif { isd_cnt_l = add( isd_cnt_l, 1 ); } Loading @@ -618,10 +643,19 @@ 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 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 hPHA->isd_rate_s_fx = add( mult_r( STEREO_DMX_EVS_ISD_FORGETTING_Q15, hPHA->isd_rate_s_fx ), mult_r( MAX_16 - STEREO_DMX_EVS_ISD_FORGETTING_Q15, isd_rate ) ); move16(); #endif #ifdef 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 ) ) #endif { IF( NE_32( hPHA->curr_pha, STEREO_DMX_EVS_PHA_IPD ) ) { Loading @@ -646,7 +680,11 @@ static void calc_poc_fx( hPHA->prev_pha = STEREO_DMX_EVS_PHA_IPD; move32(); } #ifdef 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 ) ) #endif { IF( NE_32( hPHA->curr_pha, STEREO_DMX_EVS_PHA_IPD2 ) ) { Loading Loading @@ -711,11 +749,36 @@ static void calc_poc_fx( FOR( j = 0; j < STEREO_DMX_EVS_SUBBAND_SIZE; ( j++, i++ ) ) { /* Energy */ #ifdef 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)) L_tmp_e = W_norm( W_tmp ); IF( L_tmp_e != 0 ) { W_tmp = W_shl( W_tmp, L_tmp_e ); // Q(63 - ((2*spec_e) - (L_tmp_e - 1)) } tEl[n] = BASOP_Util_Add_Mant32Exp( tEl[n], tEl_e[n], W_round64_L( W_tmp ), sub( shl( spec_e, 1 ), sub( L_tmp_e, 1 ) ), &tEl_e[n] ); move32(); // Right W_tmp = W_add( W_mult0_32_32( specRr[i], specRr[i] ), W_mult0_32_32( specRi[i], specRi[i] ) ); // Q(62-(2*specR_e)) -> Q(63 - ((2*specR_e) +1)) L_tmp_e = W_norm( W_tmp ); IF( L_tmp_e != 0 ) { W_tmp = W_shl( W_tmp, L_tmp_e ); // Q(63 - ((2*spec_e) - (L_tmp_e - 1)) } tEr[n] = BASOP_Util_Add_Mant32Exp( tEr[n], tEr_e[n], W_round64_L( W_tmp ), sub( shl( spec_e, 1 ), sub( L_tmp_e, 1 ) ), &tEr_e[n] ); move32(); #else tEl[n] = BASOP_Util_Add_Mant32Exp( tEl[n], tEl_e[n], L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), shl( spec_e, 1 ), &tEl_e[n] ); move32(); tEr[n] = BASOP_Util_Add_Mant32Exp( tEr[n], tEr_e[n], L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), shl( spec_e, 1 ), &tEr_e[n] ); move32(); #endif /* IPD */ // IPDr = L_add(Mpy_32_32_r(specLr[i], specRr[i]), Mpy_32_32_r(specLi[i], specRi[i])); //2*spec_e Loading Loading @@ -746,11 +809,35 @@ 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 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 ); // eneL = BASOP_Util_Add_Mant32Exp( eneL, eneL_e, L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), 0, &eneL_e ); W_tmp = W_add( W_mult0_32_32( specLr[i], specLr[i] ), W_mult0_32_32( specLi[i], specLi[i] ) ); L_tmp_e = W_norm( W_tmp ); IF( L_tmp_e != 0 ) { W_tmp = W_shl( W_tmp, L_tmp_e ); } eneL = BASOP_Util_Add_Mant32Exp( eneL, eneL_e, W_round64_L( W_tmp ), sub( 1, L_tmp_e ), &eneL_e ); // eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), 0, &eneR_e ); W_tmp = W_add( W_mult0_32_32( specRr[i], specRr[i] ), W_mult0_32_32( specRi[i], specRi[i] ) ); L_tmp_e = W_norm( W_tmp ); IF( L_tmp_e != 0 ) { W_tmp = W_shl( W_tmp, L_tmp_e ); } eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, W_round64_L( W_tmp ), sub( 1, L_tmp_e ), &eneR_e ); #else Nr = BASOP_Util_Add_Mant32Exp( Nr, Nr_e, L_add( Mpy_32_32_r( specLr[i], tIPDr ), Mpy_32_32_r( specLi[i], tIPDi ) ), shl( spec_e, 1 ), &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 ) ), shl( spec_e, 1 ), &Ni_e ); eneL = BASOP_Util_Add_Mant32Exp( eneL, eneL_e, L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), shl( spec_e, 1 ), &eneL_e ); eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), shl( spec_e, 1 ), &eneR_e ); #endif } // Pn = (float) inv_sqrt( ( tPr * tPr + tPi * tPi ) + EPSILON ); Loading @@ -768,7 +855,13 @@ static void calc_poc_fx( move32(); Pi[n] = L_add( Mpy_32_32_r( ipd_ff[n], Pi[n] ), Mpy_32_32_r( L_sub( MAX_32, ipd_ff[n] ), tPi ) ); move32(); // Pn = (float) inv_sqrt( ( Pr[n] * Pr[n] + Pi[n] * Pi[n] ) + EPSILON ); #ifdef 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 ); #else L_tmp = L_add( L_shr( Mpy_32_32_r( Pr[n], Pr[n] ), 1 ), L_shr( Mpy_32_32_r( Pi[n], Pi[n] ), 1 ) ); L_tmp_e = 1; move16(); Loading @@ -776,6 +869,8 @@ static void calc_poc_fx( Pn_e = L_tmp_e; move16(); Pn = ISqrt32( L_tmp, &Pn_e ); #endif Pr[n] = L_shl_sat( Mpy_32_32_r( Pr[n], Pn ), Pn_e ); // Q31 move32(); Pi[n] = L_shl_sat( Mpy_32_32_r( Pi[n], Pn ), Pn_e ); // Q31 Loading Loading @@ -984,7 +1079,13 @@ static void calc_poc_fx( #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 #ifdef 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 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 move32(); } Loading Loading @@ -1015,7 +1116,11 @@ static void calc_poc_fx( energy = ISqrt32( energy, &energy_e ); FOR( i = 0; i < hPHA->pha_len; i++ ) { #ifdef 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 #endif move32(); } } Loading Loading @@ -1118,7 +1223,11 @@ 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 Word16 itd_fx[], /* o : estimated itd Q0 */ #else Word32 itd_fx[], /* o : estimated itd Q16 */ #endif const Word16 input_frame, /* i : input frame length per channel */ const Word32 ratio_fixed /* i : adapting ratio Q31 */ ) Loading Loading @@ -1430,7 +1539,11 @@ 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 Word16 itd[], /* o : estimated itd Q0 */ #else Word32 itd[], /* o : estimated itd Q16 */ #endif const Word16 input_frame /* i : input frame length per channel */ ) { Loading Loading @@ -1938,9 +2051,9 @@ void stereo_dmx_evs_enc_fx( hStereoDmxEVS->dmx_weight_fx, hStereoDmxEVS->pre_dmx_energy_fx, hStereoDmxEVS->pre_dmx_energy_fx_e, hStereoDmxEVS->aux_dmx_energy_fx, hStereoDmxEVS->aux_dmx_energy_fx_e ); // Downscaling signals to avoid accumulation overflows scale_sig32( data_fx[0], input_frame, -5 ); // Q16->Q11 scale_sig32( data_fx[1], input_frame, -5 ); // Q16->Q11 scale_sig32( dmx_poc_data, input_frame, -5 ); // Q16->Q11 scale_sig32( data_fx[0], input_frame, -5 ); // Q31->Q26 scale_sig32( data_fx[1], input_frame, -5 ); // Q31->Q26 scale_sig32( dmx_poc_data, input_frame, -5 ); // Q31->Q26 /* pha */ Loading Loading @@ -1969,9 +2082,11 @@ void stereo_dmx_evs_enc_fx( FOR( ( fx_tmp = 0, m = 0 ); m < pha_len; m++ ) { // ftmp += p_data_mem[n - m] * p_prev_taps[m]; // fx_tmp = BASOP_Util_Add_Mant32Exp(fx_tmp, fx_tmp_e, Mpy_32_32(p_data_mem[n - m], p_prev_taps[m]),15,&fx_tmp_e); fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_prev_taps[m] ) ); // Q11 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 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 ) ); move32(); } Loading @@ -1981,7 +2096,7 @@ void stereo_dmx_evs_enc_fx( FOR( n = 0; n < fad_len; n++ ) { // mem_prev[n] += p_data[n] * INV_SQRT_2; mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q11 mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q26 move32(); } } Loading @@ -1994,10 +2109,13 @@ void stereo_dmx_evs_enc_fx( FOR( ( fx_tmp = 0, m = 0 ); m < pha_len; m++ ) { // 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] ) ); // Q11 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 fx_tmp = L_shl( fx_tmp, 1 ); // Q26 #endif // dmx_pha_data[n] += ftmp * INV_SQRT_2; dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); // Q11 dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); // Q26 move32(); } } Loading @@ -2006,7 +2124,7 @@ void stereo_dmx_evs_enc_fx( FOR( n = 0; n < n_samples; n++ ) { // dmx_pha_data[n] += p_data[n] * INV_SQRT_2; dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q11 dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q26 move32(); } } Loading @@ -2016,7 +2134,7 @@ void stereo_dmx_evs_enc_fx( { dmx_pha_data[n] = Mpy_32_32( dmx_pha_data[n], fad_g[n] ); move32(); dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( mem_prev[n], fad_g[m] ) ); // Q11 dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( mem_prev[n], fad_g[m] ) ); // Q26 move32(); } Loading @@ -2025,7 +2143,11 @@ 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 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 ) ) #endif { IF( NE_32( hStereoDmxEVS->hPHA->curr_prc, STEREO_DMX_EVS_PRC_POC ) ) { Loading Loading @@ -2102,9 +2224,9 @@ void stereo_dmx_evs_enc_fx( FOR( ( n = 0, m = ( fad_len - 1 ) ); n < fad_len; ( n++, m-- ) ) { p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q11 p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q26 move32(); p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_pha_data[n] ) ); // Q11 p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_pha_data[n] ) ); // Q26 move32(); } } Loading @@ -2121,16 +2243,15 @@ void stereo_dmx_evs_enc_fx( FOR( ( n = 0, m = ( fad_len - 1 ) ); n < fad_len; ( n++, m-- ) ) { p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q11 p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q26 move32(); p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_poc_data[n] ) ); // Q11 p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_poc_data[n] ) ); // Q26 move32(); } } } Copy_Scale_sig32_16( p_dmx_data, data, n_samples, 5 ); // Q11->Q0 Copy_Scale_sig32_16( p_dmx_data, data, n_samples, 5 ); // Q26->Q15 return; } Loading Loading @@ -2383,6 +2504,23 @@ ivas_error stereo_dmx_evs_init_encoder_fx( fad_len = hStereoDmxEVS->hPHA->fad_len; move16(); #ifdef 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(); IF( EQ_32( input_Fs, 16000 ) ) { hStereoDmxEVS->hPHA->win_fx[pha_len - 1] = 7373; /*0.45f in Q14*/ move16(); } ELSE IF( EQ_32( input_Fs, 32000 ) || EQ_32( input_Fs, 48000 ) ) { hStereoDmxEVS->hPHA->win_fx[sub( pha_len, 2 )] = 19302; /*1.1781f in Q14*/ move16(); hStereoDmxEVS->hPHA->win_fx[sub( pha_len, 1 )] = 2816; /*0.1718f in Q14*/ move16(); } #else trans_len = idiv1616( pha_len, 20 ); set16_fx( hStereoDmxEVS->hPHA->win_fx, 29491 /*1.8f in Q15*/, sub( pha_len, trans_len ) ); hStereoDmxEVS->hPHA->win_fx[0] = ONE_IN_Q14; Loading @@ -2396,6 +2534,7 @@ ivas_error stereo_dmx_evs_init_encoder_fx( win[n] = mult_r( add( ONE_IN_Q14, getCosWord16R2( imult1616( add( n, 1 ), tmp_r ) ) ), 29491 /*1.8/2 in Q15*/ ); move16(); } #endif fad_g = hStereoDmxEVS->hPHA->fad_g_fx; // fad_r = 1.0f / (float) ( fad_len + 1 ); Loading Loading
lib_com/options.h +0 −3 Original line number Diff line number Diff line Loading @@ -175,7 +175,4 @@ #define DOT_PROD_CHOLESKY_64BIT /* FhG: Issue 1323, optimized 64 bit implementation of dot_product_cholesky() */ #define OPT_BASOP_ADD_v1 /* optimizations to avoid usage of BASOP_Util_Add_MantExp */ #define FIX_ISSUE_1327 /* Ittiam: Fix for issue 1327: Glitch when stereo is switching from TD to FD*/ #define NONBE_FIX_1402_WAVEADJUST /* VA: BASOP iisue 1402: fix waveform adjustment decoder PLC */ #define FIX_ISSUE_1376 /* VA: Fix for issue 1376 (issue with GSC excitation) */ #define OPT_SBA_AVOID_SPAR_RESCALE /* Optimization made to spar decoder and IGF */ #endif
lib_enc/ivas_stat_enc.h +8 −1 Original line number Diff line number Diff line Loading @@ -1183,7 +1183,11 @@ typedef struct stereo_dmx_evs_correlation_filter_structure { Word16 init_frmCntr; #ifdef FIX_1386_STEREO_DMX_EVS_PHA Word32 isd_rate_s_fx; // Q31 #else Word16 isd_rate_s_fx; // Q15 #endif Word32 iccr_s_fx; // Q31 Word32 ipd_ff_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 Word32 Pr_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 Loading Loading @@ -1224,8 +1228,11 @@ 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 Word16 itd_fx; // Q0 #else Word32 itd_fx; // Q16 #endif Word32 pre_dmx_energy_fx[1]; Word16 pre_dmx_energy_fx_e[1]; Loading
lib_enc/ivas_stereo_dmx_evs_fx.c +167 −28 Original line number Diff line number Diff line Loading @@ -65,12 +65,20 @@ #define Q_BAND_FX 536870912 /*Q31*/ #define STEREO_DMX_EVS_ISD_FORGETTING_Q15 31129 #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 #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 #define STEREO_DMX_EVS_ISD_DIST_HYST_H_Q31 923417968 #define STEREO_DMX_EVS_ISD_INVTHRES_H 1270700383 #else #define STEREO_DMX_EVS_ISD_FORGETTING_Q15 31129 #define STEREO_DMX_EVS_ISD_DIST_HYST_L_Q15 11796 #define STEREO_DMX_EVS_ISD_DIST_HYST_H_Q15 14090 #endif #define STEREO_DMX_EVS_ICCR_FORGETTING_Q31 1503238554 #define STEREO_DMX_EVS_ICCR_HYST_L_Q31 1610612736 Loading Loading @@ -153,7 +161,11 @@ 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 Word16 itd[], /* o : estimated itd Q0 */ #else Word32 itd[], /* o : estimated itd Q16 */ #endif const Word16 input_frame /* i : input frame length per channel */ ); static void adapt_gain_fx( Loading Loading @@ -196,7 +208,11 @@ 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 Word16 itd_fx[], /* o : estimated itd */ #else Word32 itd_fx[], /* o : estimated itd */ #endif const Word16 input_frame, /* i : input frame length per channel */ const Word32 ratio_fixed /* i : adapting ratio */ ); Loading Loading @@ -605,11 +621,20 @@ 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 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 ) ) ) ) #endif { isd_cnt_h = add( isd_cnt_h, 1 ); } #ifdef 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 IF( LT_32( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), Mpy_32_32_r( STEREO_DMX_EVS_ISD_THRES_L_Q31, L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) ) #endif { isd_cnt_l = add( isd_cnt_l, 1 ); } Loading @@ -618,10 +643,19 @@ 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 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 hPHA->isd_rate_s_fx = add( mult_r( STEREO_DMX_EVS_ISD_FORGETTING_Q15, hPHA->isd_rate_s_fx ), mult_r( MAX_16 - STEREO_DMX_EVS_ISD_FORGETTING_Q15, isd_rate ) ); move16(); #endif #ifdef 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 ) ) #endif { IF( NE_32( hPHA->curr_pha, STEREO_DMX_EVS_PHA_IPD ) ) { Loading @@ -646,7 +680,11 @@ static void calc_poc_fx( hPHA->prev_pha = STEREO_DMX_EVS_PHA_IPD; move32(); } #ifdef 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 ) ) #endif { IF( NE_32( hPHA->curr_pha, STEREO_DMX_EVS_PHA_IPD2 ) ) { Loading Loading @@ -711,11 +749,36 @@ static void calc_poc_fx( FOR( j = 0; j < STEREO_DMX_EVS_SUBBAND_SIZE; ( j++, i++ ) ) { /* Energy */ #ifdef 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)) L_tmp_e = W_norm( W_tmp ); IF( L_tmp_e != 0 ) { W_tmp = W_shl( W_tmp, L_tmp_e ); // Q(63 - ((2*spec_e) - (L_tmp_e - 1)) } tEl[n] = BASOP_Util_Add_Mant32Exp( tEl[n], tEl_e[n], W_round64_L( W_tmp ), sub( shl( spec_e, 1 ), sub( L_tmp_e, 1 ) ), &tEl_e[n] ); move32(); // Right W_tmp = W_add( W_mult0_32_32( specRr[i], specRr[i] ), W_mult0_32_32( specRi[i], specRi[i] ) ); // Q(62-(2*specR_e)) -> Q(63 - ((2*specR_e) +1)) L_tmp_e = W_norm( W_tmp ); IF( L_tmp_e != 0 ) { W_tmp = W_shl( W_tmp, L_tmp_e ); // Q(63 - ((2*spec_e) - (L_tmp_e - 1)) } tEr[n] = BASOP_Util_Add_Mant32Exp( tEr[n], tEr_e[n], W_round64_L( W_tmp ), sub( shl( spec_e, 1 ), sub( L_tmp_e, 1 ) ), &tEr_e[n] ); move32(); #else tEl[n] = BASOP_Util_Add_Mant32Exp( tEl[n], tEl_e[n], L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), shl( spec_e, 1 ), &tEl_e[n] ); move32(); tEr[n] = BASOP_Util_Add_Mant32Exp( tEr[n], tEr_e[n], L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), shl( spec_e, 1 ), &tEr_e[n] ); move32(); #endif /* IPD */ // IPDr = L_add(Mpy_32_32_r(specLr[i], specRr[i]), Mpy_32_32_r(specLi[i], specRi[i])); //2*spec_e Loading Loading @@ -746,11 +809,35 @@ 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 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 ); // eneL = BASOP_Util_Add_Mant32Exp( eneL, eneL_e, L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), 0, &eneL_e ); W_tmp = W_add( W_mult0_32_32( specLr[i], specLr[i] ), W_mult0_32_32( specLi[i], specLi[i] ) ); L_tmp_e = W_norm( W_tmp ); IF( L_tmp_e != 0 ) { W_tmp = W_shl( W_tmp, L_tmp_e ); } eneL = BASOP_Util_Add_Mant32Exp( eneL, eneL_e, W_round64_L( W_tmp ), sub( 1, L_tmp_e ), &eneL_e ); // eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), 0, &eneR_e ); W_tmp = W_add( W_mult0_32_32( specRr[i], specRr[i] ), W_mult0_32_32( specRi[i], specRi[i] ) ); L_tmp_e = W_norm( W_tmp ); IF( L_tmp_e != 0 ) { W_tmp = W_shl( W_tmp, L_tmp_e ); } eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, W_round64_L( W_tmp ), sub( 1, L_tmp_e ), &eneR_e ); #else Nr = BASOP_Util_Add_Mant32Exp( Nr, Nr_e, L_add( Mpy_32_32_r( specLr[i], tIPDr ), Mpy_32_32_r( specLi[i], tIPDi ) ), shl( spec_e, 1 ), &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 ) ), shl( spec_e, 1 ), &Ni_e ); eneL = BASOP_Util_Add_Mant32Exp( eneL, eneL_e, L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), shl( spec_e, 1 ), &eneL_e ); eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), shl( spec_e, 1 ), &eneR_e ); #endif } // Pn = (float) inv_sqrt( ( tPr * tPr + tPi * tPi ) + EPSILON ); Loading @@ -768,7 +855,13 @@ static void calc_poc_fx( move32(); Pi[n] = L_add( Mpy_32_32_r( ipd_ff[n], Pi[n] ), Mpy_32_32_r( L_sub( MAX_32, ipd_ff[n] ), tPi ) ); move32(); // Pn = (float) inv_sqrt( ( Pr[n] * Pr[n] + Pi[n] * Pi[n] ) + EPSILON ); #ifdef 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 ); #else L_tmp = L_add( L_shr( Mpy_32_32_r( Pr[n], Pr[n] ), 1 ), L_shr( Mpy_32_32_r( Pi[n], Pi[n] ), 1 ) ); L_tmp_e = 1; move16(); Loading @@ -776,6 +869,8 @@ static void calc_poc_fx( Pn_e = L_tmp_e; move16(); Pn = ISqrt32( L_tmp, &Pn_e ); #endif Pr[n] = L_shl_sat( Mpy_32_32_r( Pr[n], Pn ), Pn_e ); // Q31 move32(); Pi[n] = L_shl_sat( Mpy_32_32_r( Pi[n], Pn ), Pn_e ); // Q31 Loading Loading @@ -984,7 +1079,13 @@ static void calc_poc_fx( #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 #ifdef 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 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 move32(); } Loading Loading @@ -1015,7 +1116,11 @@ static void calc_poc_fx( energy = ISqrt32( energy, &energy_e ); FOR( i = 0; i < hPHA->pha_len; i++ ) { #ifdef 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 #endif move32(); } } Loading Loading @@ -1118,7 +1223,11 @@ 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 Word16 itd_fx[], /* o : estimated itd Q0 */ #else Word32 itd_fx[], /* o : estimated itd Q16 */ #endif const Word16 input_frame, /* i : input frame length per channel */ const Word32 ratio_fixed /* i : adapting ratio Q31 */ ) Loading Loading @@ -1430,7 +1539,11 @@ 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 Word16 itd[], /* o : estimated itd Q0 */ #else Word32 itd[], /* o : estimated itd Q16 */ #endif const Word16 input_frame /* i : input frame length per channel */ ) { Loading Loading @@ -1938,9 +2051,9 @@ void stereo_dmx_evs_enc_fx( hStereoDmxEVS->dmx_weight_fx, hStereoDmxEVS->pre_dmx_energy_fx, hStereoDmxEVS->pre_dmx_energy_fx_e, hStereoDmxEVS->aux_dmx_energy_fx, hStereoDmxEVS->aux_dmx_energy_fx_e ); // Downscaling signals to avoid accumulation overflows scale_sig32( data_fx[0], input_frame, -5 ); // Q16->Q11 scale_sig32( data_fx[1], input_frame, -5 ); // Q16->Q11 scale_sig32( dmx_poc_data, input_frame, -5 ); // Q16->Q11 scale_sig32( data_fx[0], input_frame, -5 ); // Q31->Q26 scale_sig32( data_fx[1], input_frame, -5 ); // Q31->Q26 scale_sig32( dmx_poc_data, input_frame, -5 ); // Q31->Q26 /* pha */ Loading Loading @@ -1969,9 +2082,11 @@ void stereo_dmx_evs_enc_fx( FOR( ( fx_tmp = 0, m = 0 ); m < pha_len; m++ ) { // ftmp += p_data_mem[n - m] * p_prev_taps[m]; // fx_tmp = BASOP_Util_Add_Mant32Exp(fx_tmp, fx_tmp_e, Mpy_32_32(p_data_mem[n - m], p_prev_taps[m]),15,&fx_tmp_e); fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_prev_taps[m] ) ); // Q11 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 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 ) ); move32(); } Loading @@ -1981,7 +2096,7 @@ void stereo_dmx_evs_enc_fx( FOR( n = 0; n < fad_len; n++ ) { // mem_prev[n] += p_data[n] * INV_SQRT_2; mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q11 mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q26 move32(); } } Loading @@ -1994,10 +2109,13 @@ void stereo_dmx_evs_enc_fx( FOR( ( fx_tmp = 0, m = 0 ); m < pha_len; m++ ) { // 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] ) ); // Q11 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 fx_tmp = L_shl( fx_tmp, 1 ); // Q26 #endif // dmx_pha_data[n] += ftmp * INV_SQRT_2; dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); // Q11 dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); // Q26 move32(); } } Loading @@ -2006,7 +2124,7 @@ void stereo_dmx_evs_enc_fx( FOR( n = 0; n < n_samples; n++ ) { // dmx_pha_data[n] += p_data[n] * INV_SQRT_2; dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q11 dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q26 move32(); } } Loading @@ -2016,7 +2134,7 @@ void stereo_dmx_evs_enc_fx( { dmx_pha_data[n] = Mpy_32_32( dmx_pha_data[n], fad_g[n] ); move32(); dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( mem_prev[n], fad_g[m] ) ); // Q11 dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( mem_prev[n], fad_g[m] ) ); // Q26 move32(); } Loading @@ -2025,7 +2143,11 @@ 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 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 ) ) #endif { IF( NE_32( hStereoDmxEVS->hPHA->curr_prc, STEREO_DMX_EVS_PRC_POC ) ) { Loading Loading @@ -2102,9 +2224,9 @@ void stereo_dmx_evs_enc_fx( FOR( ( n = 0, m = ( fad_len - 1 ) ); n < fad_len; ( n++, m-- ) ) { p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q11 p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q26 move32(); p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_pha_data[n] ) ); // Q11 p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_pha_data[n] ) ); // Q26 move32(); } } Loading @@ -2121,16 +2243,15 @@ void stereo_dmx_evs_enc_fx( FOR( ( n = 0, m = ( fad_len - 1 ) ); n < fad_len; ( n++, m-- ) ) { p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q11 p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q26 move32(); p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_poc_data[n] ) ); // Q11 p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_poc_data[n] ) ); // Q26 move32(); } } } Copy_Scale_sig32_16( p_dmx_data, data, n_samples, 5 ); // Q11->Q0 Copy_Scale_sig32_16( p_dmx_data, data, n_samples, 5 ); // Q26->Q15 return; } Loading Loading @@ -2383,6 +2504,23 @@ ivas_error stereo_dmx_evs_init_encoder_fx( fad_len = hStereoDmxEVS->hPHA->fad_len; move16(); #ifdef 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(); IF( EQ_32( input_Fs, 16000 ) ) { hStereoDmxEVS->hPHA->win_fx[pha_len - 1] = 7373; /*0.45f in Q14*/ move16(); } ELSE IF( EQ_32( input_Fs, 32000 ) || EQ_32( input_Fs, 48000 ) ) { hStereoDmxEVS->hPHA->win_fx[sub( pha_len, 2 )] = 19302; /*1.1781f in Q14*/ move16(); hStereoDmxEVS->hPHA->win_fx[sub( pha_len, 1 )] = 2816; /*0.1718f in Q14*/ move16(); } #else trans_len = idiv1616( pha_len, 20 ); set16_fx( hStereoDmxEVS->hPHA->win_fx, 29491 /*1.8f in Q15*/, sub( pha_len, trans_len ) ); hStereoDmxEVS->hPHA->win_fx[0] = ONE_IN_Q14; Loading @@ -2396,6 +2534,7 @@ ivas_error stereo_dmx_evs_init_encoder_fx( win[n] = mult_r( add( ONE_IN_Q14, getCosWord16R2( imult1616( add( n, 1 ), tmp_r ) ) ), 29491 /*1.8/2 in Q15*/ ); move16(); } #endif fad_g = hStereoDmxEVS->hPHA->fad_g_fx; // fad_r = 1.0f / (float) ( fad_len + 1 ); Loading