Loading lib_com/ivas_spar_com_fx.c +72 −109 Original line number Diff line number Diff line Loading @@ -51,24 +51,16 @@ * Local constants *------------------------------------------------------------------------------------------*/ #define IVAS_FLT_EPS ( 1e-10F ) #define IVAS_FIX_EPS ( 1 ) #define IVAS_DBL_EPS ( (double) 1e-20 ) #define IVAS_FIX_EPS_Q40 ( 110 ) #define IVAS_REMIX_MULT_FAC ( 0.5f ) #define IVAS_ACTIVEW_DM_F ( 1.0f ) #define IVAS_ACTIVEW_DM_F_Q30 ( ONE_IN_Q30 ) /*1 Q30*/ #define IVAS_ACTIVEW_DM_F_DTX ( 0.25f ) #define IVAS_ACTIVEW_DM_F_DTX_Q30 ( 268435456 ) /*0.25 Q30*/ #define IVAS_ACTIVEW_DM_F_VLBR ( 0.25f ) #define IVAS_ACTIVEW_DM_F_VLBR_Q30 ( 268435456 ) /*0.25 Q30*/ #define IVAS_LIN_ACTIVEW_QUAD_ACTIVEW_THRESH ( 3.0f ) #define IVAS_LIN_ACTIVEW_QUAD_ACTIVEW_THRESH_Q29 ( 1610612736 ) /*3 Q29*/ #define IVAS_P_NORM_SCALING ( 1.0f ) #define IVAS_P_NORM_SCALING_FX ( ONE_IN_Q31 ) // 1 Q31 #define IVAS_P_NORM_SCALING_DTX ( 0.75f ) #define IVAS_P_NORM_SCALING_DTX_FX ( 1610612736 ) // 0.75 Q31 #define IVAS_MAT_DIM_3 ( 3 ) Loading Loading @@ -1626,8 +1618,18 @@ static void ivas_get_Wscaling_factor_enc_fx( ivas_calc_post_pred_per_band_enc_fx( cov_real, q_cov_real, mixer_mat, q_mixer_mat, num_ch, b, postpred_cov_re, &q_postpred_cov_re ); } Gw_sq = BASOP_Util_Divide3232_Scale( cov_real[0][0][b], L_max( postpred_cov_re[0][0], IVAS_FIX_EPS ), &tmp_exp ); // 15-(tmp_exp-(q_cov_real[0][0][b]- q_postpred_cov_re)) tmp = L_shl_sat( IVAS_FIX_EPS_Q40, sub( q_postpred_cov_re, 40 ) ); IF( LE_32( postpred_cov_re[0][0], tmp ) ) { Gw_sq = Mpy_32_32( cov_real[0][0][b], 1250000000 ); /*1/1e-10 = 1250000000 Q(-4)*/ q_Gw_sq = add( q_cov_real[0][0][b], -4 - 31 ); } ELSE { Gw_sq = BASOP_Util_Divide3232_Scale( cov_real[0][0][b], postpred_cov_re[0][0], &tmp_exp ); // 15-(tmp_exp-(q_cov_real[0][0][b]- q_postpred_cov_re)) q_Gw_sq = add( sub( 15, tmp_exp ), sub( q_cov_real[0][0][b], q_postpred_cov_re ) ); } shift = MAX16B; move16(); Loading Loading @@ -1992,12 +1994,15 @@ static void ivas_calc_post_pred_per_band_enc_fx( Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], /*q_postpred_cov_re*/ Word16 *q_postpred_cov_re ) { Word16 i, j, k, guard_bits, tmp, q_temp_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], q_tmp_re, q_W_tmp; Word16 i, j, k; Word32 dmx_mat_conj[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word32 temp_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word32 max_val; Word64 tmp_re, W_tmp; Word16 q_postpred_cov_re_per_value[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word16 temp_mat_e[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word16 q_postpred_cov_re_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word16 min_val; Word32 tmp_re; Word16 tmp_q; Word16 tmp_e; FOR( i = 0; i < num_ch; i++ ) { Loading @@ -2014,135 +2019,71 @@ static void ivas_calc_post_pred_per_band_enc_fx( set32_fx( postpred_cov_re[i], 0, num_ch ); } max_val = 1; move32(); min_val = MAX16B; move16(); /* num_ch x num_ch mult */ FOR( i = 0; i < num_ch; i++ ) { FOR( j = 0; j < num_ch; j++ ) { tmp_re = 0; move64(); q_tmp_re = 31; temp_mat[i][j] = 0; move32(); temp_mat_e[i][j] = 0; move16(); FOR( k = 0; k < num_ch; k++ ) { W_tmp = W_shr( W_mult0_32_32( cov_real[i][k][band_idx], dmx_mat_conj[k][j] ), q_mixer_mat ); /*q_cov_real[i][k][band_idx]*/ IF( LT_16( q_cov_real[i][k][band_idx], q_tmp_re ) ) { tmp_re = W_add( W_shr( tmp_re, sub( q_tmp_re, q_cov_real[i][k][band_idx] ) ), W_tmp ); /*q_cov_real[i][k][band_idx]*/ q_tmp_re = q_cov_real[i][k][band_idx]; move16(); } ELSE { tmp_re = W_add( tmp_re, W_shr( W_tmp, sub( q_cov_real[i][k][band_idx], q_tmp_re ) ) ); /*q_tmp_re*/ } } IF( tmp_re == 0 ) { q_temp_mat[i][j] = 31; move16(); temp_mat[i][j] = 0; move32(); } ELSE tmp_re = Mpy_32_32( cov_real[i][k][band_idx], dmx_mat_conj[k][j] ); tmp_e = sub( 62, add( q_cov_real[i][k][band_idx], q_mixer_mat ) ); IF( tmp_re ) { q_temp_mat[i][j] = q_tmp_re; move16(); q_tmp_re = W_norm( tmp_re ); temp_mat[i][j] = W_extract_h( W_shl( tmp_re, q_tmp_re ) ); /*q_temp_mat[i][j]+ q_tmp_re -32*/ temp_mat[i][j] = BASOP_Util_Add_Mant32Exp( temp_mat[i][j], temp_mat_e[i][j], tmp_re, tmp_e, &temp_mat_e[i][j] ); move32(); q_temp_mat[i][j] = sub( add( q_temp_mat[i][j], q_tmp_re ), 32 ); move16(); } max_val = L_max( max_val, L_abs( temp_mat[i][j] ) ); } } guard_bits = find_guarded_bits_fx( num_ch ); tmp = norm_l( max_val ); IF( LT_16( tmp, guard_bits ) ) { guard_bits = sub( guard_bits, tmp ); } ELSE { guard_bits = 0; move16(); } *q_postpred_cov_re = 31; move16(); /* num_ch x num_ch mult */ FOR( i = 0; i < num_ch; i++ ) { FOR( j = i; j < num_ch; j++ ) { tmp_re = 0; move64(); q_tmp_re = 31; q_postpred_cov_re_buf[i][j] = *q_postpred_cov_re; move16(); FOR( k = 0; k < num_ch; k++ ) { W_tmp = W_shr( W_mult0_32_32( mixer_mat[i][k][band_idx], temp_mat[k][j] ), guard_bits ); // q_temp_mat[k][j]+ q_mixer_mat-guard_bits q_W_tmp = sub( add( q_temp_mat[k][j], q_mixer_mat ), guard_bits ); IF( LT_16( q_W_tmp, q_tmp_re ) ) tmp_re = Mpy_32_32( mixer_mat[i][k][band_idx], temp_mat[k][j] ); tmp_q = sub( q_mixer_mat, temp_mat_e[k][j] ); IF( tmp_re ) { tmp_re = W_add( W_shr( tmp_re, sub( q_tmp_re, q_W_tmp ) ), W_tmp ); // q_W_tmp q_tmp_re = q_W_tmp; tmp_e = sub( 31, q_postpred_cov_re_buf[i][j] ); postpred_cov_re[i][j] = BASOP_Util_Add_Mant32Exp( postpred_cov_re[i][j], tmp_e, tmp_re, sub( Q31, tmp_q ), &tmp_e ); move32(); q_postpred_cov_re_buf[i][j] = sub( 31, tmp_e ); move16(); } ELSE { tmp_re = W_add( tmp_re, W_shr( W_tmp, sub( q_W_tmp, q_tmp_re ) ) ); // q_tmp_re } } if ( LT_64( W_abs( tmp_re ), L_shl( IVAS_FIX_EPS, guard_bits ) ) ) IF( postpred_cov_re[i][j] ) { tmp_re = 0; move64(); } q_postpred_cov_re_per_value[i][j] = q_tmp_re; move16(); IF( tmp_re == 0 ) { postpred_cov_re[i][j] = W_extract_l( tmp_re ); /* q_tmp_re*/ move32(); } ELSE { q_tmp_re = W_norm( tmp_re ); postpred_cov_re[i][j] = W_extract_h( W_shl( tmp_re, q_tmp_re ) ); /* q_tmp_re+ q_postpred_cov_re_per_value[i][j] -32*/ move32(); q_postpred_cov_re_per_value[i][j] = sub( add( q_tmp_re, q_postpred_cov_re_per_value[i][j] ), 32 ); move16(); min_val = s_min( min_val, q_postpred_cov_re_buf[i][j] ); } *q_postpred_cov_re = s_min( *q_postpred_cov_re, q_postpred_cov_re_per_value[i][j] ); move16(); } } /*Changing Q of postpred_cov_re to min_val*/ FOR( i = 0; i < num_ch; i++ ) { FOR( j = i; j < num_ch; j++ ) { IF( postpred_cov_re[i][j] >= 0 ) { postpred_cov_re[i][j] = L_shr( postpred_cov_re[i][j], sub( q_postpred_cov_re_per_value[i][j], *q_postpred_cov_re ) ); //*q_postpred_cov_re move32(); } ELSE IF( postpred_cov_re[i][j] ) { postpred_cov_re[i][j] = L_negate( L_shr( L_negate( postpred_cov_re[i][j] ), sub( q_postpred_cov_re_per_value[i][j], *q_postpred_cov_re ) ) ); //*q_postpred_cov_re postpred_cov_re[i][j] = L_shl( postpred_cov_re[i][j], sub( min_val, q_postpred_cov_re_buf[i][j] ) ); move32(); } } } FOR( i = 0; i < num_ch; i++ ) { FOR( j = 0; j < i; j++ ) Loading @@ -2152,6 +2093,14 @@ static void ivas_calc_post_pred_per_band_enc_fx( } } if ( EQ_16( min_val, MAX16B ) ) { min_val = Q31; move16(); } *q_postpred_cov_re = min_val; move16(); return; } Loading Loading @@ -2687,7 +2636,8 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( trace = W_add( trace, W_deposit32_l( L_abs( cov_uu_re[i - num_dmx][i - num_dmx] ) ) ); // q_cov_uu_re } factor = L_max( IVAS_FIX_EPS, postpred_cov_re[0][0] ); // q_postpred_cov_re factor = postpred_cov_re[0][0]; // q_postpred_cov_re move32(); q_factor = q_postpred_cov_re; move16(); IF( trace != 0 ) Loading @@ -2708,10 +2658,20 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( factor = L_max( factor, tmp ); // q_factor } tmp = L_shl_sat( IVAS_FIX_EPS_Q40, sub( q_factor, 40 ) ); Word16 factor_exp = 0; move16(); IF( LE_32( factor, tmp ) ) { factor = 1250000000; factor_exp = Q31 - ( -4 ); } ELSE { factor = BASOP_Util_Divide3232_Scale( 1, factor, &factor_exp ); // q=15-(factor_exp+31-(31-q_factor)) factor_exp = add( factor_exp, q_factor ); } /* normalise Hermitian (except for rounding) cov_uu */ FOR( i = num_dmx; i < num_ch; i++ ) Loading Loading @@ -3311,6 +3271,9 @@ void ivas_calc_c_p_coeffs_enc_fx( Word16 i, j, q_postpred_cov_re; Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; q_postpred_cov_re = 0; move16(); FOR( i = 0; i < IVAS_SPAR_MAX_CH; i++ ) { set_zero_fx( postpred_cov_re[i], IVAS_SPAR_MAX_CH ); Loading lib_enc/ext_sig_ana_fx.c +64 −41 File changed.Preview size limit exceeded, changes collapsed. Show changes lib_enc/ivas_mdct_core_enc_fx.c +27 −26 Original line number Diff line number Diff line Loading @@ -379,6 +379,7 @@ static void kernel_switch_update_transforms_fx( const UWord16 kernelType, /* i : TCX transform kernel type (0 - 3) */ Word16 *tcxTimeSignal, /* i : hTcxEnc->new_speech_TCX buf in st */ const Word16 *speech_TCX, /* i : hTcxEnc->speech_TCX buffer in st */ const Word16 q_speech, Word32 *windowedTimeSignal, /* i/o: windowed input and scratch buffer (*q_windowedTimeSignal) */ Word16 *q_windowedTimeSignal, /* i/o: Q of windowed input and scratch buffer */ const Word16 L_subframe /* i : transform length (number of bins) */ Loading Loading @@ -429,9 +430,9 @@ static void kernel_switch_update_transforms_fx( Word32 factor; n = extract_l( Mpy_32_32( s, 603979776 /* N_ZERO_MDCT_NS / FRAME_SIZE_NS in Q31 */ ) ); Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), -Q1 ); // Q0 -> Q-1 Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), sub( -Q1, q_speech ) ); // q_speech -> Q-1 wtda_ext_fx( tcxTimeSignal, windowedTimeSignal_16, extract_l( windowedTimeSignal[0] ), extract_l( windowedTimeSignal[1] ), s, kernelType ); // Q-2 Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), Q1 ); // Q-1 -> Q0 Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), sub( q_speech, -Q1 ) ); // Q-1 -> q_speech Copy_Scale_sig_16_32_no_sat( windowedTimeSignal_16 /* Q(-2) */, windowedTimeSignal, s, Q16 ); // Q14 scale_sig32( windowedTimeSignal, s, -Q8 /* guard bits */ ); // Q6 edxt_fx( windowedTimeSignal, sigR, s, kernelType, FALSE ); Loading Loading @@ -469,17 +470,17 @@ static void kernel_switch_update_transforms_fx( { FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_speech, Q15) -> Q16 + q_speech L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_speech, Q15) -> Q16 + q_speech L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } Loading @@ -488,17 +489,17 @@ static void kernel_switch_update_transforms_fx( { FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_speech, Q15) -> Q16 + q_speech L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_speech, Q15) -> Q16 + q_speech L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } Loading Loading @@ -1486,7 +1487,7 @@ void ivas_mdct_core_whitening_enc_fx( speech = hTcxEnc0->speech_TCX; } kernel_switch_update_transforms_fx( hTcxEnc0->spectrum_fx[n], mdst_spectrum_fx[0][n], &q_com, hTcxEnc0->transform_type[n], sts[0]->hTcxCfg, sts[0]->bwidth_sw_cnt, hTcxEnc0->kernel_type[n], hTcxEnc0->new_speech_TCX, speech, windowedSignal_fx[0] + i_mult( n, L_FRAME48k ), &q_windowedSignal[0], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); hTcxEnc0->new_speech_TCX, speech, sts[0]->q_inp, windowedSignal_fx[0] + i_mult( n, L_FRAME48k ), &q_windowedSignal[0], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); mdst_spectrum_e[0][n] = sub( Q31, q_com ); hTcxEnc0->spectrum_e[n] = sub( Q31, q_com ); move16(); Loading @@ -1507,7 +1508,7 @@ void ivas_mdct_core_whitening_enc_fx( speech = hTcxEnc1->speech_TCX; } kernel_switch_update_transforms_fx( hTcxEnc1->spectrum_fx[n], mdst_spectrum_fx[1][n], &q_com, hTcxEnc1->transform_type[n], sts[1]->hTcxCfg, sts[1]->bwidth_sw_cnt, hTcxEnc1->kernel_type[n], hTcxEnc1->new_speech_TCX, speech, windowedSignal_fx[1] + i_mult( n, L_FRAME48k ), &q_windowedSignal[1], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); hTcxEnc1->new_speech_TCX, speech, sts[1]->q_inp, windowedSignal_fx[1] + i_mult( n, L_FRAME48k ), &q_windowedSignal[1], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); mdst_spectrum_e[1][n] = sub( Q31, q_com ); hTcxEnc1->spectrum_e[n] = sub( Q31, q_com ); move16(); Loading Loading @@ -1741,7 +1742,7 @@ void ivas_mdct_core_whitening_enc_fx( speech = NULL; } kernel_switch_update_transforms_fx( hTcxEncCh->spectrum_fx[n], mdst_spectrum_fx[ch][n], &q_com, hTcxEncCh->transform_type[n], sts[ch]->hTcxCfg, sts[ch]->bwidth_sw_cnt, hTcxEncCh->kernel_type[n], hTcxEncCh->new_speech_TCX, speech, windowedSignal_fx[ch] + i_mult( n, L_FRAME48k ), &q_windowedSignal[ch], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); hTcxEncCh->new_speech_TCX, speech, sts[ch]->q_inp, windowedSignal_fx[ch] + i_mult( n, L_FRAME48k ), &q_windowedSignal[ch], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); mdst_spectrum_e[ch][n] = sub( Q31, q_com ); move16(); hTcxEncCh->spectrum_e[n] = sub( Q31, q_com ); Loading lib_enc/ivas_stereo_mdct_core_enc_fx.c +8 −6 Original line number Diff line number Diff line Loading @@ -250,7 +250,10 @@ void stereo_mdct_core_enc_fx( hCPE->hStereoMdct->stbParamsTCX20.nBandsStereoCore = hCPE->hStereoMdct->stbParamsTCX20.sfbCnt; move16(); } Word16 len = extract_l( Mpy_32_32( sts[0]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ); Word16 q_com = s_min( s_min( add( sts[0]->q_inp, getScaleFactor16( sts[0]->input_fx, add( len, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ) ), add( sts[0]->q_old_inp, getScaleFactor16( sts[0]->old_input_signal_fx, len ) ) ), s_min( add( sts[1]->q_inp, getScaleFactor16( sts[1]->input_fx, add( len, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ) ), add( sts[1]->q_old_inp, getScaleFactor16( sts[1]->old_input_signal_fx, len ) ) ) ); q_com = s_min( 0, q_com ); FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { inv_mdst_spectrum_fx[ch][0] = powerSpecMsInv_fx[ch][0] = powerSpecMsInv_long_fx[ch]; Loading @@ -272,11 +275,11 @@ void stereo_mdct_core_enc_fx( sts[ch]->hTcxEnc->tns_ms_flag[1] = 0; move16(); Scale_sig( sts[ch]->input_fx, add( extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), negate( sts[ch]->q_inp ) ); /* Q0 */ Scale_sig( sts[ch]->old_input_signal_fx, extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), negate( sts[ch]->q_old_inp ) ); /* Q0 */ sts[ch]->q_old_inp = 0; Scale_sig( sts[ch]->input_fx, add( extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sub( q_com, sts[ch]->q_inp ) ); /* Q0 */ Scale_sig( sts[ch]->old_input_signal_fx, extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), sub( q_com, sts[ch]->q_old_inp ) ); /* Q0 */ sts[ch]->q_old_inp = q_com; move16(); sts[ch]->q_inp = 0; sts[ch]->q_inp = q_com; move16(); } Loading Loading @@ -765,7 +768,6 @@ void stereo_mdct_core_enc_fx( * Split available bits between channels *---------------------------------------------------------------*/ Word16 q_com; FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { Word16 n_sb = NB_DIV; Loading lib_enc/prot_fx_enc.h +2 −1 Original line number Diff line number Diff line Loading @@ -1278,6 +1278,7 @@ void AnalyzePowerSpectrum_ivas_fx( Word32 const mdctSpectrum[], /* i : MDCT spectrum */ Word16 mdctSpectrum_e, Word16 const signal[], /* i : windowed signal corresponding to mdctSpectrum */ const Word16 q_signal, Word32 powerSpec[], /* o : Power spectrum. Can point to signal */ Word16 powerSpec_e[] ); Loading Loading
lib_com/ivas_spar_com_fx.c +72 −109 Original line number Diff line number Diff line Loading @@ -51,24 +51,16 @@ * Local constants *------------------------------------------------------------------------------------------*/ #define IVAS_FLT_EPS ( 1e-10F ) #define IVAS_FIX_EPS ( 1 ) #define IVAS_DBL_EPS ( (double) 1e-20 ) #define IVAS_FIX_EPS_Q40 ( 110 ) #define IVAS_REMIX_MULT_FAC ( 0.5f ) #define IVAS_ACTIVEW_DM_F ( 1.0f ) #define IVAS_ACTIVEW_DM_F_Q30 ( ONE_IN_Q30 ) /*1 Q30*/ #define IVAS_ACTIVEW_DM_F_DTX ( 0.25f ) #define IVAS_ACTIVEW_DM_F_DTX_Q30 ( 268435456 ) /*0.25 Q30*/ #define IVAS_ACTIVEW_DM_F_VLBR ( 0.25f ) #define IVAS_ACTIVEW_DM_F_VLBR_Q30 ( 268435456 ) /*0.25 Q30*/ #define IVAS_LIN_ACTIVEW_QUAD_ACTIVEW_THRESH ( 3.0f ) #define IVAS_LIN_ACTIVEW_QUAD_ACTIVEW_THRESH_Q29 ( 1610612736 ) /*3 Q29*/ #define IVAS_P_NORM_SCALING ( 1.0f ) #define IVAS_P_NORM_SCALING_FX ( ONE_IN_Q31 ) // 1 Q31 #define IVAS_P_NORM_SCALING_DTX ( 0.75f ) #define IVAS_P_NORM_SCALING_DTX_FX ( 1610612736 ) // 0.75 Q31 #define IVAS_MAT_DIM_3 ( 3 ) Loading Loading @@ -1626,8 +1618,18 @@ static void ivas_get_Wscaling_factor_enc_fx( ivas_calc_post_pred_per_band_enc_fx( cov_real, q_cov_real, mixer_mat, q_mixer_mat, num_ch, b, postpred_cov_re, &q_postpred_cov_re ); } Gw_sq = BASOP_Util_Divide3232_Scale( cov_real[0][0][b], L_max( postpred_cov_re[0][0], IVAS_FIX_EPS ), &tmp_exp ); // 15-(tmp_exp-(q_cov_real[0][0][b]- q_postpred_cov_re)) tmp = L_shl_sat( IVAS_FIX_EPS_Q40, sub( q_postpred_cov_re, 40 ) ); IF( LE_32( postpred_cov_re[0][0], tmp ) ) { Gw_sq = Mpy_32_32( cov_real[0][0][b], 1250000000 ); /*1/1e-10 = 1250000000 Q(-4)*/ q_Gw_sq = add( q_cov_real[0][0][b], -4 - 31 ); } ELSE { Gw_sq = BASOP_Util_Divide3232_Scale( cov_real[0][0][b], postpred_cov_re[0][0], &tmp_exp ); // 15-(tmp_exp-(q_cov_real[0][0][b]- q_postpred_cov_re)) q_Gw_sq = add( sub( 15, tmp_exp ), sub( q_cov_real[0][0][b], q_postpred_cov_re ) ); } shift = MAX16B; move16(); Loading Loading @@ -1992,12 +1994,15 @@ static void ivas_calc_post_pred_per_band_enc_fx( Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], /*q_postpred_cov_re*/ Word16 *q_postpred_cov_re ) { Word16 i, j, k, guard_bits, tmp, q_temp_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], q_tmp_re, q_W_tmp; Word16 i, j, k; Word32 dmx_mat_conj[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word32 temp_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word32 max_val; Word64 tmp_re, W_tmp; Word16 q_postpred_cov_re_per_value[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word16 temp_mat_e[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word16 q_postpred_cov_re_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word16 min_val; Word32 tmp_re; Word16 tmp_q; Word16 tmp_e; FOR( i = 0; i < num_ch; i++ ) { Loading @@ -2014,135 +2019,71 @@ static void ivas_calc_post_pred_per_band_enc_fx( set32_fx( postpred_cov_re[i], 0, num_ch ); } max_val = 1; move32(); min_val = MAX16B; move16(); /* num_ch x num_ch mult */ FOR( i = 0; i < num_ch; i++ ) { FOR( j = 0; j < num_ch; j++ ) { tmp_re = 0; move64(); q_tmp_re = 31; temp_mat[i][j] = 0; move32(); temp_mat_e[i][j] = 0; move16(); FOR( k = 0; k < num_ch; k++ ) { W_tmp = W_shr( W_mult0_32_32( cov_real[i][k][band_idx], dmx_mat_conj[k][j] ), q_mixer_mat ); /*q_cov_real[i][k][band_idx]*/ IF( LT_16( q_cov_real[i][k][band_idx], q_tmp_re ) ) { tmp_re = W_add( W_shr( tmp_re, sub( q_tmp_re, q_cov_real[i][k][band_idx] ) ), W_tmp ); /*q_cov_real[i][k][band_idx]*/ q_tmp_re = q_cov_real[i][k][band_idx]; move16(); } ELSE { tmp_re = W_add( tmp_re, W_shr( W_tmp, sub( q_cov_real[i][k][band_idx], q_tmp_re ) ) ); /*q_tmp_re*/ } } IF( tmp_re == 0 ) { q_temp_mat[i][j] = 31; move16(); temp_mat[i][j] = 0; move32(); } ELSE tmp_re = Mpy_32_32( cov_real[i][k][band_idx], dmx_mat_conj[k][j] ); tmp_e = sub( 62, add( q_cov_real[i][k][band_idx], q_mixer_mat ) ); IF( tmp_re ) { q_temp_mat[i][j] = q_tmp_re; move16(); q_tmp_re = W_norm( tmp_re ); temp_mat[i][j] = W_extract_h( W_shl( tmp_re, q_tmp_re ) ); /*q_temp_mat[i][j]+ q_tmp_re -32*/ temp_mat[i][j] = BASOP_Util_Add_Mant32Exp( temp_mat[i][j], temp_mat_e[i][j], tmp_re, tmp_e, &temp_mat_e[i][j] ); move32(); q_temp_mat[i][j] = sub( add( q_temp_mat[i][j], q_tmp_re ), 32 ); move16(); } max_val = L_max( max_val, L_abs( temp_mat[i][j] ) ); } } guard_bits = find_guarded_bits_fx( num_ch ); tmp = norm_l( max_val ); IF( LT_16( tmp, guard_bits ) ) { guard_bits = sub( guard_bits, tmp ); } ELSE { guard_bits = 0; move16(); } *q_postpred_cov_re = 31; move16(); /* num_ch x num_ch mult */ FOR( i = 0; i < num_ch; i++ ) { FOR( j = i; j < num_ch; j++ ) { tmp_re = 0; move64(); q_tmp_re = 31; q_postpred_cov_re_buf[i][j] = *q_postpred_cov_re; move16(); FOR( k = 0; k < num_ch; k++ ) { W_tmp = W_shr( W_mult0_32_32( mixer_mat[i][k][band_idx], temp_mat[k][j] ), guard_bits ); // q_temp_mat[k][j]+ q_mixer_mat-guard_bits q_W_tmp = sub( add( q_temp_mat[k][j], q_mixer_mat ), guard_bits ); IF( LT_16( q_W_tmp, q_tmp_re ) ) tmp_re = Mpy_32_32( mixer_mat[i][k][band_idx], temp_mat[k][j] ); tmp_q = sub( q_mixer_mat, temp_mat_e[k][j] ); IF( tmp_re ) { tmp_re = W_add( W_shr( tmp_re, sub( q_tmp_re, q_W_tmp ) ), W_tmp ); // q_W_tmp q_tmp_re = q_W_tmp; tmp_e = sub( 31, q_postpred_cov_re_buf[i][j] ); postpred_cov_re[i][j] = BASOP_Util_Add_Mant32Exp( postpred_cov_re[i][j], tmp_e, tmp_re, sub( Q31, tmp_q ), &tmp_e ); move32(); q_postpred_cov_re_buf[i][j] = sub( 31, tmp_e ); move16(); } ELSE { tmp_re = W_add( tmp_re, W_shr( W_tmp, sub( q_W_tmp, q_tmp_re ) ) ); // q_tmp_re } } if ( LT_64( W_abs( tmp_re ), L_shl( IVAS_FIX_EPS, guard_bits ) ) ) IF( postpred_cov_re[i][j] ) { tmp_re = 0; move64(); } q_postpred_cov_re_per_value[i][j] = q_tmp_re; move16(); IF( tmp_re == 0 ) { postpred_cov_re[i][j] = W_extract_l( tmp_re ); /* q_tmp_re*/ move32(); } ELSE { q_tmp_re = W_norm( tmp_re ); postpred_cov_re[i][j] = W_extract_h( W_shl( tmp_re, q_tmp_re ) ); /* q_tmp_re+ q_postpred_cov_re_per_value[i][j] -32*/ move32(); q_postpred_cov_re_per_value[i][j] = sub( add( q_tmp_re, q_postpred_cov_re_per_value[i][j] ), 32 ); move16(); min_val = s_min( min_val, q_postpred_cov_re_buf[i][j] ); } *q_postpred_cov_re = s_min( *q_postpred_cov_re, q_postpred_cov_re_per_value[i][j] ); move16(); } } /*Changing Q of postpred_cov_re to min_val*/ FOR( i = 0; i < num_ch; i++ ) { FOR( j = i; j < num_ch; j++ ) { IF( postpred_cov_re[i][j] >= 0 ) { postpred_cov_re[i][j] = L_shr( postpred_cov_re[i][j], sub( q_postpred_cov_re_per_value[i][j], *q_postpred_cov_re ) ); //*q_postpred_cov_re move32(); } ELSE IF( postpred_cov_re[i][j] ) { postpred_cov_re[i][j] = L_negate( L_shr( L_negate( postpred_cov_re[i][j] ), sub( q_postpred_cov_re_per_value[i][j], *q_postpred_cov_re ) ) ); //*q_postpred_cov_re postpred_cov_re[i][j] = L_shl( postpred_cov_re[i][j], sub( min_val, q_postpred_cov_re_buf[i][j] ) ); move32(); } } } FOR( i = 0; i < num_ch; i++ ) { FOR( j = 0; j < i; j++ ) Loading @@ -2152,6 +2093,14 @@ static void ivas_calc_post_pred_per_band_enc_fx( } } if ( EQ_16( min_val, MAX16B ) ) { min_val = Q31; move16(); } *q_postpred_cov_re = min_val; move16(); return; } Loading Loading @@ -2687,7 +2636,8 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( trace = W_add( trace, W_deposit32_l( L_abs( cov_uu_re[i - num_dmx][i - num_dmx] ) ) ); // q_cov_uu_re } factor = L_max( IVAS_FIX_EPS, postpred_cov_re[0][0] ); // q_postpred_cov_re factor = postpred_cov_re[0][0]; // q_postpred_cov_re move32(); q_factor = q_postpred_cov_re; move16(); IF( trace != 0 ) Loading @@ -2708,10 +2658,20 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( factor = L_max( factor, tmp ); // q_factor } tmp = L_shl_sat( IVAS_FIX_EPS_Q40, sub( q_factor, 40 ) ); Word16 factor_exp = 0; move16(); IF( LE_32( factor, tmp ) ) { factor = 1250000000; factor_exp = Q31 - ( -4 ); } ELSE { factor = BASOP_Util_Divide3232_Scale( 1, factor, &factor_exp ); // q=15-(factor_exp+31-(31-q_factor)) factor_exp = add( factor_exp, q_factor ); } /* normalise Hermitian (except for rounding) cov_uu */ FOR( i = num_dmx; i < num_ch; i++ ) Loading Loading @@ -3311,6 +3271,9 @@ void ivas_calc_c_p_coeffs_enc_fx( Word16 i, j, q_postpred_cov_re; Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; q_postpred_cov_re = 0; move16(); FOR( i = 0; i < IVAS_SPAR_MAX_CH; i++ ) { set_zero_fx( postpred_cov_re[i], IVAS_SPAR_MAX_CH ); Loading
lib_enc/ext_sig_ana_fx.c +64 −41 File changed.Preview size limit exceeded, changes collapsed. Show changes
lib_enc/ivas_mdct_core_enc_fx.c +27 −26 Original line number Diff line number Diff line Loading @@ -379,6 +379,7 @@ static void kernel_switch_update_transforms_fx( const UWord16 kernelType, /* i : TCX transform kernel type (0 - 3) */ Word16 *tcxTimeSignal, /* i : hTcxEnc->new_speech_TCX buf in st */ const Word16 *speech_TCX, /* i : hTcxEnc->speech_TCX buffer in st */ const Word16 q_speech, Word32 *windowedTimeSignal, /* i/o: windowed input and scratch buffer (*q_windowedTimeSignal) */ Word16 *q_windowedTimeSignal, /* i/o: Q of windowed input and scratch buffer */ const Word16 L_subframe /* i : transform length (number of bins) */ Loading Loading @@ -429,9 +430,9 @@ static void kernel_switch_update_transforms_fx( Word32 factor; n = extract_l( Mpy_32_32( s, 603979776 /* N_ZERO_MDCT_NS / FRAME_SIZE_NS in Q31 */ ) ); Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), -Q1 ); // Q0 -> Q-1 Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), sub( -Q1, q_speech ) ); // q_speech -> Q-1 wtda_ext_fx( tcxTimeSignal, windowedTimeSignal_16, extract_l( windowedTimeSignal[0] ), extract_l( windowedTimeSignal[1] ), s, kernelType ); // Q-2 Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), Q1 ); // Q-1 -> Q0 Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), sub( q_speech, -Q1 ) ); // Q-1 -> q_speech Copy_Scale_sig_16_32_no_sat( windowedTimeSignal_16 /* Q(-2) */, windowedTimeSignal, s, Q16 ); // Q14 scale_sig32( windowedTimeSignal, s, -Q8 /* guard bits */ ); // Q6 edxt_fx( windowedTimeSignal, sigR, s, kernelType, FALSE ); Loading Loading @@ -469,17 +470,17 @@ static void kernel_switch_update_transforms_fx( { FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_speech, Q15) -> Q16 + q_speech L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_speech, Q15) -> Q16 + q_speech L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } Loading @@ -488,17 +489,17 @@ static void kernel_switch_update_transforms_fx( { FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_speech, Q15) -> Q16 + q_speech L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_speech, Q15) -> Q16 + q_speech L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } Loading Loading @@ -1486,7 +1487,7 @@ void ivas_mdct_core_whitening_enc_fx( speech = hTcxEnc0->speech_TCX; } kernel_switch_update_transforms_fx( hTcxEnc0->spectrum_fx[n], mdst_spectrum_fx[0][n], &q_com, hTcxEnc0->transform_type[n], sts[0]->hTcxCfg, sts[0]->bwidth_sw_cnt, hTcxEnc0->kernel_type[n], hTcxEnc0->new_speech_TCX, speech, windowedSignal_fx[0] + i_mult( n, L_FRAME48k ), &q_windowedSignal[0], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); hTcxEnc0->new_speech_TCX, speech, sts[0]->q_inp, windowedSignal_fx[0] + i_mult( n, L_FRAME48k ), &q_windowedSignal[0], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); mdst_spectrum_e[0][n] = sub( Q31, q_com ); hTcxEnc0->spectrum_e[n] = sub( Q31, q_com ); move16(); Loading @@ -1507,7 +1508,7 @@ void ivas_mdct_core_whitening_enc_fx( speech = hTcxEnc1->speech_TCX; } kernel_switch_update_transforms_fx( hTcxEnc1->spectrum_fx[n], mdst_spectrum_fx[1][n], &q_com, hTcxEnc1->transform_type[n], sts[1]->hTcxCfg, sts[1]->bwidth_sw_cnt, hTcxEnc1->kernel_type[n], hTcxEnc1->new_speech_TCX, speech, windowedSignal_fx[1] + i_mult( n, L_FRAME48k ), &q_windowedSignal[1], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); hTcxEnc1->new_speech_TCX, speech, sts[1]->q_inp, windowedSignal_fx[1] + i_mult( n, L_FRAME48k ), &q_windowedSignal[1], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); mdst_spectrum_e[1][n] = sub( Q31, q_com ); hTcxEnc1->spectrum_e[n] = sub( Q31, q_com ); move16(); Loading Loading @@ -1741,7 +1742,7 @@ void ivas_mdct_core_whitening_enc_fx( speech = NULL; } kernel_switch_update_transforms_fx( hTcxEncCh->spectrum_fx[n], mdst_spectrum_fx[ch][n], &q_com, hTcxEncCh->transform_type[n], sts[ch]->hTcxCfg, sts[ch]->bwidth_sw_cnt, hTcxEncCh->kernel_type[n], hTcxEncCh->new_speech_TCX, speech, windowedSignal_fx[ch] + i_mult( n, L_FRAME48k ), &q_windowedSignal[ch], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); hTcxEncCh->new_speech_TCX, speech, sts[ch]->q_inp, windowedSignal_fx[ch] + i_mult( n, L_FRAME48k ), &q_windowedSignal[ch], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); mdst_spectrum_e[ch][n] = sub( Q31, q_com ); move16(); hTcxEncCh->spectrum_e[n] = sub( Q31, q_com ); Loading
lib_enc/ivas_stereo_mdct_core_enc_fx.c +8 −6 Original line number Diff line number Diff line Loading @@ -250,7 +250,10 @@ void stereo_mdct_core_enc_fx( hCPE->hStereoMdct->stbParamsTCX20.nBandsStereoCore = hCPE->hStereoMdct->stbParamsTCX20.sfbCnt; move16(); } Word16 len = extract_l( Mpy_32_32( sts[0]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ); Word16 q_com = s_min( s_min( add( sts[0]->q_inp, getScaleFactor16( sts[0]->input_fx, add( len, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ) ), add( sts[0]->q_old_inp, getScaleFactor16( sts[0]->old_input_signal_fx, len ) ) ), s_min( add( sts[1]->q_inp, getScaleFactor16( sts[1]->input_fx, add( len, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ) ), add( sts[1]->q_old_inp, getScaleFactor16( sts[1]->old_input_signal_fx, len ) ) ) ); q_com = s_min( 0, q_com ); FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { inv_mdst_spectrum_fx[ch][0] = powerSpecMsInv_fx[ch][0] = powerSpecMsInv_long_fx[ch]; Loading @@ -272,11 +275,11 @@ void stereo_mdct_core_enc_fx( sts[ch]->hTcxEnc->tns_ms_flag[1] = 0; move16(); Scale_sig( sts[ch]->input_fx, add( extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), negate( sts[ch]->q_inp ) ); /* Q0 */ Scale_sig( sts[ch]->old_input_signal_fx, extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), negate( sts[ch]->q_old_inp ) ); /* Q0 */ sts[ch]->q_old_inp = 0; Scale_sig( sts[ch]->input_fx, add( extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sub( q_com, sts[ch]->q_inp ) ); /* Q0 */ Scale_sig( sts[ch]->old_input_signal_fx, extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), sub( q_com, sts[ch]->q_old_inp ) ); /* Q0 */ sts[ch]->q_old_inp = q_com; move16(); sts[ch]->q_inp = 0; sts[ch]->q_inp = q_com; move16(); } Loading Loading @@ -765,7 +768,6 @@ void stereo_mdct_core_enc_fx( * Split available bits between channels *---------------------------------------------------------------*/ Word16 q_com; FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { Word16 n_sb = NB_DIV; Loading
lib_enc/prot_fx_enc.h +2 −1 Original line number Diff line number Diff line Loading @@ -1278,6 +1278,7 @@ void AnalyzePowerSpectrum_ivas_fx( Word32 const mdctSpectrum[], /* i : MDCT spectrum */ Word16 mdctSpectrum_e, Word16 const signal[], /* i : windowed signal corresponding to mdctSpectrum */ const Word16 q_signal, Word32 powerSpec[], /* o : Power spectrum. Can point to signal */ Word16 powerSpec_e[] ); Loading