Loading lib_enc/ivas_core_pre_proc_front_fx.c +32 −19 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ #define SCE_SMC_THR 16000 static void calculate_energy_buffer_ivas_fx( CPE_ENC_HANDLE hCPE, Word32 enerBuffer_dft[], const Word16 no_channels, const Word32 input_Fs, Word16 *enerBuffer_dft_e ); static void calculate_energy_buffer_ivas_fx( CPE_ENC_HANDLE hCPE, Word32 enerBuffer_dft[], const Word16 no_channels, const Word32 input_Fs, Word16 enerBuffer_dft_e[] ); #ifdef IVAS_FIXED_ENC static void calculate_energy_buffer_fx( CPE_ENC_HANDLE hCPE, Word64 enerBuffer_dft_fx[], Word16 *enerBuffer_dft_q_fx, const Word16 no_channels, const Word32 input_Fs ); Loading Loading @@ -222,6 +222,7 @@ ivas_error pre_proc_front_ivas_fx( Word16 imagBuffer16[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word16 res_cod_SNR_M_fx_e[STEREO_DFT_BAND_MAX]; Word16 Qfact_PS, q_lf_E_fx; Word16 enerBuffer_fx_exp_buf[CLDFB_NO_CHANNELS_MAX]; #ifdef DEBUG_MODE_INFO Word32 *in_buff_temp; Word16 in_q_temp; Loading Loading @@ -482,7 +483,7 @@ ivas_error pre_proc_front_ivas_fx( } ELSE IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { calculate_energy_buffer_ivas_fx( hCPE, enerBuffer_fx, st->cldfbAnaEnc->no_channels, input_Fs, enerBuffer_fx_exp ); calculate_energy_buffer_ivas_fx( hCPE, enerBuffer_fx, st->cldfbAnaEnc->no_channels, input_Fs, enerBuffer_fx_exp_buf ); } ELSE { Loading Loading @@ -849,11 +850,19 @@ ivas_error pre_proc_front_ivas_fx( /*----------------------------------------------------------------* * NB/WB/SWB/FB bandwidth detector *----------------------------------------------------------------*/ IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) { sf_energySum[i] = *enerBuffer_fx_exp; sf_energySum[i] = enerBuffer_fx_exp_buf[i]; move16(); } } ELSE { set16_fx( sf_energySum, *enerBuffer_fx_exp, CLDFB_NO_CHANNELS_MAX ); } test(); IF( st->idchan == 0 && NE_16( element_mode, IVAS_CPE_MDCT ) ) Loading @@ -864,6 +873,15 @@ ivas_error pre_proc_front_ivas_fx( bw_detect_fx( st, input_fx_tmp, NULL, enerBuffer_fx, sf_energySum, ivas_format, 0 ); } IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { maximum_fx( sf_energySum, CLDFB_NO_CHANNELS_MAX, enerBuffer_fx_exp ); FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) { enerBuffer_fx[i] = L_shl( enerBuffer_fx[i], sub( sf_energySum[i], *enerBuffer_fx_exp ) ); move32(); } } IF( NE_16( element_mode, IVAS_CPE_MDCT ) ) /* in MDCT stereo, set_bw_stereo() is used instead */ { Loading Loading @@ -1848,7 +1866,7 @@ static void calculate_energy_buffer_ivas_fx( Word32 enerBuffer_dft_fx[], /* o : energy buffer() exp(enerBuffer_dft_e)*/ const Word16 no_channels, /* i : no. of used CLDFB channels Q0*/ const Word32 input_Fs, /* i : input sampling rate Q0*/ Word16 *enerBuffer_dft_e ) Word16 enerBuffer_dft_e[] ) { Word16 i, j, guard_bits; Word64 nrg_DMX_fx[CLDFB_NO_CHANNELS_MAX]; Loading @@ -1856,11 +1874,8 @@ static void calculate_energy_buffer_ivas_fx( Word32 *pDFT_DMX_fx; /*q_DFT_DMX_fx*/ Word32 chan_width_bins_fx; Word16 band_res_dft_fx, chan_width_f_fx, start, stop; Word16 norm_nrg_DMX_fx; Word64 max_abs_nrg_DMX_fx; Word16 norm_nrg_DMX_fx[CLDFB_NO_CHANNELS_MAX]; max_abs_nrg_DMX_fx = 0; move64(); Word16 temp_q1 = sub( norm_l( input_Fs ), 1 ); Word16 temp_q2 = norm_s( hCPE->hStereoDft->NFFT ); Loading Loading @@ -1892,30 +1907,28 @@ static void calculate_energy_buffer_ivas_fx( *p_nrg_DMX_fx = W_add( *p_nrg_DMX_fx, W_shr( W_mult_32_32( pDFT_DMX_fx[2 * j + 1], pDFT_DMX_fx[2 * j + 1] ), guard_bits ) ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits */ move64(); } IF( GT_64( W_abs( *p_nrg_DMX_fx ), max_abs_nrg_DMX_fx ) ) { max_abs_nrg_DMX_fx = W_abs( *p_nrg_DMX_fx ); } norm_nrg_DMX_fx[i] = W_norm( W_abs( *p_nrg_DMX_fx ) ); move16(); start = stop; move16(); p_nrg_DMX_fx++; } norm_nrg_DMX_fx = W_norm( max_abs_nrg_DMX_fx ); FOR( i = 0; i < no_channels; i++ ) /* Consider only used channels, dependent on Fs */ { enerBuffer_dft_fx[i] = Mpy_32_16_1( W_extract_h( W_shl( nrg_DMX_fx[i], norm_nrg_DMX_fx ) ), 10923 /* 1/3 in Q15 */ ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits + norm_nrg_DMX_fx - 32 */ enerBuffer_dft_fx[i] = Mpy_32_16_1( W_extract_h( W_shl( nrg_DMX_fx[i], norm_nrg_DMX_fx[i] ) ), 10923 /* 1/3 in Q15 */ ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits + norm_nrg_DMX_fx[i] - 32 */ move32(); } *enerBuffer_dft_e = sub( add( shl( hCPE->hStereoDft->DFT_fx_e[0], 1 ), guard_bits ), norm_nrg_DMX_fx ); enerBuffer_dft_e[i] = sub( add( shl( hCPE->hStereoDft->DFT_fx_e[0], 1 ), guard_bits ), norm_nrg_DMX_fx[i] ); move16(); } /* Set remaining entries of enerBuffer to zero */ FOR( ; i < CLDFB_NO_CHANNELS_MAX; i++ ) { enerBuffer_dft_fx[i] = 0; move32(); enerBuffer_dft_e[i] = 0; move16(); } return; } lib_enc/ivas_cpe_enc_fx.c +25 −28 Original line number Diff line number Diff line Loading @@ -127,6 +127,7 @@ ivas_error ivas_cpe_enc_fx( Word16 e_old_wsp[CPE_CHANNELS], q_old_wsp; move16(); // Q_new move16(); // Q_new Word16 q_com; error = IVAS_ERR_OK; move32(); Loading Loading @@ -649,35 +650,31 @@ ivas_error ivas_cpe_enc_fx( hCPE->hStereoDft->Spd_R_smooth_fx_e = sub( hCPE->hStereoDft->Spd_R_smooth_fx_e, temp ); move16(); shift = getScaleFactor16( sts[1]->old_input_signal_fx, input_frame ); Scale_sig( sts[1]->old_input_signal_fx, input_frame, shift ); /* sts[1]->q_old_inp + shift */ sts[1]->q_old_inp = add( sts[1]->q_old_inp, shift ); move16(); shift = getScaleFactor16( sts[1]->input_fx, input_frame ); Copy_Scale_sig_32_16( sts[1]->input32_fx, sts[1]->input_fx, input_frame, sub( add( sts[1]->q_inp, shift ), sts[1]->q_inp32 ) ); /* sts[1]->q_inp + shift */ sts[1]->q_inp = add( sts[1]->q_inp, shift ); move16(); Scale_sig( sts[1]->input_fx, input_frame, sub( s_min( sts[1]->q_inp, sts[1]->q_old_inp ), sts[1]->q_inp ) ); /* min( sts[1]->q_inp, sts[1]->q_old_inp) */ Scale_sig( sts[1]->old_input_signal_fx, input_frame, sub( s_min( sts[1]->q_old_inp, sts[1]->q_inp ), sts[1]->q_old_inp ) ); /* min( sts[1]->q_old_inp, sts[1]->q_inp) */ sts[1]->q_inp = s_min( sts[1]->q_inp, sts[1]->q_old_inp ); move16(); sts[1]->q_old_inp = sts[1]->q_inp; move16(); shift = getScaleFactor16( sts[0]->old_input_signal_fx, input_frame ); Scale_sig( sts[0]->old_input_signal_fx, input_frame, shift ); /* sts[0]->q_old_inp + shift */ sts[0]->q_old_inp = add( sts[0]->q_old_inp, shift ); FOR( n = 0; n < CPE_CHANNELS; n++ ) { q_com = sub( add( L_norm_arr( sts[n]->input32_fx, input_frame ), sts[n]->q_inp32 ), 16 ); q_com = s_min( q_com, add( norm_arr( sts[n]->old_input_signal_fx, input_frame ), sts[n]->q_old_inp ) ); q_com = s_min( q_com, add( norm_arr( hCPE->input_mem_fx[n], hCPE->hStereoDft->dft_ovl ), hCPE->q_input_mem[n] ) ); if ( EQ_16( q_com, Q15 ) ) { q_com = 0; move16(); shift = getScaleFactor16( sts[0]->input_fx, input_frame ); Copy_Scale_sig_32_16( sts[0]->input32_fx, sts[0]->input_fx, input_frame, sub( add( sts[0]->q_inp, shift ), sts[0]->q_inp32 ) ); /* sts[0]->q_inp + shift */ sts[0]->q_inp = add( sts[0]->q_inp, shift ); } Copy_Scale_sig_32_16( sts[n]->input32_fx, sts[n]->input_fx, input_frame, sub( q_com, sts[n]->q_inp32 ) ); sts[n]->q_inp = q_com; move16(); Scale_sig( sts[0]->input_fx, input_frame, sub( s_min( sts[0]->q_inp, sts[0]->q_old_inp ), sts[0]->q_inp ) ); /* min( sts[1]->q_inp, sts[1]->q_old_inp) */ Scale_sig( sts[0]->old_input_signal_fx, input_frame, sub( s_min( sts[0]->q_old_inp, sts[0]->q_inp ), sts[0]->q_old_inp ) ); /* min( sts[1]->q_old_inp, sts[1]->q_inp) */ sts[0]->q_inp = s_min( sts[0]->q_inp, sts[0]->q_old_inp ); scale_sig( sts[n]->old_input_signal_fx, input_frame, sub( q_com, sts[n]->q_old_inp ) ); sts[n]->q_old_inp = q_com; move16(); sts[0]->q_old_inp = sts[0]->q_inp; scale_sig( hCPE->input_mem_fx[n], hCPE->hStereoDft->dft_ovl, sub( q_com, hCPE->q_input_mem[n] ) ); hCPE->q_input_mem[n] = q_com; move16(); } stereo_dft_hybrid_ITD_flag_fx( hCPE->hStereoDft->hConfig, input_Fs, hCPE->hStereoDft->hItd->hybrid_itd_max ); Loading lib_enc/ivas_masa_enc_fx.c +1 −3 Original line number Diff line number Diff line Loading @@ -3979,9 +3979,7 @@ static void quantize_ratio_ism_vector_ivas_fx( FOR( i = 0; i < no_ism_loc; i++ ) { idx[i] = mult( ratio_ism_loc[i], max_sum_idx ); // exponent : ratio_ism_e + 15 move16(); idx[i] = shl( idx[i], sub( add( ratio_ism_e, 15 ), 15 ) ); // Q0 idx[i] = extract_l( L_shr( L_mult0( ratio_ism_loc[i], max_sum_idx ), sub( 15, ratio_ism_e ) ) ); // Q0 move16(); part_idx_sum = add( part_idx_sum, idx[i] ); Loading lib_enc/ivas_stereo_dft_enc_fx.c +4 −13 Original line number Diff line number Diff line Loading @@ -1064,23 +1064,14 @@ void stereo_dft_enc_analyze_fx( Word16 q_shift, guarded_bits; guarded_bits = find_guarded_bits_fx( NFFT ); q_shift = sub( getScaleFactor32( pDFT_L, NFFT ), guarded_bits ); q_shift = s_min( q_shift, sub( getScaleFactor32( pDFT_R, NFFT ), guarded_bits ) ); FOR( Word16 j = 0; j < NFFT; j++ ) { pDFT_L[j] = L_shl( pDFT_L[j], q_shift ); move32(); } q_shift = sub( L_norm_arr( pDFT_L, NFFT ), guarded_bits ); scale_sig32( pDFT_L, NFFT, q_shift ); DFT_e[0] = sub( DFT_e[0], q_shift ); move16(); FOR( Word16 j = 0; j < NFFT; j++ ) { pDFT_R[j] = L_shl( pDFT_R[j], q_shift ); move32(); } q_shift = sub( L_norm_arr( pDFT_R, NFFT ), guarded_bits ); scale_sig32( pDFT_R, NFFT, q_shift ); DFT_e[1] = sub( DFT_e[1], q_shift ); move16(); Loading lib_enc/ivas_stereo_dft_td_itd_fx.c +26 −10 Original line number Diff line number Diff line Loading @@ -380,15 +380,6 @@ void stereo_td_itd_fx( move16(); set16_fx( shift_input, 0, input_frame ); FOR( n = 0; n < CPE_CHANNELS; n++ ) { Scale_sig( &input_mem[n][0], dft_ovl, sts[n]->q_inp - q_input_mem[n] ); // Q(sts[n]->q_inp) // Scale_sig(&sts[n]->old_input_signal_fx, 1965, sts[n]->q_inp - sts[n]->q_old_inp); // sts[n]->q_old_inp = sts[n]->q_inp; q_input_mem[n] = sts[n]->q_inp; move16(); } IF( EQ_16( sts[0]->element_mode, IVAS_CPE_MDCT ) ) { FOR( n = 0; n < CPE_CHANNELS; n++ ) Loading Loading @@ -540,7 +531,7 @@ void stereo_td_itd_mdct_stereo_fx( const Word16 input_frame /* i : frame length */ ) { Word16 i; Word16 i, n, q_com; Word32 bin_nrgL_fx[STEREO_DFT_N_32k_ENC]; Word16 bin_nrgL_e[STEREO_DFT_N_32k_ENC]; Word32 bin_nrgR_fx[STEREO_DFT_N_32k_ENC]; Loading Loading @@ -584,6 +575,31 @@ void stereo_td_itd_mdct_stereo_fx( /*call ITD function*/ stereo_dft_enc_compute_itd_fx( hCPE, DFT_fx[0], DFT_tmp_e[0], DFT_fx[1], DFT_tmp_e[1], STEREO_DFT_OFFSET, input_frame, vad_flag_dtx, vad_hover_flag, bin_nrgL_fx, bin_nrgL_e, bin_nrgR_fx, bin_nrgR_e ); FOR( n = 0; n < CPE_CHANNELS; n++ ) { q_com = add( norm_arr( hCPE->hCoreCoder[n]->input_fx, input_frame ), hCPE->hCoreCoder[n]->q_inp ); q_com = s_min( q_com, add( norm_arr( hCPE->hCoreCoder[n]->old_input_signal_fx, input_frame ), hCPE->hCoreCoder[n]->q_old_inp ) ); q_com = s_min( q_com, add( norm_arr( hCPE->input_mem_fx[n], hStereoMdct->hDft_ana->dft_ovl ), hCPE->q_input_mem[n] ) ); if ( EQ_16( q_com, Q15 ) ) { q_com = 0; move16(); } scale_sig( hCPE->hCoreCoder[n]->input_fx, input_frame, sub( q_com, hCPE->hCoreCoder[n]->q_inp ) ); hCPE->hCoreCoder[n]->q_inp = q_com; move16(); scale_sig( hCPE->hCoreCoder[n]->old_input_signal_fx, input_frame, sub( q_com, hCPE->hCoreCoder[n]->q_old_inp ) ); hCPE->hCoreCoder[n]->q_old_inp = q_com; move16(); scale_sig( hCPE->input_mem_fx[n], hStereoMdct->hDft_ana->dft_ovl, sub( q_com, hCPE->q_input_mem[n] ) ); hCPE->q_input_mem[n] = q_com; move16(); } /* Time Domain ITD compensation using extrapolation */ stereo_td_itd_fx( hStereoMdct->hItd, NULL, NULL, 1, hStereoMdct->hDft_ana->dft_ovl, hCPE->hCoreCoder, input_frame, hCPE->input_mem_fx, hCPE->q_input_mem ); } Loading Loading
lib_enc/ivas_core_pre_proc_front_fx.c +32 −19 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ #define SCE_SMC_THR 16000 static void calculate_energy_buffer_ivas_fx( CPE_ENC_HANDLE hCPE, Word32 enerBuffer_dft[], const Word16 no_channels, const Word32 input_Fs, Word16 *enerBuffer_dft_e ); static void calculate_energy_buffer_ivas_fx( CPE_ENC_HANDLE hCPE, Word32 enerBuffer_dft[], const Word16 no_channels, const Word32 input_Fs, Word16 enerBuffer_dft_e[] ); #ifdef IVAS_FIXED_ENC static void calculate_energy_buffer_fx( CPE_ENC_HANDLE hCPE, Word64 enerBuffer_dft_fx[], Word16 *enerBuffer_dft_q_fx, const Word16 no_channels, const Word32 input_Fs ); Loading Loading @@ -222,6 +222,7 @@ ivas_error pre_proc_front_ivas_fx( Word16 imagBuffer16[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word16 res_cod_SNR_M_fx_e[STEREO_DFT_BAND_MAX]; Word16 Qfact_PS, q_lf_E_fx; Word16 enerBuffer_fx_exp_buf[CLDFB_NO_CHANNELS_MAX]; #ifdef DEBUG_MODE_INFO Word32 *in_buff_temp; Word16 in_q_temp; Loading Loading @@ -482,7 +483,7 @@ ivas_error pre_proc_front_ivas_fx( } ELSE IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { calculate_energy_buffer_ivas_fx( hCPE, enerBuffer_fx, st->cldfbAnaEnc->no_channels, input_Fs, enerBuffer_fx_exp ); calculate_energy_buffer_ivas_fx( hCPE, enerBuffer_fx, st->cldfbAnaEnc->no_channels, input_Fs, enerBuffer_fx_exp_buf ); } ELSE { Loading Loading @@ -849,11 +850,19 @@ ivas_error pre_proc_front_ivas_fx( /*----------------------------------------------------------------* * NB/WB/SWB/FB bandwidth detector *----------------------------------------------------------------*/ IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) { sf_energySum[i] = *enerBuffer_fx_exp; sf_energySum[i] = enerBuffer_fx_exp_buf[i]; move16(); } } ELSE { set16_fx( sf_energySum, *enerBuffer_fx_exp, CLDFB_NO_CHANNELS_MAX ); } test(); IF( st->idchan == 0 && NE_16( element_mode, IVAS_CPE_MDCT ) ) Loading @@ -864,6 +873,15 @@ ivas_error pre_proc_front_ivas_fx( bw_detect_fx( st, input_fx_tmp, NULL, enerBuffer_fx, sf_energySum, ivas_format, 0 ); } IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { maximum_fx( sf_energySum, CLDFB_NO_CHANNELS_MAX, enerBuffer_fx_exp ); FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) { enerBuffer_fx[i] = L_shl( enerBuffer_fx[i], sub( sf_energySum[i], *enerBuffer_fx_exp ) ); move32(); } } IF( NE_16( element_mode, IVAS_CPE_MDCT ) ) /* in MDCT stereo, set_bw_stereo() is used instead */ { Loading Loading @@ -1848,7 +1866,7 @@ static void calculate_energy_buffer_ivas_fx( Word32 enerBuffer_dft_fx[], /* o : energy buffer() exp(enerBuffer_dft_e)*/ const Word16 no_channels, /* i : no. of used CLDFB channels Q0*/ const Word32 input_Fs, /* i : input sampling rate Q0*/ Word16 *enerBuffer_dft_e ) Word16 enerBuffer_dft_e[] ) { Word16 i, j, guard_bits; Word64 nrg_DMX_fx[CLDFB_NO_CHANNELS_MAX]; Loading @@ -1856,11 +1874,8 @@ static void calculate_energy_buffer_ivas_fx( Word32 *pDFT_DMX_fx; /*q_DFT_DMX_fx*/ Word32 chan_width_bins_fx; Word16 band_res_dft_fx, chan_width_f_fx, start, stop; Word16 norm_nrg_DMX_fx; Word64 max_abs_nrg_DMX_fx; Word16 norm_nrg_DMX_fx[CLDFB_NO_CHANNELS_MAX]; max_abs_nrg_DMX_fx = 0; move64(); Word16 temp_q1 = sub( norm_l( input_Fs ), 1 ); Word16 temp_q2 = norm_s( hCPE->hStereoDft->NFFT ); Loading Loading @@ -1892,30 +1907,28 @@ static void calculate_energy_buffer_ivas_fx( *p_nrg_DMX_fx = W_add( *p_nrg_DMX_fx, W_shr( W_mult_32_32( pDFT_DMX_fx[2 * j + 1], pDFT_DMX_fx[2 * j + 1] ), guard_bits ) ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits */ move64(); } IF( GT_64( W_abs( *p_nrg_DMX_fx ), max_abs_nrg_DMX_fx ) ) { max_abs_nrg_DMX_fx = W_abs( *p_nrg_DMX_fx ); } norm_nrg_DMX_fx[i] = W_norm( W_abs( *p_nrg_DMX_fx ) ); move16(); start = stop; move16(); p_nrg_DMX_fx++; } norm_nrg_DMX_fx = W_norm( max_abs_nrg_DMX_fx ); FOR( i = 0; i < no_channels; i++ ) /* Consider only used channels, dependent on Fs */ { enerBuffer_dft_fx[i] = Mpy_32_16_1( W_extract_h( W_shl( nrg_DMX_fx[i], norm_nrg_DMX_fx ) ), 10923 /* 1/3 in Q15 */ ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits + norm_nrg_DMX_fx - 32 */ enerBuffer_dft_fx[i] = Mpy_32_16_1( W_extract_h( W_shl( nrg_DMX_fx[i], norm_nrg_DMX_fx[i] ) ), 10923 /* 1/3 in Q15 */ ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits + norm_nrg_DMX_fx[i] - 32 */ move32(); } *enerBuffer_dft_e = sub( add( shl( hCPE->hStereoDft->DFT_fx_e[0], 1 ), guard_bits ), norm_nrg_DMX_fx ); enerBuffer_dft_e[i] = sub( add( shl( hCPE->hStereoDft->DFT_fx_e[0], 1 ), guard_bits ), norm_nrg_DMX_fx[i] ); move16(); } /* Set remaining entries of enerBuffer to zero */ FOR( ; i < CLDFB_NO_CHANNELS_MAX; i++ ) { enerBuffer_dft_fx[i] = 0; move32(); enerBuffer_dft_e[i] = 0; move16(); } return; }
lib_enc/ivas_cpe_enc_fx.c +25 −28 Original line number Diff line number Diff line Loading @@ -127,6 +127,7 @@ ivas_error ivas_cpe_enc_fx( Word16 e_old_wsp[CPE_CHANNELS], q_old_wsp; move16(); // Q_new move16(); // Q_new Word16 q_com; error = IVAS_ERR_OK; move32(); Loading Loading @@ -649,35 +650,31 @@ ivas_error ivas_cpe_enc_fx( hCPE->hStereoDft->Spd_R_smooth_fx_e = sub( hCPE->hStereoDft->Spd_R_smooth_fx_e, temp ); move16(); shift = getScaleFactor16( sts[1]->old_input_signal_fx, input_frame ); Scale_sig( sts[1]->old_input_signal_fx, input_frame, shift ); /* sts[1]->q_old_inp + shift */ sts[1]->q_old_inp = add( sts[1]->q_old_inp, shift ); move16(); shift = getScaleFactor16( sts[1]->input_fx, input_frame ); Copy_Scale_sig_32_16( sts[1]->input32_fx, sts[1]->input_fx, input_frame, sub( add( sts[1]->q_inp, shift ), sts[1]->q_inp32 ) ); /* sts[1]->q_inp + shift */ sts[1]->q_inp = add( sts[1]->q_inp, shift ); move16(); Scale_sig( sts[1]->input_fx, input_frame, sub( s_min( sts[1]->q_inp, sts[1]->q_old_inp ), sts[1]->q_inp ) ); /* min( sts[1]->q_inp, sts[1]->q_old_inp) */ Scale_sig( sts[1]->old_input_signal_fx, input_frame, sub( s_min( sts[1]->q_old_inp, sts[1]->q_inp ), sts[1]->q_old_inp ) ); /* min( sts[1]->q_old_inp, sts[1]->q_inp) */ sts[1]->q_inp = s_min( sts[1]->q_inp, sts[1]->q_old_inp ); move16(); sts[1]->q_old_inp = sts[1]->q_inp; move16(); shift = getScaleFactor16( sts[0]->old_input_signal_fx, input_frame ); Scale_sig( sts[0]->old_input_signal_fx, input_frame, shift ); /* sts[0]->q_old_inp + shift */ sts[0]->q_old_inp = add( sts[0]->q_old_inp, shift ); FOR( n = 0; n < CPE_CHANNELS; n++ ) { q_com = sub( add( L_norm_arr( sts[n]->input32_fx, input_frame ), sts[n]->q_inp32 ), 16 ); q_com = s_min( q_com, add( norm_arr( sts[n]->old_input_signal_fx, input_frame ), sts[n]->q_old_inp ) ); q_com = s_min( q_com, add( norm_arr( hCPE->input_mem_fx[n], hCPE->hStereoDft->dft_ovl ), hCPE->q_input_mem[n] ) ); if ( EQ_16( q_com, Q15 ) ) { q_com = 0; move16(); shift = getScaleFactor16( sts[0]->input_fx, input_frame ); Copy_Scale_sig_32_16( sts[0]->input32_fx, sts[0]->input_fx, input_frame, sub( add( sts[0]->q_inp, shift ), sts[0]->q_inp32 ) ); /* sts[0]->q_inp + shift */ sts[0]->q_inp = add( sts[0]->q_inp, shift ); } Copy_Scale_sig_32_16( sts[n]->input32_fx, sts[n]->input_fx, input_frame, sub( q_com, sts[n]->q_inp32 ) ); sts[n]->q_inp = q_com; move16(); Scale_sig( sts[0]->input_fx, input_frame, sub( s_min( sts[0]->q_inp, sts[0]->q_old_inp ), sts[0]->q_inp ) ); /* min( sts[1]->q_inp, sts[1]->q_old_inp) */ Scale_sig( sts[0]->old_input_signal_fx, input_frame, sub( s_min( sts[0]->q_old_inp, sts[0]->q_inp ), sts[0]->q_old_inp ) ); /* min( sts[1]->q_old_inp, sts[1]->q_inp) */ sts[0]->q_inp = s_min( sts[0]->q_inp, sts[0]->q_old_inp ); scale_sig( sts[n]->old_input_signal_fx, input_frame, sub( q_com, sts[n]->q_old_inp ) ); sts[n]->q_old_inp = q_com; move16(); sts[0]->q_old_inp = sts[0]->q_inp; scale_sig( hCPE->input_mem_fx[n], hCPE->hStereoDft->dft_ovl, sub( q_com, hCPE->q_input_mem[n] ) ); hCPE->q_input_mem[n] = q_com; move16(); } stereo_dft_hybrid_ITD_flag_fx( hCPE->hStereoDft->hConfig, input_Fs, hCPE->hStereoDft->hItd->hybrid_itd_max ); Loading
lib_enc/ivas_masa_enc_fx.c +1 −3 Original line number Diff line number Diff line Loading @@ -3979,9 +3979,7 @@ static void quantize_ratio_ism_vector_ivas_fx( FOR( i = 0; i < no_ism_loc; i++ ) { idx[i] = mult( ratio_ism_loc[i], max_sum_idx ); // exponent : ratio_ism_e + 15 move16(); idx[i] = shl( idx[i], sub( add( ratio_ism_e, 15 ), 15 ) ); // Q0 idx[i] = extract_l( L_shr( L_mult0( ratio_ism_loc[i], max_sum_idx ), sub( 15, ratio_ism_e ) ) ); // Q0 move16(); part_idx_sum = add( part_idx_sum, idx[i] ); Loading
lib_enc/ivas_stereo_dft_enc_fx.c +4 −13 Original line number Diff line number Diff line Loading @@ -1064,23 +1064,14 @@ void stereo_dft_enc_analyze_fx( Word16 q_shift, guarded_bits; guarded_bits = find_guarded_bits_fx( NFFT ); q_shift = sub( getScaleFactor32( pDFT_L, NFFT ), guarded_bits ); q_shift = s_min( q_shift, sub( getScaleFactor32( pDFT_R, NFFT ), guarded_bits ) ); FOR( Word16 j = 0; j < NFFT; j++ ) { pDFT_L[j] = L_shl( pDFT_L[j], q_shift ); move32(); } q_shift = sub( L_norm_arr( pDFT_L, NFFT ), guarded_bits ); scale_sig32( pDFT_L, NFFT, q_shift ); DFT_e[0] = sub( DFT_e[0], q_shift ); move16(); FOR( Word16 j = 0; j < NFFT; j++ ) { pDFT_R[j] = L_shl( pDFT_R[j], q_shift ); move32(); } q_shift = sub( L_norm_arr( pDFT_R, NFFT ), guarded_bits ); scale_sig32( pDFT_R, NFFT, q_shift ); DFT_e[1] = sub( DFT_e[1], q_shift ); move16(); Loading
lib_enc/ivas_stereo_dft_td_itd_fx.c +26 −10 Original line number Diff line number Diff line Loading @@ -380,15 +380,6 @@ void stereo_td_itd_fx( move16(); set16_fx( shift_input, 0, input_frame ); FOR( n = 0; n < CPE_CHANNELS; n++ ) { Scale_sig( &input_mem[n][0], dft_ovl, sts[n]->q_inp - q_input_mem[n] ); // Q(sts[n]->q_inp) // Scale_sig(&sts[n]->old_input_signal_fx, 1965, sts[n]->q_inp - sts[n]->q_old_inp); // sts[n]->q_old_inp = sts[n]->q_inp; q_input_mem[n] = sts[n]->q_inp; move16(); } IF( EQ_16( sts[0]->element_mode, IVAS_CPE_MDCT ) ) { FOR( n = 0; n < CPE_CHANNELS; n++ ) Loading Loading @@ -540,7 +531,7 @@ void stereo_td_itd_mdct_stereo_fx( const Word16 input_frame /* i : frame length */ ) { Word16 i; Word16 i, n, q_com; Word32 bin_nrgL_fx[STEREO_DFT_N_32k_ENC]; Word16 bin_nrgL_e[STEREO_DFT_N_32k_ENC]; Word32 bin_nrgR_fx[STEREO_DFT_N_32k_ENC]; Loading Loading @@ -584,6 +575,31 @@ void stereo_td_itd_mdct_stereo_fx( /*call ITD function*/ stereo_dft_enc_compute_itd_fx( hCPE, DFT_fx[0], DFT_tmp_e[0], DFT_fx[1], DFT_tmp_e[1], STEREO_DFT_OFFSET, input_frame, vad_flag_dtx, vad_hover_flag, bin_nrgL_fx, bin_nrgL_e, bin_nrgR_fx, bin_nrgR_e ); FOR( n = 0; n < CPE_CHANNELS; n++ ) { q_com = add( norm_arr( hCPE->hCoreCoder[n]->input_fx, input_frame ), hCPE->hCoreCoder[n]->q_inp ); q_com = s_min( q_com, add( norm_arr( hCPE->hCoreCoder[n]->old_input_signal_fx, input_frame ), hCPE->hCoreCoder[n]->q_old_inp ) ); q_com = s_min( q_com, add( norm_arr( hCPE->input_mem_fx[n], hStereoMdct->hDft_ana->dft_ovl ), hCPE->q_input_mem[n] ) ); if ( EQ_16( q_com, Q15 ) ) { q_com = 0; move16(); } scale_sig( hCPE->hCoreCoder[n]->input_fx, input_frame, sub( q_com, hCPE->hCoreCoder[n]->q_inp ) ); hCPE->hCoreCoder[n]->q_inp = q_com; move16(); scale_sig( hCPE->hCoreCoder[n]->old_input_signal_fx, input_frame, sub( q_com, hCPE->hCoreCoder[n]->q_old_inp ) ); hCPE->hCoreCoder[n]->q_old_inp = q_com; move16(); scale_sig( hCPE->input_mem_fx[n], hStereoMdct->hDft_ana->dft_ovl, sub( q_com, hCPE->q_input_mem[n] ) ); hCPE->q_input_mem[n] = q_com; move16(); } /* Time Domain ITD compensation using extrapolation */ stereo_td_itd_fx( hStereoMdct->hItd, NULL, NULL, 1, hStereoMdct->hDft_ana->dft_ovl, hCPE->hCoreCoder, input_frame, hCPE->input_mem_fx, hCPE->q_input_mem ); } Loading