From 8fa52bb7940e5dc3342df8173c19b5333c7ceaaf Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 2 Aug 2024 12:13:08 +0530 Subject: [PATCH] Review comments addressed as mentioned in 3GPP issue 805 --- lib_com/basop_util.c | 23 +- lib_com/fd_cng_com.c | 2 +- lib_com/gs_bitallocation_ivas_fx.c | 2 +- lib_com/hq2_bit_alloc.c | 13 +- lib_com/ivas_cov_smooth.c | 8 +- lib_com/ivas_dirac_com.c | 6 +- lib_com/ivas_fb_mixer.c | 20 +- lib_com/ivas_ism_com.c | 8 +- lib_com/ivas_prot_fx.h | 8 + lib_com/ivas_tools.c | 4 +- lib_com/modif_fs.c | 8 +- lib_com/mslvq_com_fx.c | 19 +- lib_com/prot_fx.h | 14 +- lib_com/tools.c | 280 ++---------------- lib_com/tools_fx.c | 281 ++++++++++++++++++- lib_dec/LD_music_post_filter.c | 5 +- lib_dec/cng_dec_fx.c | 2 +- lib_dec/dec_tcx.c | 16 +- lib_dec/dec_tcx_fx.c | 10 +- lib_dec/igf_dec_fx.c | 2 +- lib_dec/ivas_binRenderer_internal.c | 18 +- lib_dec/ivas_core_dec.c | 68 +++-- lib_dec/ivas_cpe_dec_fx.c | 6 +- lib_dec/ivas_dirac_dec.c | 10 +- lib_dec/ivas_init_dec.c | 2 +- lib_dec/ivas_ism_param_dec.c | 4 +- lib_dec/ivas_ism_renderer.c | 2 +- lib_dec/ivas_jbm_dec.c | 26 +- lib_dec/ivas_ls_custom_dec.c | 2 +- lib_dec/ivas_mct_dec.c | 2 +- lib_dec/ivas_qmetadata_dec.c | 4 +- lib_dec/ivas_range_uni_dec.c | 165 ++++++++++- lib_dec/ivas_sba_dec.c | 8 +- lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 6 +- lib_dec/ivas_sba_rendering_internal.c | 4 +- lib_dec/ivas_stereo_cng_dec.c | 1 + lib_dec/ivas_stereo_dft_dec.c | 4 +- lib_dec/ivas_stereo_dft_dec_fx.c | 12 +- lib_dec/ivas_stereo_mdct_core_dec_fx.c | 2 +- lib_dec/ivas_stereo_td_dec.c | 8 +- lib_dec/lib_dec_fx.c | 2 +- lib_dec/swb_tbe_dec.c | 14 +- lib_dec/swb_tbe_dec_fx.c | 4 +- lib_dec/tonalMDCTconcealment_fx.c | 8 +- lib_dec/waveadjust_fec_dec_fx.c | 6 +- lib_enc/ext_sig_ana_fx.c | 2 +- lib_enc/ivas_enc_cov_handler.c | 10 +- lib_enc/ivas_front_vad.c | 4 +- lib_enc/ivas_stereo_mdct_stereo_enc.c | 4 +- lib_enc/speech_music_classif_fx.c | 6 +- lib_rend/ivas_crend.c | 18 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 12 +- lib_rend/ivas_omasa_ana.c | 4 +- lib_rend/ivas_reverb.c | 13 +- lib_rend/ivas_reverb_delay_line.c | 2 +- lib_rend/ivas_reverb_iir_filter.c | 2 +- lib_rend/ivas_rotation.c | 26 +- lib_rend/ivas_shoebox.c | 7 +- lib_rend/lib_rend.c | 58 ++-- 59 files changed, 756 insertions(+), 531 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index e22f0f6e7..8daae8a03 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -936,13 +936,14 @@ Word32 div_w( Word32 L_num, Word32 L_den ) Word16 iteration; - if ( L_den == (Word32) 0 ) + IF( L_den == 0 ) { /* printf("Division by 0 in div_l, Fatal error in "); printStack(); */ return ( 0 ); } - if ( ( L_num < (Word32) 0 ) || ( L_den < (Word32) 0 ) ) + test(); + IF( ( L_num < 0 ) || ( L_den < 0 ) ) { /* printf("Division Error in div_l, Fatal error in "); printStack(); */ return ( 0 ); @@ -951,24 +952,24 @@ Word32 div_w( Word32 L_num, Word32 L_den ) W_num = W_deposit32_h( L_num ); W_den = W_deposit32_h( L_den ); - if ( W_num >= W_den ) + IF( W_sub( W_num, W_den ) >= 0 ) { return MAX_32; } - else + ELSE { - W_num = W_shr( W_num, (Word16) 1 ); - W_den = W_shr( W_den, (Word16) 1 ); + W_num = W_shr( W_num, 1 ); + W_den = W_shr( W_den, 1 ); - for ( iteration = (Word16) 0; iteration < (Word16) 31; iteration++ ) + FOR( iteration = 0; iteration < 31; iteration++ ) { - L_var_out = L_shl( L_var_out, (Word16) 1 ); - W_num = W_shl( W_num, (Word16) 1 ); + L_var_out = L_shl( L_var_out, 1 ); + W_num = W_shl( W_num, 1 ); - if ( W_num >= W_den ) + IF( W_sub( W_num, W_den ) >= 0 ) { W_num = W_sub( W_num, W_den ); - L_var_out = L_add( L_var_out, (Word32) 1 ); + L_var_out = L_add( L_var_out, 1 ); } } diff --git a/lib_com/fd_cng_com.c b/lib_com/fd_cng_com.c index bf501e2f7..1243cf668 100644 --- a/lib_com/fd_cng_com.c +++ b/lib_com/fd_cng_com.c @@ -109,7 +109,7 @@ void initFdCngCom_flt( set_f( hFdCngCom->A_cng_flt, 0.0f, M + 1 ); hFdCngCom->A_cng_flt[0] = 1.f; #ifdef IVAS_FLOAT_FIXED - set_s( hFdCngCom->A_cng, 0, M + 1 ); + set16_fx( hFdCngCom->A_cng, 0, M + 1 ); hFdCngCom->A_cng[0] = MAX_16; #endif diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c index 6bc6eac23..e13d04495 100644 --- a/lib_com/gs_bitallocation_ivas_fx.c +++ b/lib_com/gs_bitallocation_ivas_fx.c @@ -1044,7 +1044,7 @@ void bands_and_bit_alloc_ivas_fx( } ELSE /* *bit == 0 */ { - set_s( out_bits_per_bands, 0, nb_tot_bands ); + set16_fx( out_bits_per_bands, 0, nb_tot_bands ); *nb_subbands = 0; move16(); *pvq_len = 0; diff --git a/lib_com/hq2_bit_alloc.c b/lib_com/hq2_bit_alloc.c index 3653ffea8..3b1cda25d 100644 --- a/lib_com/hq2_bit_alloc.c +++ b/lib_com/hq2_bit_alloc.c @@ -38,6 +38,7 @@ #include "options.h" #include #include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "basop_util.h" #include "stl.h" @@ -61,7 +62,7 @@ #define BITS_FACT_0p92 ( Word16 )( 0.92f * (float) pow( 2, Qbf ) + 0.5f ) #define L_Comp( hi, lo ) L_mac( L_deposit_h( hi ), lo, 1 ) - +#if 0 // functions already present in hq2_bit_alloc_fx.c /*------------------------------------------------------------------- * div_s_ss() * @@ -308,7 +309,7 @@ static void Bits2indvsb_fx( return; } - +#endif /*-------------------------------------------------------------------* * hq2_bit_alloc_har() * @@ -388,7 +389,7 @@ void hq2_bit_alloc_har( L_THR2 = L_shl( L_deposit_l( THR2 ), SWB_BWE_LR_QRk ); L_THR3 = L_shl( L_deposit_l( THR3 ), SWB_BWE_LR_QRk ); - set_val_Word16( Bits_grp_fx, 0, GRP_SB ); + set16_fx( Bits_grp_fx, 0, GRP_SB ); /* Initialize subbands bits allocation vector based on harmonic bands */ harmonic_band_fx = add( sub( N_fx, p2a_bands_fx ), 1 ); @@ -739,10 +740,10 @@ void hq2_bit_alloc_har( } ELSE { - set_val_Word32( L_Rsubband + grp_bound_fx[i], 0x0L, sub( grp_bound_fx[i + 1], grp_bound_fx[i] ) ); + set32_fx( L_Rsubband + grp_bound_fx[i], 0x0L, sub( grp_bound_fx[i + 1], grp_bound_fx[i] ) ); IF( sub( i, GRP_SB - 1 ) == 0 ) { - set_val_Word16( p2a_flags_fx + grp_bound_fx[i], 0, sub( grp_bound_fx[i + 1], grp_bound_fx[i] ) ); + set16_fx( p2a_flags_fx + grp_bound_fx[i], 0, sub( grp_bound_fx[i + 1], grp_bound_fx[i] ) ); } } } @@ -803,7 +804,7 @@ void hq2_bit_alloc( /* Init Rk to non-zero values for bands to be allocated bits */ IF( sub( num_bits, HQ_16k40_BIT ) <= 0 ) { - set_val_Word32( L_Rk, (Word32) ( C1_QRk ), bands ); /* 1<q_cov_real_per_band[i][j], Q31, cov_smooth_cfg->max_bands ); + set16_fx( hCovState->q_cov_real_per_band[i][j], Q31, cov_smooth_cfg->max_bands ); } } @@ -493,7 +493,7 @@ static void ivas_compute_smooth_cov_fx( { FOR( j = 0; j < num_ch; j++ ) { - set_s( hCovState->q_cov_real_per_band[i][j], q_cov[i][j], pFb->filterbank_num_bands ); + set16_fx( hCovState->q_cov_real_per_band[i][j], q_cov[i][j], pFb->filterbank_num_bands ); } } FOR( i = 0; i < num_ch; i++ ) @@ -524,7 +524,7 @@ static void ivas_compute_smooth_cov_fx( move32(); } - set_s( q_tmp, q_cov[i][j], sub( end_band, start_band ) ); + set16_fx( q_tmp, q_cov[i][j], sub( end_band, start_band ) ); FOR( k = start_band; k < non_sm_b_idx; k++ ) { L_tmp = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], pCov_buf[i][j][k] ); // (Q31, q_cov[i][j]) -> q_cov[i][j] @@ -707,7 +707,7 @@ void ivas_cov_smooth_process_fx( { FOR( j = 0; j < num_ch; j++ ) { - mvl2l( &cov_real[i][j][start_band], &hCovState->pPrior_cov_real_fx[i][j][start_band], num_bands ); + Copy32( &cov_real[i][j][start_band], &hCovState->pPrior_cov_real_fx[i][j][start_band], num_bands ); } } diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index cce2880bd..c265cad78 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -1238,9 +1238,9 @@ void computeDiffuseness_fx( /* Compute Intensity slow and energy slow */ - set_val_Word32( intensity_slow, 0, DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX ); - set_val_Word32( intensity_slow_abs, 0, CLDFB_NO_CHANNELS_MAX ); - set_val_Word32( energy_slow, 0, CLDFB_NO_CHANNELS_MAX ); + set32_fx( intensity_slow, 0, DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX ); + set32_fx( intensity_slow_abs, 0, CLDFB_NO_CHANNELS_MAX ); + set32_fx( energy_slow, 0, CLDFB_NO_CHANNELS_MAX ); FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; ++i ) { diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index d448ed8de..d3fd6af80 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -726,8 +726,8 @@ ivas_error ivas_FB_mixer_open_fx( } hFbMixer->fb_cfg = fb_cfg; - set_s( hFbMixer->first_frame, 1, hFbMixer->fb_cfg->num_out_chans ); - set_s( hFbMixer->first_frame + hFbMixer->fb_cfg->num_out_chans, 0, sub( IVAS_SPAR_MAX_CH, hFbMixer->fb_cfg->num_out_chans ) ); + set16_fx( hFbMixer->first_frame, 1, hFbMixer->fb_cfg->num_out_chans ); + set16_fx( hFbMixer->first_frame + hFbMixer->fb_cfg->num_out_chans, 0, sub( IVAS_SPAR_MAX_CH, hFbMixer->fb_cfg->num_out_chans ) ); IF( !spar_reconfig_flag ) { @@ -1557,7 +1557,7 @@ static int16_t ivas_calculate_abs_fr( /*loop over all stored Filter Bank Response MDFT coefficients*/ set_f( short_stride_pow_spec, 0, MDFT_FB_BANDS_240 ); #ifdef IVAS_FLOAT_FIXED - set_l( short_stride_pow_spec_fx, 0, MDFT_FB_BANDS_240 ); + set32_fx( short_stride_pow_spec_fx, 0, MDFT_FB_BANDS_240 ); #endif for ( j = start_offset; j < num_bins + start_offset; j++ ) { @@ -1677,7 +1677,7 @@ static int16_t ivas_calculate_abs_fr( set_f( ppFilterbank_FRs_s, 0, frame_len ); #ifdef IVAS_FLOAT_FIXED - set_l( ppFilterbank_FRs_s_fx, 0, frame_len ); + set32_fx( ppFilterbank_FRs_s_fx, 0, frame_len ); #endif /*Commented logic is for calculating number of active bands, can be removed if not needed */ @@ -1814,7 +1814,7 @@ static Word16 ivas_calculate_abs_fr_fx( /*loop over all stored Filter Bank Response MDFT coefficients*/ - set_l( short_stride_pow_spec_fx, 0, MDFT_FB_BANDS_240 ); + set32_fx( short_stride_pow_spec_fx, 0, MDFT_FB_BANDS_240 ); FOR( j = start_offset; j < num_bins + start_offset; j++ ) { @@ -1976,7 +1976,7 @@ static Word16 ivas_calculate_abs_fr_fx( frame_len = BASOP_Util_Divide3232_Scale( sampling_rate, FRAMES_PER_SEC, &exp ); frame_len = shr( frame_len, sub( 15, exp ) ); - set_l( ppFilterbank_FRs_s_fx, 0, frame_len ); + set32_fx( ppFilterbank_FRs_s_fx, 0, frame_len ); /*Commented logic is for calculating number of active bands, can be removed if not needed */ FOR( i = 0; i < bands; i++ ) @@ -2206,7 +2206,7 @@ static ivas_error ivas_filterbank_setup( pFb->fb_bin_to_band.short_stride = (int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / 4 ); set_f( pFb->fb_bin_to_band.p_short_stride_bin_to_band, 0.0f, 2 * MDFT_FB_BANDS_240 ); #ifdef IVAS_FLOAT_FIXED - set_l( pFb->fb_bin_to_band.p_short_stride_bin_to_band_fx, 0, 2 * MDFT_FB_BANDS_240 ); + set32_fx( pFb->fb_bin_to_band.p_short_stride_bin_to_band_fx, 0, 2 * MDFT_FB_BANDS_240 ); #endif set_s( pFb->fb_bin_to_band.p_cldfb_map_to_spar_band, 0, CLDFB_NO_CHANNELS_MAX ); set_s( pFb->fb_bin_to_band.p_spar_start_bands, 0, CLDFB_NO_CHANNELS_MAX ); @@ -2385,10 +2385,10 @@ static ivas_error ivas_filterbank_setup_fx( move16(); - set_l( pFb->fb_bin_to_band.p_short_stride_bin_to_band_fx, 0, 2 * MDFT_FB_BANDS_240 ); + set32_fx( pFb->fb_bin_to_band.p_short_stride_bin_to_band_fx, 0, 2 * MDFT_FB_BANDS_240 ); - set_s( pFb->fb_bin_to_band.p_cldfb_map_to_spar_band, 0, CLDFB_NO_CHANNELS_MAX ); - set_s( pFb->fb_bin_to_band.p_spar_start_bands, 0, CLDFB_NO_CHANNELS_MAX ); + set16_fx( pFb->fb_bin_to_band.p_cldfb_map_to_spar_band, 0, CLDFB_NO_CHANNELS_MAX ); + set16_fx( pFb->fb_bin_to_band.p_spar_start_bands, 0, CLDFB_NO_CHANNELS_MAX ); FOR( j = 0; j < IVAS_MAX_NUM_FB_BANDS; j++ ) { diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index 6a287d2da..8935bc904 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -468,7 +468,7 @@ ivas_error ivas_ism_config_fx( // bits_ism = (Word16) ( ism_total_brate / FRAMES_PER_SEC ); bits_ism = (Word16) Mpy_32_32( 42949673, ism_total_brate ); tmp1 = BASOP_Util_Divide1616_Scale( bits_ism, n_ISms, &exp ); - set_s( bits_element, shr( tmp1, sub( 15, exp ) ), n_ISms ); + set16_fx( bits_element, shr( tmp1, sub( 15, exp ) ), n_ISms ); bits_element[n_ISms - 1] = add( bits_element[n_ISms - 1], bits_ism % n_ISms ); move16(); @@ -482,7 +482,7 @@ ivas_error ivas_ism_config_fx( //(Q31 +Q0) - Q31 --> Q0 bits_ism = (Word16) Mpy_32_32( 42949673, ism_total_brate ); tmp1 = BASOP_Util_Divide1616_Scale( bits_ism, n_ISms, &exp ); - set_s( bits_element, shr( tmp1, sub( 15, exp ) ), n_ISms ); + set16_fx( bits_element, shr( tmp1, sub( 15, exp ) ), n_ISms ); bits_element[n_ISms - 1] = add( bits_element[n_ISms - 1], bits_ism % n_ISms ); move16(); bitbudget_to_brate( bits_element, element_brate, n_ISms ); @@ -535,7 +535,7 @@ ivas_error ivas_ism_config_fx( { bits_side = sum_s( nb_bits_metadata, n_ISms ); tmp1 = BASOP_Util_Divide1616_Scale( bits_side, n_ISms, &exp ); - set_s( nb_bits_metadata, shr( tmp1, ( 15 - exp ) ), n_ISms ); + set16_fx( nb_bits_metadata, shr( tmp1, ( 15 - exp ) ), n_ISms ); nb_bits_metadata[n_ISms - 1] = add( nb_bits_metadata[n_ISms - 1], bits_side % n_ISms ); move16(); v_sub_s( bits_element, nb_bits_metadata, bits_CoreCoder, n_ISms ); @@ -549,7 +549,7 @@ ivas_error ivas_ism_config_fx( { Word16 diff, n_higher, flag_higher[MAX_NUM_OBJECTS]; - set_s( flag_higher, 1, MAX_NUM_OBJECTS ); + set16_fx( flag_higher, 1, MAX_NUM_OBJECTS ); diff = 0; move16(); diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 8ed4fd451..07d63e7c4 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -2569,3 +2569,11 @@ void ivas_spar_bitrate_dist_fx( const Word16 sba_order, /* i : Ambisonic (SBA) order */ const Word16 bwidth /* i : audio bandwidth */ ); + +void tdm_configure_dec_fx( + const Word16 ivas_format, /* i : IVAS format */ + const Word16 ism_mode, /* i : ISM mode in combined format */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word16 *tdm_ratio_idx, /* o : ratio index */ + const Word16 nb_bits_metadata /* i : number of metadata bits */ +); diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index 6fecaa54f..45ce29585 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -948,7 +948,7 @@ void v_mult_mat_fixed( pt_y++; } - mvr2r_Word32( tmp_y, y, Nc ); + Copy32( tmp_y, y, Nc ); } Word32 dot_product_cholesky_fx( const Word32 *x, /* i : vector x */ @@ -1050,7 +1050,7 @@ void v_mult_mat_fx( pt_y_fx++; } - mvr2r_Word32( tmp_y_fx, y_fx, Nc ); + Copy32( tmp_y_fx, y_fx, Nc ); return; } diff --git a/lib_com/modif_fs.c b/lib_com/modif_fs.c index 73a08dd32..4df5f351d 100644 --- a/lib_com/modif_fs.c +++ b/lib_com/modif_fs.c @@ -601,9 +601,9 @@ void Interpolate_allpass_steep_32( move32(); } - out_fx[2 * k + 1] = L_add( mem_fx[ALLPASSSECTIONS_STEEP - 1], Mpy_32_16_1( temp_fx[ALLPASSSECTIONS_STEEP - 2], AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); + out_fx[add( shl( k, 1 ), 1 )] = L_add( mem_fx[ALLPASSSECTIONS_STEEP - 1], Mpy_32_16_1( temp_fx[ALLPASSSECTIONS_STEEP - 2], AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); move32(); - mem_fx[ALLPASSSECTIONS_STEEP - 1] = L_sub( temp_fx[ALLPASSSECTIONS_STEEP - 2], Mpy_32_16_1( out_fx[2 * k + 1], AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); + mem_fx[ALLPASSSECTIONS_STEEP - 1] = L_sub( temp_fx[ALLPASSSECTIONS_STEEP - 2], Mpy_32_16_1( out_fx[add( shl( k, 1 ), 1 )], AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); move32(); } @@ -780,9 +780,9 @@ void Decimate_allpass_steep_fx32( FOR( k = 1; k < N / 2; k++ ) { - temp[0] = L_add( mem[ALLPASSSECTIONS_STEEP], Mpy_32_16_1( in[2 * k - 1], AP2_STEEP_FX[0] ) ); + temp[0] = L_add( mem[ALLPASSSECTIONS_STEEP], Mpy_32_16_1( in[sub( shl( k, 1 ), 1 )], AP2_STEEP_FX[0] ) ); move32(); - mem[ALLPASSSECTIONS_STEEP] = L_sub( in[2 * k - 1], Mpy_32_16_1( temp[0], AP2_STEEP_FX[0] ) ); + mem[ALLPASSSECTIONS_STEEP] = L_sub( in[sub( shl( k, 1 ), 1 )], Mpy_32_16_1( temp[0], AP2_STEEP_FX[0] ) ); move32(); /* for better performance, unroll this loop */ diff --git a/lib_com/mslvq_com_fx.c b/lib_com/mslvq_com_fx.c index cce159738..bb1913497 100644 --- a/lib_com/mslvq_com_fx.c +++ b/lib_com/mslvq_com_fx.c @@ -1250,13 +1250,13 @@ void deindex_lvq_SHB_fx( IF( mode == 0 ) { - p_no_lead = &no_lead_BWE[( nbits - mslvq_SHB_min_bits[0] ) * 3]; - p_scales = &scales_BWE_fx[( nbits - mslvq_SHB_min_bits[0] ) * 3]; + p_no_lead = &no_lead_BWE[i_mult( sub( nbits, mslvq_SHB_min_bits[0] ), 3 )]; + p_scales = &scales_BWE_fx[i_mult( sub( nbits, mslvq_SHB_min_bits[0] ), 3 )]; } ELSE { - p_no_lead = &no_lead_BWE_3b[( nbits - mslvq_SHB_min_bits[1] ) * 3]; - p_scales = &scales_BWE_3b_fx[( nbits - mslvq_SHB_min_bits[1] ) * 3]; + p_no_lead = &no_lead_BWE_3b[i_mult( sub( nbits, mslvq_SHB_min_bits[1] ), 3 )]; + p_scales = &scales_BWE_3b_fx[i_mult( sub( nbits, mslvq_SHB_min_bits[1] ), 3 )]; } @@ -1271,14 +1271,16 @@ void deindex_lvq_SHB_fx( move32(); FOR( i = 0; i < MAX_NO_SCALES; i++ ) { - offsets[i + 1] = table_no_cv[p_no_lead[i]] + offsets[i]; + offsets[i + 1] = UL_addNsD( table_no_cv[p_no_lead[i]], offsets[i] ); move32(); } /* find idx_scale */ idx_scale = 0; - WHILE( (Word16) i <= MAX_NO_SCALES && index >= offsets[idx_scale] ) + test(); + WHILE( LE_32( i, MAX_NO_SCALES ) && index >= offsets[idx_scale] ) { + test(); idx_scale = add( idx_scale, 1 ); } idx_scale = sub( idx_scale, 1 ); @@ -1286,6 +1288,7 @@ void deindex_lvq_SHB_fx( /* find idx_leader */ i = 1; + move16(); WHILE( GT_32( index, table_no_cv[i] ) ) { i = add( i, 1 ); @@ -1295,15 +1298,17 @@ void deindex_lvq_SHB_fx( decode_comb_fx( (Word32) ( L_sub( L_sub( index, table_no_cv[i] ), 1 ) ), out, i ); scale = p_scales[idx_scale]; + move16(); FOR( i = 0; i < LATTICE_DIM; i++ ) { - Word32 temp = Mpy_32_16_1( sigma_BWE_fx[mode * LATTICE_DIM + i], scale ); + Word32 temp = Mpy_32_16_1( sigma_BWE_fx[add( i_mult( mode, LATTICE_DIM ), i )], scale ); temp = Mpy_32_16_1( temp, out[i] ); #ifndef FIX_800_PROPOSAL_HB_LPC_COEFFICIENT out[i] = extract_h( temp ); #else out[i] = extract_l( temp ); /* Q15 output*/ #endif + move16(); // out[i] *= scale * sigma_BWE_fx[mode * LATTICE_DIM + i]; } } diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 0d62a9f29..68a89424e 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -50,9 +50,6 @@ #define dynamic_calloc( n1, n2 ) calloc( n1, n2 ) #define dynamic_free( n1 ) free( n1 ) -#define mvr2r_Word32( x, y, n ) Copy32( x, y, n ) -#define mvr2r_Word16( x, y, n ) Copy( x, y, n ) - #include #include #include @@ -9288,11 +9285,11 @@ void ivas_bw_switching_pre_proc_fx( Word16 Q, Word16 Q_audio ); -uint32_t mvl2s_r( +UWord32 mvl2s_r( const Word32 x[], /* i : input vector */ const Word16 q, - int16_t y[], /* o : output vector */ - const int16_t n /* i : vector size */ + Word16 y[], /* o : output vector */ + const Word16 n /* i : vector size */ ); void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, @@ -9426,6 +9423,11 @@ Word16 mean_fx( /* o : mean of vector const Word16 lvec_fx /* i : length of i vector */ ); +void sort( + UWord16 *x, /* i/o: Vector to be sorted */ + UWord16 len /* i/o: vector length */ +); + void sort_fx( Word16 *r, /* i/o: Vector to be sorted in place */ Word16 lo, /* i : Low limit of sorting range */ diff --git a/lib_com/tools.c b/lib_com/tools.c index dc2ee58fb..64de07a75 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -387,29 +387,7 @@ void set_f( return; } -#ifdef IVAS_FLOAT_FIXED -/*---------------------------------------------------------------------* - * set_zero() - * - * Set a vector vec[] of dimension lvec to zero - *---------------------------------------------------------------------*/ -void set_zero_fx( - Word32 *vec, /* o : input vector */ - const Word16 lvec /* i : length of the vector */ -) -{ - Word16 i; - - FOR( i = 0; i < lvec; i++ ) - { - *vec++ = 0; - move32(); - } - - return; -} -#endif /*---------------------------------------------------------------------* * set_zero() * @@ -569,78 +547,6 @@ uint32_t mvr2s( return noClipping; } -#ifdef IVAS_FLOAT_FIXED -UWord32 mvl2s_r( - const Word32 x[], /* i : input vector */ - const Word16 q_x, - Word16 y[], /* o : output vector */ - const Word16 n /* i : vector size */ -) -{ - Word16 i; - Word32 temp; - UWord32 noClipping = 0; - move32(); - - IF( n <= 0 ) - { - /* cannot transfer vectors with size 0 */ - return 0; - } - - IF( (void *) y <= (const void *) x ) - { - FOR( i = 0; i < n; i++ ) - { - temp = L_shr( x[i], sub( q_x, 1 ) ); - temp = L_shr( L_add( temp, 1 ), 1 ); - - IF( GT_32( temp, MAX16B ) ) - { - temp = MAX16B; - move32(); - noClipping = L_add( (Word32) noClipping, 1 ); - } - ELSE IF( LT_32( temp, MIN16B ) ) - { - temp = MIN16B; - move32(); - noClipping = L_add( (Word32) noClipping, 1 ); - } - - y[i] = extract_l( temp ); - move16(); - } - } - ELSE - { - FOR( i = n - 1; i >= 0; i-- ) - { - temp = L_shr( x[i], q_x - 1 ); - temp = L_shr( L_add( temp, 1 ), 1 ); - - IF( GT_32( temp, MAX16B ) ) - { - temp = MAX16B; - move32(); - noClipping = L_add( (Word32) noClipping, 1 ); - } - ELSE IF( LT_32( temp, MIN16B ) ) - { - temp = MIN16B; - move32(); - noClipping = L_add( (Word32) noClipping, 1 ); - } - - y[i] = extract_l( temp ); - move16(); - } - } - - return noClipping; -} -#endif - void mvs2r( const int16_t x[], /* i : input vector */ float y[], /* o : output vector */ @@ -1132,49 +1038,6 @@ Word32 dotp_fixed( return suma; } -#ifdef IVAS_FLOAT_FIXED -Word32 dotp_me_fx( - const Word32 x[], /* i : vector x[] */ - const Word32 y[], /* i : vector y[] */ - const Word16 n, /* i : vector length */ - Word16 exp_x, - Word16 exp_y, - Word16 *exp_suma ) -{ - Word16 i; - Word32 suma; - Word32 mul; - Word16 mul_exp = add( exp_x, exp_y ); - suma = Mpy_32_32( x[0], y[0] ); - *exp_suma = mul_exp; - FOR( i = 1; i < n; i++ ) - { - mul = Mpy_32_32( x[i], y[i] ); - suma = BASOP_Util_Add_Mant32Exp( suma, *exp_suma, mul, mul_exp, exp_suma ); // exp_x+exp_A - } - - return suma; -} -Word32 dotp_fixed_guarded( - const Word32 x[], /* i : vector x[] */ - const Word32 y[], /* i : vector y[] */ - const Word16 n /* i : vector length */ -) -{ - Word16 i; - Word32 suma; - Word16 guarded_bits = find_guarded_bits_fx( n ); - suma = L_shr( Mpy_32_32( x[0], y[0] ), guarded_bits ); - - FOR( i = 1; i < n; i++ ) - { - suma = L_add( suma, L_shr( Mpy_32_32( x[i], y[i] ), guarded_bits ) ); - } - - return suma; -} -#endif - /*To calculate dot product of two 32 bit arrays in case of overflow*/ Word32 dotp_fixed_o( const Word32 x[], /* i : vector x[] */ @@ -1357,58 +1220,6 @@ void v_add( return; } -/*-------------------------------------------------------------------* - * v_add_fixed() - * - * Subtraction of two vectors sample by sample - *-------------------------------------------------------------------*/ - -void v_add_fixed( - const Word32 x1[], /* i : Input vector 1 */ - const Word32 x2[], /* i : Input vector 2 */ - Word32 y[], /* o : Output vector that contains vector 1 - vector 2 */ - const Word16 N, /* i : Vector length */ - const Word16 hdrm /* i : headroom for when subtraction result > 1 or < -1 */ -) -{ - Word16 i; - - FOR( i = 0; i < N; i++ ) - { - y[i] = L_add( L_shr( x1[i], hdrm ), L_shr( x2[i], hdrm ) ); - move32(); - } - - return; -} - -void v_add_fixed_me( - const Word32 x1[], /* i : Input vector 1 */ - const Word16 x1_e, /* i : Exponent for input vector 1 */ - const Word32 x2[], /* i : Input vector 2 */ - const Word16 x2_e, /* i : Exponent for input vector 2 */ - Word32 y[], /* o : Output vector that contains vector 1 - vector 2 */ - Word16 *y_e, /* i : Exponent for output vector */ - const Word16 N, /* i : Vector length */ - const Word16 hdrm /* i : headroom for when subtraction result > 1 or < -1 */ -) -{ - Word16 i; - Word16 x1_shift = sub( s_max( x1_e, x2_e ), x1_e ); - Word16 x2_shift = sub( s_max( x1_e, x2_e ), x2_e ); - - FOR( i = 0; i < N; i++ ) - { - y[i] = L_add( L_shr( x1[i], hdrm + x1_shift ), L_shr( x2[i], hdrm + x2_shift ) ); - move32(); - } - - *y_e = add( s_max( x1_e, x2_e ), hdrm ); - move16(); - - return; -} - /*-------------------------------------------------------------------* * v_add_w64() @@ -1489,25 +1300,6 @@ void v_sub_fixed( * * Multiplication of two vectors *-------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -void v_mult_fixed( - const Word32 x1[], /* i : Input vector 1 */ - const Word32 x2[], /* i : Input vector 2 */ - Word32 y[], /* o : Output vector that contains vector 1 .* vector 2 */ - const Word16 N /* i : Vector length */ -) -{ - Word16 i; - - FOR( i = 0; i < N; i++ ) - { - y[i] = Mpy_32_32( x1[i], x2[i] ); - move32(); - } - - return; -} -#endif void v_mult( const float x1[], /* i : Input vector 1 */ @@ -1939,19 +1731,22 @@ void v_sort_float( return; } +#ifdef IVAS_FLOAT_FIXED void sort( - uint16_t *x, /* i/o: Vector to be sorted */ - uint16_t len /* i/o: vector length */ + UWord16 *x, /* i/o: Vector to be sorted */ + UWord16 len /* i/o: vector length */ ) { - int16_t i; - uint16_t j, tempr; + Word16 i; + UWord16 j, tempr; - for ( i = len - 2; i >= 0; i-- ) + FOR( i = sub( len, 2 ); i >= 0; i-- ) { tempr = x[i]; - for ( j = i + 1; ( j < len ) && ( tempr > x[j] ); j++ ) + test(); + FOR( j = add( i, 1 ); ( j < len ) && ( tempr > x[j] ); j++ ) { + test(); x[j - 1] = x[j]; } x[j - 1] = tempr; @@ -1959,29 +1754,28 @@ void sort( return; } - -void sort_l( - Word32 *x, /* i/o: Vector to be sorted */ - Word16 len /* i/o: vector length */ +#else +void sort( + uint16_t *x, /* i/o: Vector to be sorted */ + uint16_t len /* i/o: vector length */ ) { - Word16 i, j; - Word32 tempr; + int16_t i; + uint16_t j, tempr; - FOR( i = len - 2; i >= 0; i-- ) + for ( i = len - 2; i >= 0; i-- ) { tempr = x[i]; - FOR( j = i + 1; ( j < len ) && ( tempr > x[j] ); j++ ) + for ( j = i + 1; ( j < len ) && ( tempr > x[j] ); j++ ) { x[j - 1] = x[j]; - move32(); } x[j - 1] = tempr; - move32(); } return; } +#endif /*---------------------------------------------------------------------* * var() @@ -2362,44 +2156,6 @@ double anint( return ( x ) >= 0 ? (int32_t) ( ( x ) + 0.5 ) : (int32_t) ( (x) -0.5 ); } -/*-------------------------------------------------------------------* - * anint_fixed() - * - * Round to the nearest integer. - *-------------------------------------------------------------------*/ -Word32 anint_fixed( Word32 x, Word16 exp ) -{ - IF( EQ_32( x, 0 ) ) - { - return 0; - } - IF( GE_32( x, 0 ) ) - { - return L_add( x, L_shl( 1, exp - 1 ) ); - } - ELSE - { - return L_sub( x, L_shl( 1, exp - 1 ) ); - } -} - -/*-------------------------------------------------------------------* - * ceil_fixed() - * - * Ceil to the next multiple of (1 << exp). - *-------------------------------------------------------------------*/ -Word32 ceil_fixed( Word32 x, Word16 exp ) -{ - Word32 step; - // step = x / L_shl( 1, exp ); - step = L_shr( x, exp ); - if ( ( x % L_shl( 1, exp ) ) > 0 ) - { - step = L_add( step, 1 ); - } - return L_shl( step, exp ); -} - /*-------------------------------------------------------------------* * is_numeric_float() * diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 919da71e3..914f05a02 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -2429,7 +2429,7 @@ void v_add_32( { Word16 i; - for ( i = 0; i < N; i++ ) + FOR( i = 0; i < N; i++ ) { y[i] = L_add( x1[i], x2[i] ); move32(); @@ -2447,7 +2447,7 @@ void v_shr_32( { Word16 i; - for ( i = 0; i < N; i++ ) + FOR( i = 0; i < N; i++ ) { y[i] = L_shr( x1[i], shift ); move32(); @@ -2497,7 +2497,7 @@ void v_add_16( { Word16 i; - for ( i = 0; i < N; i++ ) + FOR( i = 0; i < N; i++ ) { y[i] = add_sat( x1[i], x2[i] ); move16(); @@ -2522,7 +2522,7 @@ void v_sub_16( { Word16 i; - for ( i = 0; i < N; i++ ) + FOR( i = 0; i < N; i++ ) { y[i] = sub_sat( x1[i], x2[i] ); move16(); @@ -4093,3 +4093,276 @@ void v_mult16_fixed( return; } + +/*---------------------------------------------------------------------* + * set_zero() + * + * Set a vector vec[] of dimension lvec to zero + *---------------------------------------------------------------------*/ + +void set_zero_fx( + Word32 *vec, /* o : input vector */ + const Word16 lvec /* i : length of the vector */ +) +{ + Word16 i; + + FOR( i = 0; i < lvec; i++ ) + { + *vec++ = 0; + move32(); + } + + return; +} + +UWord32 mvl2s_r( + const Word32 x[], /* i : input vector */ + const Word16 q_x, + Word16 y[], /* o : output vector */ + const Word16 n /* i : vector size */ +) +{ + Word16 i; + Word32 temp; + UWord32 noClipping = 0; + move32(); + + IF( n <= 0 ) + { + /* cannot transfer vectors with size 0 */ + return 0; + } + + IF( (void *) y <= (const void *) x ) + { + FOR( i = 0; i < n; i++ ) + { + temp = L_shr( x[i], sub( q_x, 1 ) ); + temp = L_shr( L_add( temp, 1 ), 1 ); + + IF( GT_32( temp, MAX16B ) ) + { + temp = MAX16B; + move32(); + noClipping = L_add( (Word32) noClipping, 1 ); + } + ELSE IF( LT_32( temp, MIN16B ) ) + { + temp = MIN16B; + move32(); + noClipping = L_add( (Word32) noClipping, 1 ); + } + + y[i] = extract_l( temp ); + move16(); + } + } + ELSE + { + FOR( i = n - 1; i >= 0; i-- ) + { + temp = L_shr( x[i], sub( q_x, 1 ) ); + temp = L_shr( L_add( temp, 1 ), 1 ); + + IF( GT_32( temp, MAX16B ) ) + { + temp = MAX16B; + move32(); + noClipping = L_add( (Word32) noClipping, 1 ); + } + ELSE IF( LT_32( temp, MIN16B ) ) + { + temp = MIN16B; + move32(); + noClipping = L_add( (Word32) noClipping, 1 ); + } + + y[i] = extract_l( temp ); + move16(); + } + } + + return noClipping; +} + +#ifdef IVAS_FLOAT_FIXED +Word32 dotp_me_fx( + const Word32 x[], /* i : vector x[] */ + const Word32 y[], /* i : vector y[] */ + const Word16 n, /* i : vector length */ + Word16 exp_x, + Word16 exp_y, + Word16 *exp_suma ) +{ + Word16 i; + Word32 suma; + Word32 mul; + Word16 mul_exp = add( exp_x, exp_y ); + suma = Mpy_32_32( x[0], y[0] ); + *exp_suma = mul_exp; + FOR( i = 1; i < n; i++ ) + { + mul = Mpy_32_32( x[i], y[i] ); + suma = BASOP_Util_Add_Mant32Exp( suma, *exp_suma, mul, mul_exp, exp_suma ); // exp_x+exp_A + } + + return suma; +} + +Word32 dotp_fixed_guarded( + const Word32 x[], /* i : vector x[] */ + const Word32 y[], /* i : vector y[] */ + const Word16 n /* i : vector length */ +) +{ + Word16 i; + Word32 suma; + Word16 guarded_bits = find_guarded_bits_fx( n ); + suma = L_shr( Mpy_32_32( x[0], y[0] ), guarded_bits ); + + FOR( i = 1; i < n; i++ ) + { + suma = L_add( suma, L_shr( Mpy_32_32( x[i], y[i] ), guarded_bits ) ); + } + + return suma; +} +#endif +/*-------------------------------------------------------------------* + * v_mult() + * + * Multiplication of two vectors + *-------------------------------------------------------------------*/ + + +void v_mult_fixed( + const Word32 x1[], /* i : Input vector 1 */ + const Word32 x2[], /* i : Input vector 2 */ + Word32 y[], /* o : Output vector that contains vector 1 .* vector 2 */ + const Word16 N /* i : Vector length */ +) +{ + Word16 i; + + FOR( i = 0; i < N; i++ ) + { + y[i] = Mpy_32_32( x1[i], x2[i] ); + move32(); + } + + return; +} + +/*-------------------------------------------------------------------* + * anint_fixed() + * + * Round to the nearest integer. + *-------------------------------------------------------------------*/ +Word32 anint_fixed( Word32 x, Word16 exp ) +{ + IF( x == 0 ) + { + return 0; + } + IF( x >= 0 ) + { + return L_add( x, L_shl( 1, sub( exp, 1 ) ) ); + } + ELSE + { + return L_sub( x, L_shl( 1, sub( exp, 1 ) ) ); + } +} + +/*-------------------------------------------------------------------* + * ceil_fixed() + * + * Ceil to the next multiple of (1 << exp). + *-------------------------------------------------------------------*/ +Word32 ceil_fixed( Word32 x, Word16 exp ) +{ + Word32 step; + // step = x / L_shl( 1, exp ); + step = L_shr( x, exp ); + if ( ( x % L_shl( 1, exp ) ) > 0 ) + { + step = L_add( step, 1 ); + } + return L_shl( step, exp ); +} + +void sort_l( + Word32 *x, /* i/o: Vector to be sorted */ + Word16 len /* i/o: vector length */ +) +{ + Word16 i, j; + Word32 tempr; + + FOR( i = len - 2; i >= 0; i-- ) + { + tempr = x[i]; + FOR( j = i + 1; ( j < len ) && ( tempr > x[j] ); j++ ) + { + x[j - 1] = x[j]; + move32(); + } + x[j - 1] = tempr; + move32(); + } + + return; +} + +/*-------------------------------------------------------------------* + * v_add_fixed() + * + * Subtraction of two vectors sample by sample + *-------------------------------------------------------------------*/ + +void v_add_fixed( + const Word32 x1[], /* i : Input vector 1 */ + const Word32 x2[], /* i : Input vector 2 */ + Word32 y[], /* o : Output vector that contains vector 1 - vector 2 */ + const Word16 N, /* i : Vector length */ + const Word16 hdrm /* i : headroom for when subtraction result > 1 or < -1 */ +) +{ + Word16 i; + + FOR( i = 0; i < N; i++ ) + { + y[i] = L_add( L_shr( x1[i], hdrm ), L_shr( x2[i], hdrm ) ); + move32(); + } + + return; +} + +void v_add_fixed_me( + const Word32 x1[], /* i : Input vector 1 */ + const Word16 x1_e, /* i : Exponent for input vector 1 */ + const Word32 x2[], /* i : Input vector 2 */ + const Word16 x2_e, /* i : Exponent for input vector 2 */ + Word32 y[], /* o : Output vector that contains vector 1 - vector 2 */ + Word16 *y_e, /* i : Exponent for output vector */ + const Word16 N, /* i : Vector length */ + const Word16 hdrm /* i : headroom for when subtraction result > 1 or < -1 */ +) +{ + Word16 i; + Word16 x1_shift = sub( s_max( x1_e, x2_e ), x1_e ); + Word16 x2_shift = sub( s_max( x1_e, x2_e ), x2_e ); + + FOR( i = 0; i < N; i++ ) + { + y[i] = L_add( L_shr( x1[i], hdrm + x1_shift ), L_shr( x2[i], hdrm + x2_shift ) ); + move32(); + } + + *y_e = add( s_max( x1_e, x2_e ), hdrm ); + move16(); + + return; +} diff --git a/lib_dec/LD_music_post_filter.c b/lib_dec/LD_music_post_filter.c index da0fa66de..cffd1a42e 100644 --- a/lib_dec/LD_music_post_filter.c +++ b/lib_dec/LD_music_post_filter.c @@ -40,6 +40,7 @@ #include "cnst.h" #include "rom_com.h" #include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" /*-------------------------------------------------------------------* @@ -746,7 +747,7 @@ void music_postfilt_init_flt( set_f( hMusicPF->dct_post_old_exc, 0, DCT_L_POST - OFFSET2 ); #endif #ifdef IVAS_FLOAT_FIXED - set_val_Word16( hMusicPF->dct_post_old_exc_fx, 0, DCT_L_POST - OFFSET2 ); + set16_fx( hMusicPF->dct_post_old_exc_fx, 0, DCT_L_POST - OFFSET2 ); #endif #ifndef IVAS_FLOAT_FIXED @@ -764,7 +765,7 @@ void music_postfilt_init_flt( hMusicPF->LDm_thres[3] = TH_3_MIN; #endif #ifdef IVAS_FLOAT_FIXED - set_val_Word16( hMusicPF->LDm_lt_diff_etot_fx, 0, MAX_LT ); + set16_fx( hMusicPF->LDm_lt_diff_etot_fx, 0, MAX_LT ); hMusicPF->LDm_thres_fx[0] = TH_0_MIN_FX << 1; hMusicPF->LDm_thres_fx[1] = TH_1_MIN_FX << 1; hMusicPF->LDm_thres_fx[2] = TH_2_MIN_FX << 1; diff --git a/lib_dec/cng_dec_fx.c b/lib_dec/cng_dec_fx.c index 549da6bfa..fdb708f46 100644 --- a/lib_dec/cng_dec_fx.c +++ b/lib_dec/cng_dec_fx.c @@ -1511,7 +1511,7 @@ void td_cng_dec_init_ivas_fx( move16(); hTdCngDec->Enew_fx = 0; move32(); - mvs2s( st->lsp_old_fx, st->lspCNG_fx, M ); // Q(15) + Copy( st->lsp_old_fx, st->lspCNG_fx, M ); // Q(15) hTdCngDec->last_allow_cn_step = 0; move16(); hTdCngDec->shb_cng_ener_fx_32 = -12329; // -6.02 in Q(11) diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index ab4558791..64008b424 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -2061,17 +2061,17 @@ void decoder_tcx_imdct_fx( IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) { set32_fx( x_tmp_fx, 0, L_FRAME_PLUS ); - mvl2l( x_fx, x_tmp_fx, s_min( L_FRAME48k, s_max( L_spec, s_max( L_frame, L_frameTCX ) ) ) ); - mvl2l( x_fx, xn_bufFB_fx, s_min( L_FRAME48k, s_max( L_spec, s_max( L_frame, L_frameTCX ) ) ) ); + Copy32( x_fx, x_tmp_fx, s_min( L_FRAME48k, s_max( L_spec, s_max( L_frame, L_frameTCX ) ) ) ); + Copy32( x_fx, xn_bufFB_fx, s_min( L_FRAME48k, s_max( L_spec, s_max( L_frame, L_frameTCX ) ) ) ); } ELSE IF( EQ_16( st->element_mode, EVS_MONO ) ) { - mvl2l( x_fx, xn_bufFB_fx, s_max( L_spec, s_max( L_frame, L_frameTCX ) ) ); + Copy32( x_fx, xn_bufFB_fx, s_max( L_spec, s_max( L_frame, L_frameTCX ) ) ); } ELSE { - mvl2l( x_fx, x_tmp_fx, s_max( L_spec, s_max( L_frame, L_frameTCX ) ) ); - mvl2l( x_fx, xn_bufFB_fx, s_max( L_spec, s_max( L_frame, L_frameTCX ) ) ); + Copy32( x_fx, x_tmp_fx, s_max( L_spec, s_max( L_frame, L_frameTCX ) ) ); + Copy32( x_fx, xn_bufFB_fx, s_max( L_spec, s_max( L_frame, L_frameTCX ) ) ); } IF( NE_16( st->igf, 0 ) ) @@ -2099,7 +2099,7 @@ void decoder_tcx_imdct_fx( IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) || NE_16( sba_dirac_stereo_flag, 0 ) ) { - mvl2l( x_fx, xn_bufFB_fx, s_max( L_spec, s_max( L_frame, L_frameTCX ) ) ); + Copy32( x_fx, xn_bufFB_fx, s_max( L_spec, s_max( L_frame, L_frameTCX ) ) ); IMDCT_ivas_fx( xn_bufFB_fx, q_x, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf_fx, hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2, hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index, kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, 0, st, 0, acelp_zir_fx, q_win ); @@ -2161,7 +2161,7 @@ void decoder_tcx_imdct_fx( /* Update old_syn_overl */ IF( EQ_16( hTcxCfg->last_aldo, 0 ) ) { - mvs2s( xn_buf_fx + L_frame, hTcxDec->syn_Overl, overlap ); + Copy( xn_buf_fx + L_frame, hTcxDec->syn_Overl, overlap ); FOR( Word16 ind = 0; ind < overlapFB; ind++ ) { hTcxDec->syn_OverlFB[ind] = (Word16) L_shr( xn_bufFB_fx[add( ind, L_frameTCX )], sub( q_x, q_win ) ); @@ -2169,7 +2169,7 @@ void decoder_tcx_imdct_fx( } /* Output */ - mvs2s( xn_buf_fx + sub( shr( overlap, 1 ), tcx_offset ), synth_fx, L_frame_glob ); + Copy( xn_buf_fx + sub( shr( overlap, 1 ), tcx_offset ), synth_fx, L_frame_glob ); FOR( Word16 ind = 0; ind < L_frameTCX_glob; ind++ ) { synthFB_fx[ind] = (Word16) L_shr( xn_bufFB_fx[add( ind, sub( shr( overlapFB, 1 ), tcx_offsetFB ) )], sub( q_x, q_win ) ); diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 6df017afd..6d280edbb 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -2885,7 +2885,7 @@ void IMDCT_ivas_fx( v_add_16( win_fx, xn_buf_fx + add( sub( tcx_offset, shr( L_ola, 1 ) ), imult1616( w, L_win ) ), xn_buf_fx + add( sub( tcx_offset, shr( L_ola, 1 ) ), imult1616( w, L_win ) ), L_ola ); /* copy new sub-window region not overlapping with previous window */ - mvs2s( win_fx + L_ola, xn_buf_fx + add( tcx_offset, add( shr( L_ola, 1 ), imult1616( w, L_win ) ) ), L_win ); + Copy( win_fx + L_ola, xn_buf_fx + add( tcx_offset, add( shr( L_ola, 1 ), imult1616( w, L_win ) ) ), L_win ); } /* To assure that no garbage values are passed to overlap */ @@ -2925,7 +2925,7 @@ void IMDCT_ivas_fx( set16_fx( xn_buf_fx, 0, shr( overlap, 1 ) ); /* copy new sub-window region not overlapping with previous window */ - mvs2s( win_fx + L_win, xn_buf_fx + shr( overlap, 1 ), add( L_win, shr( L_ola, 1 ) ) ); + Copy( win_fx + L_win, xn_buf_fx + shr( overlap, 1 ), add( L_win, shr( L_ola, 1 ) ) ); /* 2nd TCX-5 window, regular MDCT with minimum overlap on both sides */ IF( s_and( kernel_type, 1 ) ) @@ -2946,7 +2946,7 @@ void IMDCT_ivas_fx( v_add_16( win_fx, xn_buf_fx + add( shr( overlap, 1 ), sub( L_win, shr( L_ola, 1 ) ) ), xn_buf_fx + sub( add( shr( overlap, 1 ), L_win ), shr( L_ola, 1 ) ), L_ola ); /* copy new sub-window region not overlapping with previous window */ - mvs2s( win_fx + L_ola, xn_buf_fx + add( add( shr( overlap, 1 ), L_win ), shr( L_ola, 1 ) ), L_win ); + Copy( win_fx + L_ola, xn_buf_fx + add( add( shr( overlap, 1 ), L_win ), shr( L_ola, 1 ) ), L_win ); /* extra folding-out on left side of win, for perfect reconstruction */ IF( GE_16( kernel_type, MDCT_II ) ) @@ -3119,7 +3119,7 @@ void IMDCT_ivas_fx( Word16 q_r, q_buf; /* get the first 5 ms of non-aliased TCX syntesis */ - mvs2s( xn_buf_fx + add( shr( overlap, 1 ), shl( acelp_mem_len, 1 ) ), &buf_fx[0], analysis_len ); + Copy( xn_buf_fx + add( shr( overlap, 1 ), shl( acelp_mem_len, 1 ) ), &buf_fx[0], analysis_len ); q_buf = q_win; move16(); @@ -3245,7 +3245,7 @@ void IMDCT_ivas_fx( IF( ( aldo == 0 ) && ( ( EQ_16( L_frameTCX, shr( hTcxDec->L_frameTCX, 1 ) ) && ( frame_cnt > 0 ) ) || NE_16( L_frameTCX, shr( hTcxDec->L_frameTCX, 1 ) ) ) ) { /* Compute windowed synthesis in case of switching to ALDO windows in next frame */ - mvs2s( xn_buf_fx + sub( L_frame, nz ), old_out_fx, add( nz, overlap ) ); + Copy( xn_buf_fx + sub( L_frame, nz ), old_out_fx, add( nz, overlap ) ); set16_fx( old_out_fx + add( nz, overlap ), 0, nz ); tcx_windowing_synthesis_past_frame( old_out_fx + nz, tcx_aldo_window_1_trunc_fx, tcx_mdct_window_half_fx, tcx_mdct_window_minimum_fx, overlap, tcx_mdct_window_half_length, tcx_mdct_window_min_length, hTcxCfg->tcx_curr_overlap_mode ); diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index a81472302..7f1545e8d 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -4100,7 +4100,7 @@ void IGFDecReplicateTCX10State_fx( ) { Copy( &hIGFDec->flag_sparseBuf[( N_MAX_TCX - IGF_START_MN ) / 2], &hIGFDec->flag_sparseBuf[0], ( N_MAX_TCX - IGF_START_MN ) / 2 ); - mvs2s( &hIGFDec->infoTCXNoise_evs[( IGF_START_MX ) / 2], &hIGFDec->infoTCXNoise_evs[0], ( IGF_START_MX ) / 2 ); + Copy( &hIGFDec->infoTCXNoise_evs[( IGF_START_MX ) / 2], &hIGFDec->infoTCXNoise_evs[0], ( IGF_START_MX ) / 2 ); /* TODO: remove float dependency */ // mvr2r( &hIGFDec->virtualSpecBuf[( N_MAX_TCX - IGF_START_MN ) / 2], &hIGFDec->virtualSpecBuf[0], ( N_MAX_TCX - IGF_START_MN ) / 2 ); diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 191bea1c1..109c076dd 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1420,8 +1420,8 @@ static ivas_error ivas_binaural_hrtf_open_fx( } } } - mvl2l( fastconvReverberationTimes_fx, HrtfFastConv->fastconvReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX ); - mvl2l( fastconvReverberationEneCorrections_fx, HrtfFastConv->fastconvReverberationEneCorrections_fx, CLDFB_NO_CHANNELS_MAX ); + Copy32( fastconvReverberationTimes_fx, HrtfFastConv->fastconvReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX ); + Copy32( fastconvReverberationEneCorrections_fx, HrtfFastConv->fastconvReverberationEneCorrections_fx, CLDFB_NO_CHANNELS_MAX ); *hHrtfFastConv = HrtfFastConv; } @@ -1692,14 +1692,14 @@ static void ivas_binaural_obtain_DMX_fx( { FOR( chOutIdx = 0; chOutIdx < BINAURAL_CHANNELS; chOutIdx++ ) { - set_l( realDMX[chOutIdx][k], 0, CLDFB_NO_CHANNELS_MAX ); - set_l( imagDMX[chOutIdx][k], 0, CLDFB_NO_CHANNELS_MAX ); + set32_fx( realDMX[chOutIdx][k], 0, CLDFB_NO_CHANNELS_MAX ); + set32_fx( imagDMX[chOutIdx][k], 0, CLDFB_NO_CHANNELS_MAX ); } } FOR( chOutIdx = 0; chOutIdx < BINAURAL_CHANNELS; chOutIdx++ ) { - set_l( P_in_fx, 0, hBinRenderer->conv_band ); + set32_fx( P_in_fx, 0, hBinRenderer->conv_band ); FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { @@ -1776,10 +1776,10 @@ static void ivas_binaural_obtain_DMX_fx( outImagLeftPtr_fx = imagDMX[0][k]; outRealRightPtr_fx = realDMX[1][k]; outImagRightPtr_fx = imagDMX[1][k]; - set_l( outRealLeftPtr_fx, 0, CLDFB_NO_CHANNELS_MAX ); - set_l( outImagLeftPtr_fx, 0, CLDFB_NO_CHANNELS_MAX ); - set_l( outRealRightPtr_fx, 0, CLDFB_NO_CHANNELS_MAX ); - set_l( outImagRightPtr_fx, 0, CLDFB_NO_CHANNELS_MAX ); + set32_fx( outRealLeftPtr_fx, 0, CLDFB_NO_CHANNELS_MAX ); + set32_fx( outImagLeftPtr_fx, 0, CLDFB_NO_CHANNELS_MAX ); + set32_fx( outRealRightPtr_fx, 0, CLDFB_NO_CHANNELS_MAX ); + set32_fx( outImagRightPtr_fx, 0, CLDFB_NO_CHANNELS_MAX ); FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index cbf26cad4..e3526f7f5 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -70,7 +70,7 @@ ivas_error ivas_core_dec_fx( STEREO_TD_DEC_DATA_HANDLE hStereoTD; Word16 sharpFlag[CPE_CHANNELS]; Word16 tmp_buffer_fx[L_FRAME48k]; - set_s( tmp_buffer_fx, 0, L_FRAME48k ); + set16_fx( tmp_buffer_fx, 0, L_FRAME48k ); Word16 tmp16, tmp16_2, j; tmp16 = 0; move16(); @@ -293,6 +293,7 @@ ivas_error ivas_core_dec_fx( L_tmp = Mpy_32_16_1( L_tmp, st->last_concealed_gain_syn_deemph ); L_tmp = L_shl( L_tmp, st->last_concealed_gain_syn_deemph_e ); st->hHQ_core->old_out_fx[i] = extract_l( L_tmp ); // Q0 + move16(); } FOR( i = 0; i < st->L_frame; i++ ) @@ -301,6 +302,7 @@ ivas_error ivas_core_dec_fx( L_tmp = Mpy_32_16_1( L_tmp, st->last_concealed_gain_syn_deemph ); L_tmp = L_shl( L_tmp, st->last_concealed_gain_syn_deemph_e ); st->hHQ_core->old_out_LB_fx[i] = extract_l( L_tmp ); // Q0 + move16(); } } @@ -322,9 +324,11 @@ ivas_error ivas_core_dec_fx( IF( NE_16( st->bfi, 1 ) ) /* note: st->bfi can be changed from 0 to 1 in ivas_decision_matrix_dec() when BER is detected */ { st->sr_core = L_mult0( st->L_frame, FRAMES_PER_SEC ); + move32(); st->fscale_old = st->fscale; move16(); st->fscale = sr2fscale_fx( st->sr_core ); + move16(); } ELSE { @@ -423,6 +427,7 @@ ivas_error ivas_core_dec_fx( IF( EQ_16( st->bfi, 1 ) ) { st->nbLostCmpt = add( st->nbLostCmpt, 1 ); + move16(); } ELSE { @@ -446,6 +451,7 @@ ivas_error ivas_core_dec_fx( IF( EQ_16( n, 1 ) ) { sts[1]->BER_detect = s_or( sts[1]->BER_detect, sts[0]->BER_detect ); + move16(); } /*---------------------------------------------------------------------* @@ -489,7 +495,7 @@ ivas_error ivas_core_dec_fx( { /* ACELP core decoder */ Word16 old_syn_12k8_16k_fx_16[L_FRAME16k]; - set_s( output_16_fx[n], 0, L_FRAME48k ); + set16_fx( output_16_fx[n], 0, L_FRAME48k ); Word16 save_hb_synth_fx_arr[L_FRAME48k], *save_hb_synth_16_fx; IF( save_hb_synth_32_fx ) { @@ -642,6 +648,7 @@ ivas_error ivas_core_dec_fx( move16(); } st->hBPF->pst_mem_deemp_err_fx = extract_l( st->mem_error ); + move16(); } IF( EQ_16( st->core, HQ_CORE ) ) @@ -789,14 +796,18 @@ ivas_error ivas_core_dec_fx( IF( LE_32( hCPE->last_element_brate, IVAS_SID_5k2 ) ) { sts[0]->hHQ_core->exp_old_out = sub( 15, sts[0]->hHQ_core->Q_old_wtda ); + move16(); sts[1]->hHQ_core->exp_old_out = sub( 15, sts[1]->hHQ_core->Q_old_wtda ); + move16(); } updateBuffersForDmxMdctStereo_fx( hCPE, output_frame, output_32_fx[0], output_32_fx[1], synth_16_fx ); IF( LE_32( hCPE->last_element_brate, IVAS_SID_5k2 ) ) { sts[0]->hHQ_core->Q_old_wtda = sub( 15, sts[0]->hHQ_core->exp_old_out ); + move16(); sts[1]->hHQ_core->Q_old_wtda = sub( 15, sts[1]->hHQ_core->exp_old_out ); + move16(); } } @@ -1001,6 +1012,7 @@ ivas_error ivas_core_dec_fx( test(); test(); test(); + test(); IF( n == 0 && EQ_16( st->element_mode, IVAS_CPE_MDCT ) && EQ_16( st->last_core, ACELP_CORE ) && NE_16( st->core, ACELP_CORE ) && ( EQ_16( nchan_out, 1 ) || ( hCPE != NULL && EQ_16( hCPE->last_element_mode, IVAS_CPE_DFT ) ) ) ) { Copy( sts[0]->previoussynth_fx, sts[1]->previoussynth_fx, st->hTcxDec->L_frameTCX ); @@ -1037,7 +1049,7 @@ ivas_error ivas_core_dec_fx( IF( NE_16( st->last_extl, WB_BWE ) && EQ_16( st->extl, WB_BWE ) && st->hBWE_FD != NULL ) { test(); - IF( NE_16( st->last_extl, SWB_BWE ) && NE_16( st->last_extl, FB_BWE ) ) + if ( NE_16( st->last_extl, SWB_BWE ) && NE_16( st->last_extl, FB_BWE ) ) { st->hBWE_FD->prev_mode = st->hBWE_FD->prev_mode; move16(); @@ -1119,6 +1131,12 @@ ivas_error ivas_core_dec_fx( test(); test(); test(); + test(); + test(); + test(); + test(); + test(); + test(); IF( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, FB_TBE ) || ( NE_16( st->coder_type, AUDIO ) && NE_16( st->coder_type, INACTIVE ) && GE_32( st->core_brate, SID_2k40 ) && EQ_16( st->core, ACELP_CORE ) && !st->con_tcx && GE_32( output_Fs, 32000 ) && GT_16( st->bwidth, NB ) && st->bws_cnt > 0 ) ) { /* SWB TBE decoder */ @@ -1142,7 +1160,7 @@ ivas_error ivas_core_dec_fx( fb_tbe_dec_ivas_fx( st, tmp_buffer_fx /*fb_exc*/, Q_white_exc, hb_synth_32_fx[n], 0, tmp_buffer_fx /*fb_synth_ref*/, Q_white_exc, output_frame ); } } - ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) || ( GE_32( output_Fs, 32000 ) && EQ_16( st->core, ACELP_CORE ) && GT_16( st->bwidth, NB ) && st->bws_cnt > 0 && !st->ppp_mode_dec && !( EQ_16( st->nelp_mode_dec, 1 ) && EQ_16( st->bfi, 1 ) ) ) ) + ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) || ( GE_32( output_Fs, 32000 ) && st->core == ACELP_CORE && st->bwidth > NB && st->bws_cnt > 0 && !st->ppp_mode_dec && !( EQ_16( st->nelp_mode_dec, 1 ) && EQ_16( st->bfi, 1 ) ) ) ) { /* SWB BWE decoder */ Q_syn_hb = swb_bwe_dec_fx32( st, output_32_fx[n], synth_32_fx[n], hb_synth_32_fx[n], use_cldfb_for_dft, output_frame ); @@ -1211,14 +1229,15 @@ ivas_error ivas_core_dec_fx( swb_CNG_dec_ivas_fx( st, synth_fxl, hb_synth_16_fx[n], sid_bw[n], negate( q ) ); - IF( EQ_32( st->core_brate, FRAME_NO_DATA ) || EQ_32( st->core_brate, SID_2k40 ) ) + test(); + IF( st->core_brate == FRAME_NO_DATA || EQ_32( st->core_brate, SID_2k40 ) ) { Copy_Scale_sig_16_32( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, ( Q11 + q ) ); } - Copy_Scale_sig_16_32( synth_fxl, synth_32_fx[n], L_FRAME48k, ( Q11 + q ) ); - Scale_sig( st->hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, -( Q8 - st->prev_Q_bwe_syn ) ); - Scale_sig32( st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx, HILBERT_MEM_SIZE, -( st->prev_Q_bwe_syn2 - Q11 ) ); - Copy_Scale_sig_16_32( st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, 2 * ALLPASSSECTIONS_STEEP, -( st->prev_Q_bwe_syn2 - Q11 ) ); + Copy_Scale_sig_16_32( synth_fxl, synth_32_fx[n], L_FRAME48k, add( Q11, q ) ); + Scale_sig( st->hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, sub( st->prev_Q_bwe_syn, Q8 ) ); + Scale_sig32( st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx, HILBERT_MEM_SIZE, sub( Q11, st->prev_Q_bwe_syn2 ) ); + Copy_Scale_sig_16_32( st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, 2 * ALLPASSSECTIONS_STEEP, sub( Q11, st->prev_Q_bwe_syn2 ) ); } /*-------------------------------------------------------------------* @@ -1291,7 +1310,7 @@ ivas_error ivas_core_dec_fx( test(); test(); test(); - IF( ( NE_16( st->extl, -1 ) && ( NE_16( st->extl, IGF_BWE ) || EQ_16( st->last_core, ACELP_CORE ) ) ) || ( st->bws_cnt > 0 && EQ_16( st->core, ACELP_CORE ) ) ) + IF( ( NE_16( st->extl, -1 ) && ( NE_16( st->extl, IGF_BWE ) || st->last_core == ACELP_CORE ) ) || ( st->bws_cnt > 0 && st->core == ACELP_CORE ) ) { /* Calculate an additional delay of extension layer components to be synchronized with ACELP synthesis */ IF( EQ_16( st->L_frame, L_FRAME ) ) @@ -1326,8 +1345,8 @@ ivas_error ivas_core_dec_fx( test(); test(); test(); - IF( !( ( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) || EQ_16( st->core, HQ_CORE ) ) && EQ_16( st->last_core, ACELP_CORE ) ) && - ( NE_16( st->extl, st->last_extl ) || ( EQ_16( st->extl, st->last_extl ) && ( st->core ^ st->last_core ) == HQ_CORE ) ) && !( EQ_16( st->extl, SWB_CNG ) && EQ_16( st->last_extl, SWB_TBE ) ) && ( NE_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && tdm_LRTD_flag ) ) ) + IF( !( ( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) || EQ_16( st->core, HQ_CORE ) ) && st->last_core == ACELP_CORE ) && + ( NE_16( st->extl, st->last_extl ) || ( EQ_16( st->extl, st->last_extl ) && s_xor( st->core, st->last_core ) == HQ_CORE ) ) && !( EQ_16( st->extl, SWB_CNG ) && EQ_16( st->last_extl, SWB_TBE ) ) && ( NE_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && tdm_LRTD_flag ) ) ) { /* switching between BWE and TBE technologies */ incr = idiv1616( imult1616( L_FRAME, 2 ), add( shl( tmps, 1 ), 1 ) ); @@ -1411,7 +1430,7 @@ ivas_error ivas_core_dec_fx( test(); test(); test(); - IF( GE_16( output_frame, L_FRAME32k ) && GT_16( st->extl, SWB_CNG ) && EQ_16( st->core, ACELP_CORE ) && st->hTdCngDec != NULL ) + IF( GE_16( output_frame, L_FRAME32k ) && GT_16( st->extl, SWB_CNG ) && st->core == ACELP_CORE && st->hTdCngDec != NULL ) { Word16 exp; Word32 fra; @@ -1453,8 +1472,10 @@ ivas_error ivas_core_dec_fx( // exp = sub( sub( 30, shl( sub( Q11, 0 ), 1 ) ), exp ); L_tmp = Mpy_32_16_1( L_tmp, 24660 ); exp = add( exp, 2 ); - st->last_shb_ener_fx = round_fx_sat( L_shl_sat( L_tmp, exp - 7 ) ); /*Q8*/ - st->hTdCngDec->last_shb_ener_fx = L_shl_sat( L_tmp, exp - 20 ); /*Q11*/ + st->last_shb_ener_fx = round_fx_sat( L_shl_sat( L_tmp, sub( exp, 7 ) ) ); /*Q8*/ + move16(); + st->hTdCngDec->last_shb_ener_fx = L_shl_sat( L_tmp, sub( exp, 20 ) ); /*Q11*/ + move32(); } } @@ -1471,13 +1492,13 @@ ivas_error ivas_core_dec_fx( * - core switching in DFT stereo * - updates for potential TD->DFT stereo switching *----------------------------------------------------------------*/ - if ( hCPE != NULL ) + IF( hCPE != NULL ) { - FOR( int ch_ind = 0; ch_ind < n_channels; ch_ind++ ) + FOR( Word32 ch_ind = 0; ch_ind < n_channels; ch_ind++ ) { - if ( hCPE->hCoreCoder[ch_ind] != NULL ) + IF( hCPE->hCoreCoder[ch_ind] != NULL ) { - if ( hCPE->hCoreCoder[ch_ind]->hHQ_core != NULL ) + IF( hCPE->hCoreCoder[ch_ind]->hHQ_core != NULL ) { Copy_Scale_sig_16_32( hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB_fx, L_FRAME32k, sub( Q11, hCPE->hCoreCoder[ch_ind]->hHQ_core->Q_old_wtda_LB ) ); Copy_Scale_sig_16_32( hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out_fx, hCPE->hCoreCoder[ch_ind]->hHQ_core->oldOut_fx, L_FRAME48k, sub( Q11, hCPE->hCoreCoder[ch_ind]->hHQ_core->Q_old_wtda ) ); @@ -1485,11 +1506,11 @@ ivas_error ivas_core_dec_fx( } } } - if ( hSCE != NULL ) + IF( hSCE != NULL ) { - if ( hSCE->hCoreCoder[0] != NULL ) + IF( hSCE->hCoreCoder[0] != NULL ) { - if ( hSCE->hCoreCoder[0]->hHQ_core != NULL ) + IF( hSCE->hCoreCoder[0]->hHQ_core != NULL ) { Copy_Scale_sig_16_32( hSCE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hSCE->hCoreCoder[0]->hHQ_core->old_outLB_fx, L_FRAME32k, sub( Q11, hSCE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ) ); Copy_Scale_sig_16_32( hSCE->hCoreCoder[0]->hHQ_core->old_out_fx, hSCE->hCoreCoder[0]->hHQ_core->oldOut_fx, L_FRAME48k, sub( Q11, hSCE->hCoreCoder[0]->hHQ_core->Q_old_wtda ) ); @@ -1529,10 +1550,13 @@ ivas_error ivas_core_dec_fx( stereo_mdct2dft_update_fx( hCPE, output_32_fx[0], synth_32_fx[0] ); } Word16 q_DFT[2] = { 3, 3 }; + move16(); + move16(); stereo_dft_dec_core_switching_fx( hCPE, output_32_fx[0], synth_32_fx[0], hb_synth_32_fx[0], DFT_fx, output_frame, use_cldfb_for_dft, 0, &q, q_DFT ); hCPE->hStereoDft->q_dft = s_min( q_DFT[0], q_DFT[1] ); + move16(); IF( DFT_fx != NULL ) { diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index a0cd9e580..fa66debaa 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -561,7 +561,7 @@ ivas_error ivas_cpe_dec_fx( { IF( !st_ivas->bfi ) { - tdm_configure_dec( st_ivas->ivas_format, st_ivas->ism_mode, hCPE, &tdm_ratio_idx, nb_bits_metadata ); + tdm_configure_dec_fx( st_ivas->ivas_format, st_ivas->ism_mode, hCPE, &tdm_ratio_idx, nb_bits_metadata ); iDiv_and_mod_32( sts[0]->total_brate, FRAMES_PER_SEC, &quo, &rem, 0 ); sts[1]->bit_stream = sts[0]->bit_stream + extract_l( quo ); @@ -1219,8 +1219,8 @@ ivas_error create_cpe_dec( move16(); hCPE->hStereoMdct->smooth_ratio_fx = ONE_IN_Q26; move32(); - set_s( hCPE->hStereoMdct->prev_ms_mask[0], 0, MAX_SFB ); - set_s( hCPE->hStereoMdct->prev_ms_mask[1], 0, MAX_SFB ); + set16_fx( hCPE->hStereoMdct->prev_ms_mask[0], 0, MAX_SFB ); + set16_fx( hCPE->hStereoMdct->prev_ms_mask[1], 0, MAX_SFB ); hCPE->hStereoMdct->lastCoh_fx = ONE_IN_Q14; move16(); hCPE->hStereoMdct->mdct_stereo_mode[0] = SMDCT_DUAL_MONO; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 2d68fe786..ab66ecf64 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3253,12 +3253,12 @@ void ivas_dirac_dec_set_md_map( { st_ivas->hTcBuffer->nb_subframes = hSpatParamRendCom->nb_subframes; move16(); - mvs2s( hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, hSpatParamRendCom->nb_subframes ); + Copy( hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, hSpatParamRendCom->nb_subframes ); } /* set mapping according to dirac_read_idx */ - set_s( hSpatParamRendCom->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + set16_fx( hSpatParamRendCom->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); test(); test(); @@ -3298,7 +3298,7 @@ void ivas_dirac_dec_set_md_map( hSpatParamRendCom->render_to_md_map[sf_idx] = add( round_fx( quo ), hSpatParamRendCom->dirac_read_idx ) % hSpatParamRendCom->dirac_md_buffer_length; } - set_s( &hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->nb_subframes], 0, sub( MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME, hSpatParamRendCom->nb_subframes ) ); + set16_fx( &hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->nb_subframes], 0, sub( MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME, hSpatParamRendCom->nb_subframes ) ); } return; @@ -3769,8 +3769,8 @@ void ivas_dirac_dec_render_sf_fx( } q_cldfb = Q11; move16(); - set_s( q_proto_direct_buffer, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, CLDFB_SLOTS_PER_SUBFRAME ); - set_s( q_proto_diffuse_buffer, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, CLDFB_SLOTS_PER_SUBFRAME ); + set16_fx( q_proto_direct_buffer, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, CLDFB_SLOTS_PER_SUBFRAME ); + set16_fx( q_proto_diffuse_buffer, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, CLDFB_SLOTS_PER_SUBFRAME ); set_zero_fx( surCohRatio_fx, CLDFB_NO_CHANNELS_MAX ); IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 0640c495f..f17a8ccb7 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2044,7 +2044,7 @@ ivas_error ivas_init_decoder_fx( } #ifdef MSAN_FIX set_f( st_ivas->hSpar->hFbMixer->cldfb_cross_fade, 0.f, CLDFB_NO_COL_MAX ); - set_s( st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, 0, CLDFB_NO_COL_MAX ); + set16_fx( st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, 0, CLDFB_NO_COL_MAX ); #endif test(); IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_DEC ) && st_ivas->hOutSetup.is_loudspeaker_setup ) diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index e6d2085b3..e50db18af 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -1049,8 +1049,8 @@ ivas_error ivas_param_ism_dec_open_fx( /* hSpatParamRendCom->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); */ hSpatParamRendCom->slot_size = extract_l( L_shr( Mpy_32_32( output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ), 4 ) ); move16(); - set_s( hSpatParamRendCom->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); - set_s( hSpatParamRendCom->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); + set16_fx( hSpatParamRendCom->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set16_fx( hSpatParamRendCom->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); hSpatParamRendCom->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; hSpatParamRendCom->subframes_rendered = 0; move16(); diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 7950e6db5..8f3576ff3 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -413,7 +413,7 @@ void ivas_ism_render_sf_fx( { FOR( i = 0; i < num_objects; i++ ) { - mvl2l( &output_fx[i][tc_offset], tc_local_fx[i], n_samples_to_render ); + Copy32( &output_fx[i][tc_offset], tc_local_fx[i], n_samples_to_render ); p_tc_fx[i] = tc_local_fx[i]; } } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 42605102d..a5997460e 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -779,7 +779,7 @@ ivas_error ivas_jbm_dec_tc_fx( { Word16 nchan_ism, sba_ch_idx; - set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); + set16_fx( nb_bits_metadata, 0, MAX_SCE + 1 ); nchan_ism = st_ivas->nchan_ism; IF( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { @@ -3131,7 +3131,7 @@ ivas_error ivas_jbm_dec_render_fx( Word16 nchan_out_cov; Word16 nchan_out_cldfb = 0; - set_s( channel_active_fx, 0, MAX_CICP_CHANNELS ); + set16_fx( channel_active_fx, 0, MAX_CICP_CHANNELS ); Word16 nchan_transport_tmp = st_ivas->nchan_transport; output_Fs = st_ivas->hDecoderConfig->output_Fs; Word16 nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; @@ -3141,7 +3141,7 @@ ivas_error ivas_jbm_dec_render_fx( { nchan_out_cldfb = BINAURAL_CHANNELS; move16(); - set_s( channel_active_fx, 1, BINAURAL_CHANNELS ); + set16_fx( channel_active_fx, 1, BINAURAL_CHANNELS ); nchan_out_cov = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ); } ELSE IF( EQ_32( st_ivas->hParamMC->synthesis_conf, PARAM_MC_SYNTH_LS_CONV_CLDFB ) ) @@ -3155,7 +3155,7 @@ ivas_error ivas_jbm_dec_render_fx( nchan_out_cov = add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe ); nchan_out_cldfb = nchan_out_cov; move16(); - set_s( channel_active_fx, 1, nchan_out_cov ); + set16_fx( channel_active_fx, 1, nchan_out_cov ); } ELSE { @@ -3163,7 +3163,7 @@ ivas_error ivas_jbm_dec_render_fx( move16(); nchan_out_cldfb = nchan_out_transport; move16(); - set_s( channel_active_fx, 1, nchan_out_cov ); + set16_fx( channel_active_fx, 1, nchan_out_cov ); } // ftf for ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx // ftf changes @@ -3225,11 +3225,11 @@ ivas_error ivas_jbm_dec_render_fx( { IF( LT_16( st_ivas->hParamMC->band_grouping[param_band_idx], st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr ) ) { - mvl2l( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[param_band_idx], nchan_transport_tmp * nchan_out_cov ); + Copy32( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[param_band_idx], nchan_transport_tmp * nchan_out_cov ); st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_exp[param_band_idx] = st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx]; move16(); } - mvl2l( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[param_band_idx], nchan_transport_tmp * nchan_out_cov ); + Copy32( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[param_band_idx], nchan_transport_tmp * nchan_out_cov ); st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_exp[param_band_idx] = st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx]; move16(); } @@ -4476,8 +4476,8 @@ void ivas_jbm_dec_get_adapted_subframes( *nb_subframes = add( *nb_subframes, ( nCldfbSlotsLocal + PARAM_MC_MAX_NSLOTS_IN_SUBFRAME - 1 ) / PARAM_MC_MAX_NSLOTS_IN_SUBFRAME ); nSlotsInLastSubframe = nCldfbSlotsLocal % PARAM_MC_MAX_NSLOTS_IN_SUBFRAME; - set_s( subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); - set_s( subframe_nbslots, PARAM_MC_MAX_NSLOTS_IN_SUBFRAME, *nb_subframes ); + set16_fx( subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set16_fx( subframe_nbslots, PARAM_MC_MAX_NSLOTS_IN_SUBFRAME, *nb_subframes ); IF( GT_16( nSlotsInFirstSubframe, 0 ) ) { @@ -4575,7 +4575,7 @@ void ivas_jbm_dec_get_md_map( } ELSE { - set_s( map, offset, map_idx + 1 ); + set16_fx( map, offset, map_idx + 1 ); } return; @@ -5851,7 +5851,7 @@ static void ivas_jbm_dec_tc_buffer_playout_fx( FOR( ch_idx = 0; ch_idx < st_ivas->hTcBuffer->nchan_transport_jbm; ch_idx++ ) { - mvl2l( st_ivas->hTcBuffer->tc_fx[ch_idx] + st_ivas->hTcBuffer->n_samples_rendered, output_fx[ch_idx], *nSamplesRendered ); + Copy32( st_ivas->hTcBuffer->tc_fx[ch_idx] + st_ivas->hTcBuffer->n_samples_rendered, output_fx[ch_idx], *nSamplesRendered ); } st_ivas->hTcBuffer->subframes_rendered = last_sf; @@ -5968,8 +5968,8 @@ void ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas->hTcBuffer->nb_subframes = add( st_ivas->hTcBuffer->nb_subframes, ceil_fx16( tmp, ( 15 - ( s2 - s1 ) ) ) ); nSlotsInLastSubframe = nSlotsAvailable % nMaxSlotsPerSubframe; - set_s( st_ivas->hTcBuffer->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); - set_s( st_ivas->hTcBuffer->subframe_nbslots, nMaxSlotsPerSubframe, st_ivas->hTcBuffer->nb_subframes ); + set16_fx( st_ivas->hTcBuffer->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set16_fx( st_ivas->hTcBuffer->subframe_nbslots, nMaxSlotsPerSubframe, st_ivas->hTcBuffer->nb_subframes ); IF( nSlotsInFirstSubframe > 0 ) { diff --git a/lib_dec/ivas_ls_custom_dec.c b/lib_dec/ivas_ls_custom_dec.c index f87889e27..6c0b738a7 100644 --- a/lib_dec/ivas_ls_custom_dec.c +++ b/lib_dec/ivas_ls_custom_dec.c @@ -91,7 +91,7 @@ ivas_error ivas_ls_custom_open_fx( ( *hLsSetupCustom )->num_lfe = -1; move16(); - set_s( ( *hLsSetupCustom )->lfe_idx, -1, MAX_OUTPUT_CHANNELS ); + set16_fx( ( *hLsSetupCustom )->lfe_idx, -1, MAX_OUTPUT_CHANNELS ); ( *hLsSetupCustom )->separate_ch_found = -1; move16(); diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 50b54e70a..87ff7b4e9 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -654,7 +654,7 @@ ivas_error ivas_mct_dec_fx( /* Save synthesis for HQ FEC */ Word32 output_fx_[L_FRAME48k]; - mvl2l( output_fx[add( shl( cpe_id, 1 /* * CPE_CHANNELS*/ ), n )], output_fx_, L_FRAME48k ); + Copy32( output_fx[add( shl( cpe_id, 1 /* * CPE_CHANNELS*/ ), n )], output_fx_, L_FRAME48k ); Scale_sig32( output_fx_, L_FRAME48k, Q16 - Q11 ); Copy_Scale_sig32_16( sts[n]->prev_synth_buffer32_fx, sts[n]->prev_synth_buffer_fx, NS2SA( 48000, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ), -11 ); sts[n]->q_prev_synth_buffer_fx = 0; diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index c80e1dbfb..bb71b0fc8 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -7365,7 +7365,7 @@ static Word16 read_coherence_data_fx( nbits = add( nbits, no_bits_vec ); - set_s( (Word16 *) spr_coh_temp_index, 0, MASA_MAXIMUM_CODING_SUBBANDS ); + set16_fx( (Word16 *) spr_coh_temp_index, 0, MASA_MAXIMUM_CODING_SUBBANDS ); decode_combined_index_fx( dct0_index, no_cv_vec, spr_coh_temp_index, coding_subbands ); @@ -8313,7 +8313,7 @@ static Word16 read_surround_coherence_hr_fx( { /* fixed rate */ UWord16 sur_coh_temp_index[MASA_MAXIMUM_CODING_SUBBANDS]; - set_s( (Word16 *) sur_coh_temp_index, 0, MASA_MAXIMUM_CODING_SUBBANDS ); + set16_fx( (Word16 *) sur_coh_temp_index, 0, MASA_MAXIMUM_CODING_SUBBANDS ); decode_fixed_rate_composed_index_coherence_fx( bitstream, &bit_pos, coding_subbands, no_cv_vec, sur_coh_temp_index, MASA_MAX_NO_CV_SUR_COH ); diff --git a/lib_dec/ivas_range_uni_dec.c b/lib_dec/ivas_range_uni_dec.c index 395a0654c..2f9369805 100644 --- a/lib_dec/ivas_range_uni_dec.c +++ b/lib_dec/ivas_range_uni_dec.c @@ -220,22 +220,28 @@ UWord16 rc_uni_dec_read_symbol_fastS_fx( UWord32 reversed_low; low = rc_st_dec->rc_low; + move32(); range = rc_st_dec->rc_range; + move32(); // Not converted , to be rechecked(Value of range exceeds Word32) - range >>= tot_shift; + range = UL_lshr( range, tot_shift ); /* the cumulative value is val = low / range */ /* the condition val >= level is equivalent with low >= range * level */ /* in case of bitstream errors it is possible that val >= (1 << tot_shift) */ - IF( low >= ( range << tot_shift ) ) + /*basop comment : unsigned integers are getting compared hence basops are not used*/ + IF( low >= UL_lshl( range, tot_shift ) ) { rc_st_dec->bit_error_detected = 1; + move16(); /* for valid bitstreams, always low < range, therefore setting low = range */ /* will always reach the bitstream error condition branch on the next call */ rc_st_dec->rc_range = 0xFFFFFFFF; + move32(); rc_st_dec->rc_low = rc_st_dec->rc_range; + move32(); /* the current value and all the following values are very likely incorrect */ return 0; /* return the minimum valid value for the output */ @@ -243,13 +249,15 @@ UWord16 rc_uni_dec_read_symbol_fastS_fx( /* do a binary search to find the symbol read */ sym_begin = 0; + move16(); sym_end = alphabet_size; /* the possible values are {sym_begin, .., sym_end - 1} */ + move16(); /* ceil(log2(x)) = 1 + floor(log2(x - 1)), for any x >= 2 */ /* floor(log2(y)) = 31 - norm_ul_float(y) = 30 - norm_l(y), for any 1 <= y <= 2 ^ 31 - 1 */ - ceil_log2_alphabet_size = sub( 31, norm_l( alphabet_size - 1 ) ); + ceil_log2_alphabet_size = sub( 31, norm_l( UL_subNsD( alphabet_size, 1 ) ) ); /* completely equivalent with 32 - norm_ul_float(alphabet_size - 1), but norm_l is faster */ - reversed_low = ( range << tot_shift ) - low; + reversed_low = UL_subNsD( UL_lshl( range, tot_shift ), low ); /* at most ceil_log2_alphabet_size steps are needed so that sym_end - sym_begin == 1 */ FOR( step = 0; step < ceil_log2_alphabet_size; step++ ) @@ -259,10 +267,12 @@ UWord16 rc_uni_dec_read_symbol_fastS_fx( IF( range * L_sub( L_shl( 1, tot_shift ), cum_freq_table[sym_middle] ) >= reversed_low ) { sym_begin = sym_middle; + move16(); } ELSE { sym_end = sym_middle; + move16(); } } @@ -270,6 +280,7 @@ UWord16 rc_uni_dec_read_symbol_fastS_fx( /* low was not modified */ rc_st_dec->rc_range = range; + move32(); rc_uni_dec_update_fx( rc_st_dec, cum_freq_table[sym_begin], sym_freq_table[sym_begin] ); @@ -314,18 +325,19 @@ static void rc_uni_dec_update_fx( ) { // Not adding basop because the value of rc_st_dec->rc_range exceeds Word32 - rc_st_dec->rc_low -= cum_freq * rc_st_dec->rc_range; + rc_st_dec->rc_low = UL_subNsD( rc_st_dec->rc_low, cum_freq * rc_st_dec->rc_range ); rc_st_dec->rc_range *= sym_freq; + move16(); /* rc_range was shifted right by up to 16, so at most two renormalizations are needed */ IF( rc_st_dec->rc_range < 0x01000000 ) { - rc_st_dec->rc_low = ( rc_st_dec->rc_low << 8 ) + rc_uni_dec_read_fx( rc_st_dec ); - rc_st_dec->rc_range <<= 8; + rc_st_dec->rc_low = UL_addNsD( UL_lshl( rc_st_dec->rc_low, 8 ), (UWord32) rc_uni_dec_read_fx( rc_st_dec ) ); + rc_st_dec->rc_range = UL_lshl( rc_st_dec->rc_range, 8 ); IF( rc_st_dec->rc_range < 0x01000000 ) { - rc_st_dec->rc_low = ( rc_st_dec->rc_low << 8 ) + rc_uni_dec_read_fx( rc_st_dec ); - rc_st_dec->rc_range <<= 8; + rc_st_dec->rc_low = UL_addNsD( UL_lshl( rc_st_dec->rc_low, 8 ), (UWord32) rc_uni_dec_read_fx( rc_st_dec ) ); + rc_st_dec->rc_range = UL_lshl( rc_st_dec->rc_range, 8 ); } } @@ -338,6 +350,65 @@ static void rc_uni_dec_update_fx( *-------------------------------------------------------------------*/ /*! r: Read bit */ +#ifdef IVAS_FLOAT_FIXED +UWord16 rc_uni_dec_read_bit( + RangeUniDecState *rc_st_dec /* i/o: RC State handle */ +) +{ + UWord32 val; + UWord32 low; /* local copy (1 to 5 uses) */ + UWord32 range; /* local copy (3 to 6 uses) */ + + low = rc_st_dec->rc_low; + move32(); + range = rc_st_dec->rc_range; + move32(); + + range = UL_lshr( range, 1 ); + + /* in case of bitstream errors it is possible that rc_low >= (rc_range << 1) */ + val = 0; + move32(); + /*basop comment : comparision of unsigned integers hence basops are not used*/ + IF( low >= range ) + { + val = UL_addNsD( val, 1 ); + low = UL_subNsD( low, range ); + + /* rc_range was already subtracted once from rc_low */ + IF( low >= range ) + { + rc_st_dec->bit_error_detected = 1; + move16(); + + /* for valid bitstreams, always low < range, therefore setting low = range */ + /* will always reach the bitstream error condition branch on the next call */ + rc_st_dec->rc_range = 0xFFFFFFFF; + move32(); + rc_st_dec->rc_low = rc_st_dec->rc_range; + move32(); + + /* the current value and all the following values are very likely incorrect */ + return 0; /* return the minimum valid value for the output */ + } + } + + /* rc_range was shifted right by 1, so at most one renormalization is needed */ + /*basop comment : comparision of unsigned integers hence basops are not used*/ + IF( range < 0x01000000 ) + { + low = UL_addNsD( UL_lshl( low, 8 ), (UWord32) rc_uni_dec_read( rc_st_dec ) ); + range = UL_lshl( range, 8 ); + } + + rc_st_dec->rc_low = low; + move32(); + rc_st_dec->rc_range = range; + move32(); + + return (UWord16) val; +} +#else uint16_t rc_uni_dec_read_bit( RangeUniDecState *rc_st_dec /* i/o: RC State handle */ ) @@ -385,6 +456,7 @@ uint16_t rc_uni_dec_read_bit( return (uint16_t) val; } +#endif /*-------------------------------------------------------------------* @@ -394,6 +466,80 @@ uint16_t rc_uni_dec_read_bit( *-------------------------------------------------------------------*/ /*! r: Read bit */ +#ifdef IVAS_FLOAT_FIXED +UWord16 rc_uni_dec_read_bit_prob_fast( + RangeUniDecState *rc_st_dec, /* i/o: RC State handle */ + const Word16 freq0, /* i : Frequency for symbol 0 */ + const UWord16 tot_shift /* i : Total frequency as a power of 2 */ +) +{ + UWord32 val; + UWord32 low; /* local copy (2 to 7 uses) */ + UWord32 range; /* local copy (5 to 9 uses) */ + + low = rc_st_dec->rc_low; + move32(); + range = rc_st_dec->rc_range; + move32(); + + range = UL_lshr( range, tot_shift ); + + /* in case of bitstream errors it is possible that low >= (1 << tot_shift) * range */ + /*basop comment : unsigned integers are getting compared hence basops are not used*/ + IF( low >= UL_lshl( range, tot_shift ) ) /* equivalent condition */ + { + rc_st_dec->bit_error_detected = 1; + move16(); + + /* for valid bitstreams, always low < range, therefore setting low = range */ + /* will always reach the bitstream error condition branch on the next call */ + rc_st_dec->rc_range = 0xFFFFFFFF; + move32(); + rc_st_dec->rc_low = rc_st_dec->rc_range; + move32(); + + /* the current value and all the following values are very likely incorrect */ + return 0; /* return the minimum valid value for the output */ + } + + val = 0; + move32(); + /*basop comment : unsigned comparision and multiplication of unsigned and signed hence basops are not used*/ + IF( low >= range * freq0 ) + { + val = UL_addNsD( val, 1 ); + + low = UL_subNsD( low, range * freq0 ); + /*basop comment : multiplication of two unsigned integers and result is stored in unsigned hence basops are not used*/ + range *= UL_subNsD( UL_lshl( 1, tot_shift ), freq0 ); /* freq1 = (1 << tot_shift) - freq0 */ + } + ELSE + { + /* basop comment : multiplication of two unsigned integers and result is stored in unsigned integer hence basops are not used*/ + range *= freq0; + } + + /* rc_range was shifted right by up to 16, so at most two renormalizations are needed */ + /*basop comment : comparision of unsigned integers hence basops are not used*/ + IF( range < 0x01000000 ) + { + low = UL_addNsD( UL_lshl( low, 8 ), (UWord32) rc_uni_dec_read( rc_st_dec ) ); + range = UL_lshl( range, 8 ); + IF( range < 0x01000000 ) + { + low = UL_addNsD( UL_lshl( low, 8 ), (UWord32) rc_uni_dec_read( rc_st_dec ) ); + range = UL_lshl( range, 8 ); + } + } + + rc_st_dec->rc_low = low; + move32(); + rc_st_dec->rc_range = range; + move32(); + + return (UWord16) val; +} +#else uint16_t rc_uni_dec_read_bit_prob_fast( RangeUniDecState *rc_st_dec, /* i/o: RC State handle */ const int16_t freq0, /* i : Frequency for symbol 0 */ @@ -453,6 +599,7 @@ uint16_t rc_uni_dec_read_bit_prob_fast( return (uint16_t) val; } +#endif /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 42ff82c70..c20c80585 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -883,7 +883,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( move16(); st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpar->subframes_rendered; move16(); - mvs2s( st_ivas->hSpar->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + Copy( st_ivas->hSpar->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } ELSE IF( st_ivas->hSpatParamRendCom != NULL ) { @@ -895,7 +895,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( move16(); st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; move16(); - mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + Copy( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } } @@ -1325,13 +1325,13 @@ ivas_error ivas_sba_dec_reconfigure_fx( test(); IF( st_ivas->hSpatParamRendCom != NULL && EQ_16( st_ivas->hSpatParamRendCom->slot_size, st_ivas->hTcBuffer->n_samples_granularity ) ) { - mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes; move16(); st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; move16(); } - mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpar->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpar->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); st_ivas->hSpar->nb_subframes = st_ivas->hTcBuffer->nb_subframes; move16(); st_ivas->hSpar->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index 16e93aeb6..d433d3712 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -719,7 +719,7 @@ static void ivas_sba_dirac_stereo_compute_td_stefi_nrgs( } ELSE { - set_val_Word32( hStereoDft->hb_stefi_sig_fx + hStereoDft->hb_stefi_delay, 0, output_frame ); + set32_fx( hStereoDft->hb_stefi_sig_fx + hStereoDft->hb_stefi_delay, 0, output_frame ); #ifdef MSAN_FIX hStereoDft->hb_nrg_subr_fx[0] = 0; move32(); @@ -1317,7 +1317,7 @@ void ivas_sba_dirac_stereo_dec_fx( IF( ( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) && !mcmasa ) { - set_val_Word32( hStereoDft->res_pred_gain_fx, MAX_32, 3 * STEREO_DFT_BAND_MAX ); + set32_fx( hStereoDft->res_pred_gain_fx, MAX_32, 3 * STEREO_DFT_BAND_MAX ); } /* DFT Stereo upmix */ @@ -1377,7 +1377,7 @@ void ivas_sba_dirac_stereo_dec_fx( /* reset the other channels to 0 (they are not used since here) */ FOR( Word16 ch = CPE_CHANNELS; ch < st_ivas->nchan_transport; ch++ ) { - set_val_Word32( output[ch], 0, output_frame ); + set32_fx( output[ch], 0, output_frame ); } #ifdef MSAN_FIX diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index b30b8533c..54773e30c 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -145,8 +145,8 @@ void ivas_sba2mc_cldfb_fixed( FOR( n = 0; n < nb_channels_out; n++ ) { - set_l( realOut_fx[n], 0, i_mult( MAX_PARAM_SPATIAL_SUBFRAMES, nb_bands ) ); - set_l( imagOut_fx[n], 0, i_mult( MAX_PARAM_SPATIAL_SUBFRAMES, nb_bands ) ); + set32_fx( realOut_fx[n], 0, i_mult( MAX_PARAM_SPATIAL_SUBFRAMES, nb_bands ) ); + set32_fx( imagOut_fx[n], 0, i_mult( MAX_PARAM_SPATIAL_SUBFRAMES, nb_bands ) ); FOR( m = 0; m < nb_channels_in; m++ ) { diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 246c284cc..25d907d3c 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -1020,6 +1020,7 @@ static void stereo_dft_generate_comfort_noise_fx( FOR( i = 0; i < shr( sub( st->last_L_frame, hFdCngCom->startBand ), 1 ); i++ ) { tmp = *( cngNoiseLevel_hist + shl( i, 1 ) ); + move32(); tmp = L_add( tmp, *( cngNoiseLevel_hist + add( shl( i, 1 ), 1 ) ) ); *ptr_cng++ = L_shr( tmp, 1 ); move32(); diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 09fc9f2fd..d14221712 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -913,7 +913,7 @@ void stereo_dft_dec_analyze_fx( q_DFT = add( q_DFT, q_shift ); IF( sub( q_out_DFT[chan], q_DFT ) > 0 ) { - FOR( int j = 0; j < NFFT; j++ ) + FOR( Word32 j = 0; j < NFFT; j++ ) { out_DFT_fx[chan][j] = L_shr( out_DFT_fx[chan][j], sub( q_out_DFT[chan], q_DFT ) ); move32(); @@ -923,7 +923,7 @@ void stereo_dft_dec_analyze_fx( } ELSE { - FOR( int j = 0; j < NFFT; j++ ) + FOR( Word32 j = 0; j < NFFT; j++ ) { DFT_fx[j] = L_shr( DFT_fx[j], sub( q_DFT, q_out_DFT[chan] ) ); move32(); diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index e15f0fb4f..3a2cea520 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -333,7 +333,7 @@ static void stereo_dft_dec_open_fx( hStereoDft->win_8k_fx = dft_win_8k_fx; /*Bands: find the number of bands, Nyquist freq. is not taken into account*/ - set_s( hStereoDft->band_res, hStereoDft->hConfig->band_res, STEREO_DFT_DEC_DFT_NB ); + set16_fx( hStereoDft->band_res, hStereoDft->hConfig->band_res, STEREO_DFT_DEC_DFT_NB ); hStereoDft->nbands = stereo_dft_band_config_fx( hStereoDft->band_limits, hStereoDft->band_res[0], hStereoDft->NFFT, DEC ); move16(); @@ -739,7 +739,7 @@ void stereo_dft_dec_synthesize_fx( win2 = hStereoDft->win232ms_fx; p_DFT = DFT[chan]; - set_val_Word32( output, 0, NS2SA( outputFs, FRAME_SIZE_NS ) ); + set32_fx( output, 0, NS2SA( outputFs, FRAME_SIZE_NS ) ); /* deactivating the spectrum scrambling on active speech */ test(); @@ -1325,11 +1325,11 @@ void stereo_dft_dec_res_fx( /* flush memories when switching residual coding on */ IF( EQ_16( hCPE->hStereoDft->res_cod_mode[STEREO_DFT_OFFSET - 1], STEREO_DFT_RES_COD_OFF ) ) { - set_val_Word32( hCPE->hStereoDft->res_cod_mem_fx, 0, STEREO_DFT_OVL_8k ); + set32_fx( hCPE->hStereoDft->res_cod_mem_fx, 0, STEREO_DFT_OVL_8k ); hCPE->hStereoDft->q_res_cod_mem_fx = Q16; move16(); - set_val_Word32( hCPE->input_mem_fx[1], 0, NS2SA( 8000, STEREO_DFT32MS_OVL_NS ) ); - set_val_Word16( hCPE->hStereoDft->hBpf->pst_old_syn_fx, 0, STEREO_DFT_NBPSF_PIT_MAX_8k ); + set32_fx( hCPE->input_mem_fx[1], 0, NS2SA( 8000, STEREO_DFT32MS_OVL_NS ) ); + set16_fx( hCPE->hStereoDft->hBpf->pst_old_syn_fx, 0, STEREO_DFT_NBPSF_PIT_MAX_8k ); hCPE->hStereoDft->hBpf->pst_mem_deemp_err_fx = 0; move16(); } @@ -1406,7 +1406,7 @@ void stereo_dft_dec_res_fx( } ELSE IF( hCPE->hCoreCoder[0]->last_core == ACELP_CORE ) { - set_val_Word16( hCPE->hStereoDft->hBpf->pst_old_syn_fx, 0, STEREO_DFT_NBPSF_PIT_MAX_8k ); + set16_fx( hCPE->hStereoDft->hBpf->pst_old_syn_fx, 0, STEREO_DFT_NBPSF_PIT_MAX_8k ); hCPE->hStereoDft->hBpf->pst_mem_deemp_err_fx = 0; move16(); Copy_Scale_sig_16_32( out_16, output, L_FRAME8k, 16 ); diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index 48850cf1b..c1c4a40b0 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -237,7 +237,7 @@ void stereo_mdct_core_dec_fx( nTnsBitsTCX10[ch][1] = 0; move16(); - set_s( param_lpc[ch], 0, NPRM_LPC_NEW ); + set16_fx( param_lpc[ch], 0, NPRM_LPC_NEW ); } set16_fx( ms_mask[0], 0, MAX_SFB ); diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index 79eac072c..55b793bda 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -43,6 +43,7 @@ #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_rom_com_fx.h" +#include "ivas_prot_fx.h" #endif #ifndef IVAS_FLOAT_FIXED @@ -136,7 +137,7 @@ Word32 power_table[32 + 1] = { 850883136, 954706496, 1071198464, 1201904384, 1348558720, 1513107968, 1697734912, 1904890240, 2137321728 }; // Q29 -void tdm_configure_dec( +void tdm_configure_dec_fx( const Word16 ivas_format, /* i : IVAS format */ const Word16 ism_mode, /* i : ISM mode in combined format */ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ @@ -195,7 +196,7 @@ void tdm_configure_dec( /* Get few parameters needed to decode the bitrate allocated to each channel */ /* Get the coder_type of the secondary channel (last parameter on 2 bits) */ - sts[1]->coder_type = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SECONDARY_SIGNALLING, TDM_SECONDARY_SIGNALLING ); + sts[1]->coder_type = get_indice_st( sts[0], element_brate_adapt, sub( bstr_last_pos, TDM_SECONDARY_SIGNALLING ), TDM_SECONDARY_SIGNALLING ); move16(); /* Get the LRTD config flag: 1 = LRTD configuration, favor closer bitrate per channel; @@ -315,7 +316,6 @@ void tdm_configure_dec( /*sts[1]->tdm_inst_ratio_idx = sts[0]->tdm_inst_ratio_idx;*/ - test(); test(); IF( EQ_16( hCPE->nchan_out, 1 ) && hCPE->hStereoDftDmx != NULL ) { @@ -370,7 +370,7 @@ void tdm_configure_dec( * bitbudget distribution between channels (taking into account also metadata bitbudget) *----------------------------------------------------------------*/ - tdm_bit_alloc( ivas_format, ism_mode, hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, + tdm_bit_alloc( ivas_format, ism_mode, L_add( L_sub( hCPE->element_brate, L_mult0( nb_bits_metadata, FRAMES_PER_SEC ) ), hCPE->brate_surplus ), hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 18a062f60..9becbc8cc 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -2406,7 +2406,7 @@ ivas_error IVAS_DEC_FeedCustomLsData( /* Loudspeaker LFE */ hLsSetupCustom->num_lfe = hLsCustomData.num_lfe; move16(); - mvs2s( hLsCustomData.lfe_idx, hLsSetupCustom->lfe_idx, hLsCustomData.num_lfe ); + Copy( hLsCustomData.lfe_idx, hLsSetupCustom->lfe_idx, hLsCustomData.num_lfe ); return IVAS_ERR_OK; } diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index bf05a9b2b..5b2e33cfe 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -4823,7 +4823,7 @@ void TBEreset_dec( hBWE_TD->bwe_non_lin_prev_scale = 0.f; #endif #ifdef IVAS_FLOAT_FIXED - set_val_Word16( hBWE_TD->old_bwe_exc_fx, 0, PIT16k_MAX * 2 ); + set16_fx( hBWE_TD->old_bwe_exc_fx, 0, PIT16k_MAX * 2 ); hBWE_TD->bwe_non_lin_prev_scale_fx = L_deposit_l( 0 ); st->prev_Q_bwe_exc = 31; #endif @@ -4843,16 +4843,16 @@ void TBEreset_dec( set_f( hBWE_TD->state_syn_shbexc, 0, L_SHB_LAHEAD / 4 ); #endif #ifdef IVAS_FLOAT_FIXED - set_val_Word16( hBWE_TD->mem_genSHBexc_filt_down_shb_fx, 0, ( 2 * ALLPASSSECTIONS_STEEP + 1 ) ); - set_val_Word16( hBWE_TD->state_lpc_syn_fx, 0, LPC_SHB_ORDER ); - set_val_Word16( hBWE_TD->state_syn_shbexc_fx, 0, L_SHB_LAHEAD / 4 ); + set16_fx( hBWE_TD->mem_genSHBexc_filt_down_shb_fx, 0, ( 2 * ALLPASSSECTIONS_STEEP + 1 ) ); + set16_fx( hBWE_TD->state_lpc_syn_fx, 0, LPC_SHB_ORDER ); + set16_fx( hBWE_TD->state_syn_shbexc_fx, 0, L_SHB_LAHEAD / 4 ); #endif set_f( hBWE_TD->syn_overlap, 0, L_SHB_LAHEAD ); #ifndef IVAS_FLOAT_FIXED set_f( hBWE_TD->mem_csfilt, 0, 2 ); #endif #ifdef IVAS_FLOAT_FIXED - set_val_Word32( hBWE_TD->mem_csfilt_fx, 0, 2 ); + set32_fx( hBWE_TD->mem_csfilt_fx, 0, 2 ); #endif } else if ( st->bwidth == SWB || st->bwidth == FB ) @@ -4865,7 +4865,7 @@ void TBEreset_dec( #ifdef IVAS_FLOAT_FIXED swb_tbe_reset_fx( hBWE_TD->mem_csfilt_fx, hBWE_TD->mem_genSHBexc_filt_down_shb_fx, hBWE_TD->state_lpc_syn_fx, hBWE_TD->syn_overlap_fx, hBWE_TD->state_syn_shbexc_fx, &( hBWE_TD->tbe_demph_fx ), &( hBWE_TD->tbe_premph_fx ), hBWE_TD->mem_stp_swb_fx, &( hBWE_TD->gain_prec_swb_fx ) ); - set_val_Word16( hBWE_TD->GainShape_Delay_fx, 0, NUM_SHB_SUBFR / 2 ); + set16_fx( hBWE_TD->GainShape_Delay_fx, 0, NUM_SHB_SUBFR / 2 ); #endif set_f( hBWE_TD->int_3_over_2_tbemem_dec, 0.f, INTERP_3_2_MEM_LEN ); @@ -4897,7 +4897,7 @@ void TBEreset_dec( fb_tbe_reset_synth( hBWE_TD->fbbwe_hpf_mem, &hBWE_TD->prev_fbbwe_ratio ); #endif #ifdef IVAS_FLOAT_FIXED - set_val_Word16( hBWE_TD->fb_state_lpc_syn_fx, 0, LPC_SHB_ORDER ); + set16_fx( hBWE_TD->fb_state_lpc_syn_fx, 0, LPC_SHB_ORDER ); hBWE_TD->fb_tbe_demph_fx = 0; fb_tbe_reset_synth_fx( hBWE_TD->fbbwe_hpf_mem_fx, hBWE_TD->fbbwe_hpf_mem_fx_Q, &hBWE_TD->prev_fbbwe_ratio_fx ); #endif diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 41d198f72..091915667 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -677,7 +677,7 @@ void ivas_wb_tbe_dec_fx( #endif TD_BWE_DEC_HANDLE hBWE_TD; hBWE_TD = st_fx->hBWE_TD; - set_val_Word32( &dummy2[0], 0, HILBERT_MEM_SIZE ); + set32_fx( &dummy2[0], 0, HILBERT_MEM_SIZE ); IF( st_fx->bws_cnt == 0 ) { /* Initialization */ @@ -1346,7 +1346,7 @@ void wb_tbe_dec_fx( #endif TD_BWE_DEC_HANDLE hBWE_TD; hBWE_TD = st_fx->hBWE_TD; - set_val_Word32( &dummy2[0], 0, HILBERT_MEM_SIZE ); + set32_fx( &dummy2[0], 0, HILBERT_MEM_SIZE ); IF( st_fx->bws_cnt == 0 ) { /* Initialization */ diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index ef4d0ff73..d4f558893 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -145,12 +145,12 @@ ivas_error TonalMDCTConceal_Init_ivas_fx( hTonalMDCTConc->tcx_cfg = hTcxCfg; hTonalMDCTConc->lastBlockData.spectralData = hTonalMDCTConc->spectralDataBuffers[0]; #ifdef MSAN_FIX - set_s( hTonalMDCTConc->lastBlockData.spectralData, 0, L_FRAME_MAX ); + set16_fx( hTonalMDCTConc->lastBlockData.spectralData, 0, L_FRAME_MAX ); #endif move16(); hTonalMDCTConc->secondLastBlockData.spectralData = hTonalMDCTConc->spectralDataBuffers[1]; #ifdef MSAN_FIX - set_s( hTonalMDCTConc->secondLastBlockData.spectralData, 0, L_FRAME_MAX ); + set16_fx( hTonalMDCTConc->secondLastBlockData.spectralData, 0, L_FRAME_MAX ); #endif move16(); hTonalMDCTConc->secondLastPowerSpectrum = hTonalMDCTConc->secondLastBlockData.spectralData; @@ -159,12 +159,12 @@ ivas_error TonalMDCTConceal_Init_ivas_fx( move16(); hTonalMDCTConc->lastBlockData.scaleFactors = hTonalMDCTConc->scaleFactorsBuffers[0]; #ifdef MSAN_FIX - set_s( hTonalMDCTConc->lastBlockData.scaleFactors, 0, FDNS_NPTS ); + set16_fx( hTonalMDCTConc->lastBlockData.scaleFactors, 0, FDNS_NPTS ); #endif move16(); hTonalMDCTConc->secondLastBlockData.scaleFactors = hTonalMDCTConc->scaleFactorsBuffers[1]; #ifdef MSAN_FIX - set_s( hTonalMDCTConc->secondLastBlockData.scaleFactors, 0, FDNS_NPTS ); + set16_fx( hTonalMDCTConc->secondLastBlockData.scaleFactors, 0, FDNS_NPTS ); #endif move16(); hTonalMDCTConc->lastBlockData.scaleFactors_exp = hTonalMDCTConc->scaleFactorsBuffers_exp[0]; diff --git a/lib_dec/waveadjust_fec_dec_fx.c b/lib_dec/waveadjust_fec_dec_fx.c index 095a56bc9..d305ad27d 100644 --- a/lib_dec/waveadjust_fec_dec_fx.c +++ b/lib_dec/waveadjust_fec_dec_fx.c @@ -920,7 +920,7 @@ void concealment_decode_fix( Word16 curr_mode, Word32 *invkoef, Word16 *invkoef_ IF( EQ_16( curr_mode, 1 ) ) { /* copy the data of the last frame */ - mvr2r_Word32( plcInfo->data_reci2_fx, invkoef, N ); + Copy32( plcInfo->data_reci2_fx, invkoef, N ); *invkoef_scale = plcInfo->data_reci2_scale; move16(); /* sign randomization */ @@ -1416,7 +1416,7 @@ static Word16 waveform_adj_fix( Word16 *overlapbuf, /* use last good signal for noise generation */ add_noise( sbuf, outx_new_n1, outdata2, tmp, nsapp_gain, nsapp_gain_n, 1 ); /* save current (noisy) output from IMDCT */ - mvr2r_Word16( outx_new, data_noise, tmp ); + Copy( outx_new, data_noise, tmp ); /* overlapbuf can now be filled with sbuf, needed for subsequently lost frames */ Copy( pitch125_data, &overlapbuf[Framesize / 4], shr( imult1616( 3, Framesize ), 2 ) ); } @@ -1481,7 +1481,7 @@ void waveform_adj2_fix( Word16 *overlapbuf, /* save current (noisy) output from IMDCT */ IF( bfi ) { - mvr2r_Word16( outx_new, noise_ptr, size ); + Copy( outx_new, noise_ptr, size ); } } test(); diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index e8db91a74..ccc4498d9 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -611,7 +611,7 @@ void core_signal_analysis_high_bitrate_fx( } /* Copy memory */ - mvr2r_Word16( lsp_new, st->lspold_enc_fx, M ); + Copy( lsp_new, st->lspold_enc_fx, M ); } } } diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index 0265ac6d1..06691ff51 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -640,7 +640,7 @@ void ivas_enc_cov_handler_process_fx( { FOR( j = 0; j < num_ch; j++ ) { - mvl2l( cov_real[i][j], cov_dtx_real[i][j], pFb->filterbank_num_bands ); + Copy32( cov_real[i][j], cov_dtx_real[i][j], pFb->filterbank_num_bands ); q_cov_dtx_real[i][j] = q_cov_real[i][j]; move16(); } @@ -654,9 +654,9 @@ void ivas_enc_cov_handler_process_fx( { FOR( j = 0; j < num_ch; j++ ) { - mvl2l( cov_real[i][j], hCovEnc->pCov_dtx_state->pPrior_cov_real_fx[i][j], pFb->filterbank_num_bands ); - mvl2l( cov_real[i][j], cov_dtx_real[i][j], pFb->filterbank_num_bands ); - mvs2s( hCovEnc->pCov_state->q_cov_real_per_band[i][j], hCovEnc->pCov_dtx_state->q_cov_real_per_band[i][j], pFb->filterbank_num_bands ); + Copy32( cov_real[i][j], hCovEnc->pCov_dtx_state->pPrior_cov_real_fx[i][j], pFb->filterbank_num_bands ); + Copy32( cov_real[i][j], cov_dtx_real[i][j], pFb->filterbank_num_bands ); + Copy( hCovEnc->pCov_state->q_cov_real_per_band[i][j], hCovEnc->pCov_dtx_state->q_cov_real_per_band[i][j], pFb->filterbank_num_bands ); } } hCovEnc->prior_dtx_present = 1; @@ -684,7 +684,7 @@ void ivas_enc_cov_handler_process_fx( { FOR( j = 0; j < num_ch; j++ ) { - mvl2l( hCovEnc->pCov_dtx_state->pPrior_cov_real_fx[i][j], cov_dtx_real[i][j], pFb->filterbank_num_bands ); + Copy32( hCovEnc->pCov_dtx_state->pPrior_cov_real_fx[i][j], cov_dtx_real[i][j], pFb->filterbank_num_bands ); } } hCovEnc->prior_dtx_present = 1; diff --git a/lib_enc/ivas_front_vad.c b/lib_enc/ivas_front_vad.c index 6182cd730..7a835228e 100644 --- a/lib_enc/ivas_front_vad.c +++ b/lib_enc/ivas_front_vad.c @@ -513,7 +513,7 @@ ivas_error front_vad_spar( floatToFixed_arr( st->mem_decim2, st->mem_decim2_fx, Q10, 3 ); // st->mem_wsp_fx = (Word16) floatToFixed( st->mem_wsp, Q_inp_12k8 ); - mvr2r_Word16( st->old_wsp_fx, old_wsp_fx, L_WSP_MEM ); + Copy( st->old_wsp_fx, old_wsp_fx, L_WSP_MEM ); wsp = old_wsp + L_WSP_MEM; wsp_fx = old_wsp_fx + L_WSP_MEM; @@ -769,7 +769,7 @@ ivas_error front_vad_spar( #if 0 vad_param_updt( st, corr_shift, corr_shift, A, st->pitch[1], &hFrontVad, 1 ); #else - mvr2r_Word16( st->pitch, st->pitch, 3 ); + // Copy( st->pitch, st->pitch, 3 ); corr_shift_fx = (Word16) floatToFixed( corr_shift, Q15 ); hFrontVad->hVAD->running_avg_fx = (Word16) floatToFixed( hFrontVad->hVAD->running_avg, Q15 ); hFrontVad->hVAD->ra_deltasum_fx = (Word16) floatToFixed( hFrontVad->hVAD->ra_deltasum, Q15 ); diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc.c b/lib_enc/ivas_stereo_mdct_stereo_enc.c index 9528fa9cb..5019512eb 100644 --- a/lib_enc/ivas_stereo_mdct_stereo_enc.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc.c @@ -1015,8 +1015,8 @@ void ms_inv_mask_processing_fx( FOR( sfb = 0; sfb < maxSfb; sfb++ ) { - mvl2l( &x_0_fx[sfbConf->sfbOffset[sfb]], &x_inv_0_fx[sfbConf->sfbOffset[sfb]], sfbConf->sfbOffset[sfb + 1] - sfbConf->sfbOffset[sfb] ); - mvl2l( &x_1_fx[sfbConf->sfbOffset[sfb]], &x_inv_1_fx[sfbConf->sfbOffset[sfb]], sfbConf->sfbOffset[sfb + 1] - sfbConf->sfbOffset[sfb] ); + Copy32( &x_0_fx[sfbConf->sfbOffset[sfb]], &x_inv_0_fx[sfbConf->sfbOffset[sfb]], sfbConf->sfbOffset[sfb + 1] - sfbConf->sfbOffset[sfb] ); + Copy32( &x_1_fx[sfbConf->sfbOffset[sfb]], &x_inv_1_fx[sfbConf->sfbOffset[sfb]], sfbConf->sfbOffset[sfb + 1] - sfbConf->sfbOffset[sfb] ); IF( EQ_16( ms_mask[iSubframe][sfb], 0 ) ) { diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 5418a6714..f651907e9 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -1886,7 +1886,7 @@ Word16 ivas_smc_gmm_fx( temp32_log = L_add( BASOP_Util_Log2( ps_sta_fx ), L_shl( ps_sta_exp, Q25 ) ); temp32_log = Mpy_32_32( temp32_log, 1488522239 ); /*logf(x) = log2(x)*logf(2)*/ *pFV_fx++ = L_shr( temp32_log, Q5 ); // logf( ps_sta + 1e-5f ); - mvr2r_Word32( &PS_norm_fx[LOWEST_FBIN], hSpMusClas->past_PS_fx, HIGHEST_FBIN - LOWEST_FBIN ); + Copy32( &PS_norm_fx[LOWEST_FBIN], hSpMusClas->past_PS_fx, HIGHEST_FBIN - LOWEST_FBIN ); /* save ps_diff and ps_sta features for XTALK and UNCLR classifier */ IF( hStereoClassif != NULL ) @@ -1981,7 +1981,7 @@ Word16 ivas_smc_gmm_fx( } /* update */ - mvr2r_Word32( FV_fx, hSpMusClas->prev_FV_fx, N_SMC_FEATURES ); + Copy32( FV_fx, hSpMusClas->prev_FV_fx, N_SMC_FEATURES ); /*------------------------------------------------------------------* * Non-linear power transformation (boxcox) on certain features *------------------------------------------------------------------*/ @@ -2368,7 +2368,7 @@ Word16 ivas_smc_gmm_fx( *------------------------------------------------------------------*/ /* update buffer of past non-binary decisions */ - mvr2r_Word16( &hSpMusClas->past_dlp_fx[0], &hSpMusClas->past_dlp_fx[1], HANG_LEN - 2 ); + Copy( &hSpMusClas->past_dlp_fx[0], &hSpMusClas->past_dlp_fx[1], HANG_LEN - 2 ); hSpMusClas->past_dlp_fx[0] = extract_l( L_shr( dlp_fx, 10 ) ); move16(); mvr2r( &hSpMusClas->past_dlp_mean_ST[0], &hSpMusClas->past_dlp_mean_ST[1], HANG_LEN - 2 ); diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index e9c76787d..861d0fdd0 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -3114,12 +3114,12 @@ static ivas_error ivas_rend_crendConvolver( hCrend = pCrend->hCrend; - IF( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ), IVAS_ERR_OK ) ) { return error; } @@ -3147,8 +3147,8 @@ static ivas_error ivas_rend_crendConvolver( IF( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { - set_val_Word32( &hCrend->freq_buffer_re_diffuse_fx[offset_diffuse], 0, subframe_length ); - set_val_Word32( &hCrend->freq_buffer_im_diffuse_fx[offset_diffuse], 0, subframe_length ); + set32_fx( &hCrend->freq_buffer_re_diffuse_fx[offset_diffuse], 0, subframe_length ); + set32_fx( &hCrend->freq_buffer_im_diffuse_fx[offset_diffuse], 0, subframe_length ); } i = 0; @@ -3182,14 +3182,14 @@ static ivas_error ivas_rend_crendConvolver( dbgwrite_txt( pFreq_buf_re, subframe_length, "Fixed_pFreq_buf_re_mdft.txt", NULL ); dbgwrite_txt( pFreq_buf_im, subframe_length, "Fixed_pFreq_buf_im_mdft.txt", NULL ); #endif - i++; + i = add( i, 1 ); } } FOR( j = 0; j < nchan_out; j++ ) { - set_val_Word32( tmp_out_re, 0, subframe_length ); - set_val_Word32( tmp_out_im, 0, subframe_length ); + set32_fx( tmp_out_re, 0, subframe_length ); + set32_fx( tmp_out_im, 0, subframe_length ); i = 0; move16(); FOR( idx_in = 0; idx_in < nchan_in; idx_in++ ) @@ -3590,7 +3590,7 @@ ivas_error ivas_rend_crendProcess( /* move to output */ FOR( i = 0; i < nchan_out; i++ ) { - mvr2r_Word32( pcm_tmp_fx[i], output_fx[i], imult1616( num_subframes, subframe_len ) ); + Copy32( pcm_tmp_fx[i], output_fx[i], imult1616( num_subframes, subframe_len ) ); } pop_wmops(); @@ -3890,7 +3890,7 @@ ivas_error ivas_rend_crendProcessSubframe( /* move to output */ FOR( ch = 0; ch < nchan_out; ch++ ) { - mvr2r_Word32( pcm_tmp_fx[ch], output[ch], n_samples_to_render ); + Copy32( pcm_tmp_fx[ch], output[ch], n_samples_to_render ); } hTcBuffer->subframes_rendered = last_sf; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 09c8f2a87..bf2799309 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1421,8 +1421,8 @@ static void ivas_dirac_dec_binaural_internal_fx( ELSE IF( EQ_16( config_data.nchan_transport, 2 ) ) /* Stereo signal transmitted as mono with DFT stereo */ { /* At mono input duplicate the channel to dual-mono */ - mvl2l( Cldfb_RealBuffer_in_fx[0][slot], Cldfb_RealBuffer_in_fx[1][slot], nBins ); - mvl2l( Cldfb_ImagBuffer_in_fx[0][slot], Cldfb_ImagBuffer_in_fx[1][slot], nBins ); + Copy32( Cldfb_RealBuffer_in_fx[0][slot], Cldfb_RealBuffer_in_fx[1][slot], nBins ); + Copy32( Cldfb_ImagBuffer_in_fx[0][slot], Cldfb_ImagBuffer_in_fx[1][slot], nBins ); q_cldfb[1][slot] = q_cldfb[0][slot]; move16(); } @@ -1498,8 +1498,8 @@ static void ivas_dirac_dec_binaural_internal_fx( v_multc_fixed_16( Cldfb_RealBuffer_in_fx[0][slot], 23170, Cldfb_RealBuffer_in_fx[0][slot], nBins ); v_multc_fixed_16( Cldfb_ImagBuffer_in_fx[0][slot], 23170, Cldfb_ImagBuffer_in_fx[0][slot], nBins ); - mvl2l( Cldfb_RealBuffer_in_fx[0][slot], Cldfb_RealBuffer_in_fx[1][slot], nBins ); - mvl2l( Cldfb_ImagBuffer_in_fx[0][slot], Cldfb_ImagBuffer_in_fx[1][slot], nBins ); + Copy32( Cldfb_RealBuffer_in_fx[0][slot], Cldfb_RealBuffer_in_fx[1][slot], nBins ); + Copy32( Cldfb_ImagBuffer_in_fx[0][slot], Cldfb_ImagBuffer_in_fx[1][slot], nBins ); q_cldfb[1][slot] = q_cldfb[0][slot]; move16(); } @@ -7929,8 +7929,8 @@ static void ivas_masa_ext_rend_parambin_internal_fx( v_multc_fixed( Cldfb_RealBuffer_in_fx[0][slot], 151800249 /* INV_SQRT_2 in Q31 */, Cldfb_RealBuffer_in_fx[0][slot], nBins ); v_multc_fixed( Cldfb_ImagBuffer_in_fx[0][slot], 151800249 /* INV_SQRT_2 in Q31 */, Cldfb_ImagBuffer_in_fx[0][slot], nBins ); - mvl2l( Cldfb_RealBuffer_in_fx[0][slot], Cldfb_RealBuffer_in_fx[1][slot], nBins ); - mvl2l( Cldfb_ImagBuffer_in_fx[0][slot], Cldfb_ImagBuffer_in_fx[1][slot], nBins ); + Copy32( Cldfb_RealBuffer_in_fx[0][slot], Cldfb_RealBuffer_in_fx[1][slot], nBins ); + Copy32( Cldfb_ImagBuffer_in_fx[0][slot], Cldfb_ImagBuffer_in_fx[1][slot], nBins ); } } } diff --git a/lib_rend/ivas_omasa_ana.c b/lib_rend/ivas_omasa_ana.c index 630865169..f231cc0a7 100644 --- a/lib_rend/ivas_omasa_ana.c +++ b/lib_rend/ivas_omasa_ana.c @@ -1087,8 +1087,8 @@ static void ivas_omasa_dmx_fx( { set_zero_fx( data_out_f_fx[i], input_frame ); } - set_s( data_e, 0, 4 ); - set_s( in_e, 0, 960 ); + set16_fx( data_e, 0, 4 ); + set16_fx( in_e, 0, 960 ); FOR( i = 0; i < nchan_ism; i++ ) { diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 557105d43..66475c3ed 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1922,12 +1922,12 @@ static void clear_buffers_fx( FOR( branch_idx = 0; branch_idx < IVAS_REV_MAX_NR_BRANCHES; branch_idx++ ) { delay_line = &( hReverb->delay_line[branch_idx] ); - set_val_Word32( delay_line->pBuffer_fx, 0, delay_line->MaxDelay ); + set32_fx( delay_line->pBuffer_fx, 0, delay_line->MaxDelay ); delay_line->BufferPos = 0; move16(); iirFilter = &( hReverb->t60[branch_idx] ); - set_val_Word32( iirFilter->pBuffer_fx, 0, iirFilter->MaxTaps ); + set32_fx( iirFilter->pBuffer_fx, 0, iirFilter->MaxTaps ); } ivas_reverb_t2f_f2t_ClearHistory( &hReverb->fft_filter_ols ); @@ -3102,7 +3102,9 @@ static void reverb_block_fx( FOR( ns = 0; ns < inner_bsize; ns++ ) { pO0[ns] = L_add( imult3216( pOutput_i_fx[ns], mixer_0_i ), pO0[ns] ); /* mixer ch 0 */ + move32(); pO1[ns] = L_add( imult3216( pOutput_i_fx[ns], mixer_1_i ), pO1[ns] ); /* mixer ch 1 */ + move32(); } } @@ -3113,15 +3115,18 @@ static void reverb_block_fx( FOR( ns = 0; ns < inner_bsize; ns++ ) { pFeedback_input_fx[ns] = L_shr( pIn[ns], 3 ); // to make the Qfactor similar to pOutput + move32(); } FOR( j = 0; j < nr_branches; j++ ) { Word32 gain_matrix_j_i = hReverb->gain_matrix_fx[j][i]; + move32(); Word32 *pOutput = &ppOutput_fx[j][0]; FOR( ns = 0; ns < inner_bsize; ns++ ) { pFeedback_input_fx[ns] = ( L_add( Mpy_32_32( gain_matrix_j_i, pOutput[ns] ), pFeedback_input_fx[ns] ) ); + move32(); } } @@ -3563,8 +3568,8 @@ ivas_error ivas_reverb_process_fx( } ELSE { - mvr2r_Word32( tmp1_fx, &pcm_out_fx[0][i_mult( i_ts, hReverb->full_block_size )], hReverb->full_block_size ); - mvr2r_Word32( tmp2_fx, &pcm_out_fx[1][i_mult( i_ts, hReverb->full_block_size )], hReverb->full_block_size ); + Copy32( tmp1_fx, &pcm_out_fx[0][i_mult( i_ts, hReverb->full_block_size )], hReverb->full_block_size ); + Copy32( tmp2_fx, &pcm_out_fx[1][i_mult( i_ts, hReverb->full_block_size )], hReverb->full_block_size ); } return IVAS_ERR_OK; diff --git a/lib_rend/ivas_reverb_delay_line.c b/lib_rend/ivas_reverb_delay_line.c index 0de9e386c..425afce0f 100644 --- a/lib_rend/ivas_reverb_delay_line.c +++ b/lib_rend/ivas_reverb_delay_line.c @@ -71,7 +71,7 @@ void ivas_rev_delay_line_init( pDelay->pBuffer_fx = memory_buffer; move32(); - set_val_Word32( pDelay->pBuffer_fx, 0, pDelay->MaxDelay ); + set32_fx( pDelay->pBuffer_fx, 0, pDelay->MaxDelay ); pDelay->BufferPos = 0; move16(); pDelay->Gain_fx = ONE_IN_Q14; diff --git a/lib_rend/ivas_reverb_iir_filter.c b/lib_rend/ivas_reverb_iir_filter.c index 51404ad5a..4129a61e6 100644 --- a/lib_rend/ivas_reverb_iir_filter.c +++ b/lib_rend/ivas_reverb_iir_filter.c @@ -69,7 +69,7 @@ void ivas_reverb_iir_filt_init( move32(); } - set_val_Word32( iirFilter->pBuffer_fx, 0, iirFilter->MaxTaps ); + set32_fx( iirFilter->pBuffer_fx, 0, iirFilter->MaxTaps ); return; } diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 3e9261af1..e6642cc3e 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -960,8 +960,8 @@ void rotateFrame_shd( /* initialize rotation matrices with zeros */ FOR( i = 0; i < HEADROT_SHMAT_DIM; i++ ) { - set_val_Word16( SHrotmat_prev[i], 0, HEADROT_SHMAT_DIM ); - set_val_Word16( SHrotmat[i], 0, HEADROT_SHMAT_DIM ); + set16_fx( SHrotmat_prev[i], 0, HEADROT_SHMAT_DIM ); + set16_fx( SHrotmat[i], 0, HEADROT_SHMAT_DIM ); } /* calculate ambisonics rotation matrices for the previous and current frames */ @@ -1025,7 +1025,7 @@ void rotateFrame_shd( /* move Rmat to Rmat_prev */ FOR( i = 0; i < 3; i++ ) { - mvr2r_Word32( + Copy32( hCombinedOrientationData->Rmat_fx[subframe_idx][i], hCombinedOrientationData->Rmat_prev_fx[i], 3 ); @@ -1204,9 +1204,9 @@ void rotateFrame_sd( FOR( ch_in = 0; ch_in < nchan; ch_in++ ) { /* zero output and gain buffers */ - set_val_Word32( &output_tmp_fx[ch_in][offset], 0, subframe_len ); - set_val_Word32( gains_prev_fx[ch_in], 0, nchan ); - set_val_Word32( gains_fx[ch_in], 0, nchan ); + set32_fx( &output_tmp_fx[ch_in][offset], 0, subframe_len ); + set32_fx( gains_prev_fx[ch_in], 0, nchan ); + set32_fx( gains_fx[ch_in], 0, nchan ); /* set gains to passthrough by default */ gains_prev_fx[ch_in][ch_in] = ONE_IN_Q30; move32(); @@ -1323,7 +1323,7 @@ void rotateFrame_sd( /* move Rmat to Rmat_prev */ FOR( i = 0; i < 3; i++ ) { - mvr2r_Word32( + Copy32( hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][i], hCombinedOrientationData->Rmat_prev_fx[i], 3 ); @@ -1331,7 +1331,7 @@ void rotateFrame_sd( /* copy to output */ FOR( ch_out = 0; ch_out < nchan; ch_out++ ) { - mvr2r_Word32( &output_tmp_fx[ch_out][offset], &output[ch_out][offset], subframe_len ); + Copy32( &output_tmp_fx[ch_out][offset], &output[ch_out][offset], subframe_len ); } pop_wmops(); @@ -1851,7 +1851,7 @@ void rotateFrame_sd_cldfb_fixed( } ELSE { - set_l( gains_fx[n], 0, nInChannels ); + set32_fx( gains_fx[n], 0, nInChannels ); gains_fx[n][n] = 0x7fffffff; // Q31 move32(); } @@ -1860,8 +1860,8 @@ void rotateFrame_sd_cldfb_fixed( /* Apply panning gains by mtx multiplication*/ FOR( n = 0; n < nInChannels; n++ ) { - set_l( realRot_fx[n], 0, shl( nb_band, 2 ) ); - set_l( imagRot_fx[n], 0, shl( nb_band, 2 ) ); + set32_fx( realRot_fx[n], 0, shl( nb_band, 2 ) ); + set32_fx( imagRot_fx[n], 0, shl( nb_band, 2 ) ); FOR( m = 0; m < nInChannels; m++ ) { g1_fx = gains_fx[m][n]; @@ -3543,7 +3543,7 @@ void SHrotmatgen_fx( #ifdef MSAN_FIX FOR( i = 0; i < HEADROT_SHMAT_DIM; i++ ) { - set_s( R_lm1[i], 0, HEADROT_SHMAT_DIM ); + set16_fx( R_lm1[i], 0, HEADROT_SHMAT_DIM ); } #endif Word16 R_l[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; @@ -3584,7 +3584,7 @@ void SHrotmatgen_fx( move16(); FOR( l = 2; l <= order; l++ ) { - set_val_Word16( &R_l[0][0], 0, HEADROT_SHMAT_DIM2 ); + set16_fx( &R_l[0][0], 0, HEADROT_SHMAT_DIM2 ); FOR( m = -l; m <= l; m++ ) { d = 0; diff --git a/lib_rend/ivas_shoebox.c b/lib_rend/ivas_shoebox.c index f09cbeac2..5464c4882 100644 --- a/lib_rend/ivas_shoebox.c +++ b/lib_rend/ivas_shoebox.c @@ -37,6 +37,7 @@ #include "ivas_stat_rend.h" #include "ivas_cnst.h" #include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" #include "ivas_rom_com.h" #ifdef IVAS_FLOAT_FIXED @@ -200,8 +201,8 @@ void ivas_shoebox_init( /* Positions */ - set_l( &obj->src_pos_fx[0], 0, 75U ); - set_l( &obj->src_dist_fx[0], 0, 25U ); + set32_fx( &obj->src_pos_fx[0], 0, 75U ); + set32_fx( &obj->src_dist_fx[0], 0, 25U ); FOR( i = 0; i < 3; i++ ) { @@ -905,7 +906,7 @@ void ivas_shoebox_set_scene( } move16(); - set_l( &obj->src_pos_fx[0], 0, 75U ); + set32_fx( &obj->src_pos_fx[0], 0, 75U ); obj->list_pos_fx[0] = list_pos_fx[0]; obj->list_pos_fx[1] = list_pos_fx[1]; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index d51e11142..1fd016fc2 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1166,19 +1166,19 @@ static LSSETUP_CUSTOM_STRUCT defaultCustomLs( set_zero( ls.ls_azimuth, MAX_OUTPUT_CHANNELS ); #endif - set_val_Word32( ls.ls_azimuth_fx, 0, MAX_OUTPUT_CHANNELS ); + set32_fx( ls.ls_azimuth_fx, 0, MAX_OUTPUT_CHANNELS ); #ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED set_zero( ls.ls_elevation, MAX_OUTPUT_CHANNELS ); #endif - set_val_Word32( ls.ls_elevation_fx, 0, MAX_OUTPUT_CHANNELS ); + set32_fx( ls.ls_elevation_fx, 0, MAX_OUTPUT_CHANNELS ); ls.num_lfe = 0; move16(); - set_s( ls.lfe_idx, 0, MAX_OUTPUT_CHANNELS ); + set16_fx( ls.lfe_idx, 0, MAX_OUTPUT_CHANNELS ); ls.separate_ch_found = 0; move16(); - set_val_Word16( ls.separate_ch_gains_fx, 0, MAX_OUTPUT_CHANNELS ); + set16_fx( ls.separate_ch_gains_fx, 0, MAX_OUTPUT_CHANNELS ); return ls; } @@ -2090,7 +2090,7 @@ static void initRotGains_fx( /* Set gains to passthrough */ FOR( i = 0; i < MAX_INPUT_CHANNELS; i++ ) { - set_val_Word16( rot_gains[i], 0, MAX_INPUT_CHANNELS ); + set16_fx( rot_gains[i], 0, MAX_INPUT_CHANNELS ); rot_gains[i][i] = ONE_IN_Q14; move16(); } @@ -2106,7 +2106,7 @@ static void initRotGainsWord32_fx( /* Set gains to passthrough */ FOR( i = 0; i < MAX_INPUT_CHANNELS; i++ ) { - set_val_Word32( rot_gains[i], 0, MAX_INPUT_CHANNELS ); + set32_fx( rot_gains[i], 0, MAX_INPUT_CHANNELS ); rot_gains[i][i] = ONE_IN_Q30; move16(); } @@ -2154,7 +2154,7 @@ static void initRendInputBase_fx( inputBase->inputBuffer.data_fx = dataBuf; IF( inputBase->inputBuffer.data_fx != NULL ) { - set_val_Word32( inputBase->inputBuffer.data_fx, 0, dataBufSize ); + set32_fx( inputBase->inputBuffer.data_fx, 0, dataBufSize ); } return; @@ -2726,7 +2726,7 @@ static void setZeroPanMatrix_fx( FOR( i = 0; i < MAX_INPUT_CHANNELS; ++i ) { - set_val_Word32( panMatrix[i], 0, MAX_OUTPUT_CHANNELS ); + set32_fx( panMatrix[i], 0, MAX_OUTPUT_CHANNELS ); } return; @@ -4121,7 +4121,7 @@ static ivas_error initMcBinauralRendering( move16(); test(); - IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) && inputMc->hReverb == NULL ) + IF( ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) && NE_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { nchan_rend = sub( nchan_rend, 1 ); /* Skip LFE channel -- added to the others */ } @@ -4378,7 +4378,7 @@ static lfe_routing defaultLfeRouting( FOR( i = 0; i < RENDERER_MAX_INPUT_LFE_CHANNELS; ++i ) { - set_val_Word32( routing.lfePanMtx_fx[i], 0, IVAS_MAX_OUTPUT_CHANNELS ); + set32_fx( routing.lfePanMtx_fx[i], 0, IVAS_MAX_OUTPUT_CHANNELS ); } routing.pan_lfe = false; move16(); @@ -4530,7 +4530,7 @@ static ivas_error setRendInputActiveMc( initRotGains( inputMc->rot_gains_prev ); initRotGainsWord32_fx( inputMc->rot_gains_prev_fx ); inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); - set_val_Word32( inputMc->lfeDelayBuffer_fx, 0, MAX_BIN_DELAY_SAMPLES ); + set32_fx( inputMc->lfeDelayBuffer_fx, 0, MAX_BIN_DELAY_SAMPLES ); inputMc->binauralDelaySmp = 0; move16(); @@ -5686,7 +5686,7 @@ static LSSETUP_CUSTOM_STRUCT makeCustomLsSetup( customLs.num_lfe = rendCustomLsLayout.num_lfe; move16(); - mvs2s( rendCustomLsLayout.lfe_idx, customLs.lfe_idx, rendCustomLsLayout.num_lfe ); + Copy( rendCustomLsLayout.lfe_idx, customLs.lfe_idx, rendCustomLsLayout.num_lfe ); return customLs; } @@ -7354,7 +7354,7 @@ ivas_error IVAS_REND_FeedInputAudio_fx( inputBase->inputBuffer.config = inputAudio.config; - mvr2r_Word32( inputAudio.data_fx, inputBase->inputBuffer.data_fx, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels ); + Copy32( inputAudio.data_fx, inputBase->inputBuffer.data_fx, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels ); inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; move32(); @@ -7430,7 +7430,7 @@ ivas_error IVAS_REND_FeedInputAudio( inputBase->inputBuffer.config = inputAudio.config; #ifdef IVAS_FLOAT_FIXED - mvr2r_Word32( inputAudio.data_fx, inputBase->inputBuffer.data_fx, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels ); + Copy32( inputAudio.data_fx, inputBase->inputBuffer.data_fx, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels ); #endif mvr2r( inputAudio.data, inputBase->inputBuffer.data, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels ); @@ -8759,7 +8759,7 @@ static ivas_error rotateFrameMc_fx( /* initialize gains to passthrough */ FOR( ch_in = 0; ch_in < nchan; ch_in++ ) { - set_val_Word32( gains[ch_in], 0, nchan ); + set32_fx( gains[ch_in], 0, nchan ); gains[ch_in][ch_in] = ONE_IN_Q30; move32(); } @@ -8786,7 +8786,7 @@ static ivas_error rotateFrameMc_fx( ELSE { /* Set to identity */ - set_val_Word32( Rmat_fx[i], 0, 3 ); + set32_fx( Rmat_fx[i], 0, 3 ); Rmat_fx[i][i] = ONE_IN_Q30; move32(); } @@ -8873,7 +8873,7 @@ static ivas_error rotateFrameMc_fx( /* move gains to gains_prev */ FOR( i = 0; i < nchan; i++ ) { - mvr2r_Word32( gains[i], gains_prev[i], nchan ); + Copy32( gains[i], gains_prev[i], nchan ); } } @@ -9074,7 +9074,7 @@ static ivas_error rotateFrameSba_fx( /* initialize rotation matrices with zeros */ FOR( i = 0; i < HEADROT_SHMAT_DIM; i++ ) { - set_val_Word16( gains[i], 0, HEADROT_SHMAT_DIM ); + set16_fx( gains[i], 0, HEADROT_SHMAT_DIM ); } FOR( i = 0; i < 3; i++ ) @@ -9090,7 +9090,7 @@ static ivas_error rotateFrameSba_fx( ELSE { /* Set to identity */ - set_val_Word32( Rmat[i], 0, 3 ); + set32_fx( Rmat[i], 0, 3 ); Rmat[i][i] = ONE_IN_Q30; move32(); } @@ -10508,7 +10508,7 @@ static ivas_error renderLfeToBinaural_fx( v_multc_fixed( lfeInput, gain_fx, tmpLfeBuffer + num_cpy_smpl_prev_frame, num_cpy_smpl_cur_frame ); // Qinp-1 /* Save remaining LFE samples of current frame for next frame */ - mvr2r_Word32( lfeInput + num_cpy_smpl_cur_frame, mcInput->lfeDelayBuffer_fx, num_cpy_smpl_prev_frame ); + Copy32( lfeInput + num_cpy_smpl_cur_frame, mcInput->lfeDelayBuffer_fx, num_cpy_smpl_prev_frame ); r_shift = sub( sub( in_q, 1 ), out_q ); IF( r_shift != 0 ) @@ -10665,7 +10665,7 @@ static ivas_error renderMcToBinaural( { tmpRotBuffer = mcInput->base.inputBuffer; tmpRotBuffer.data_fx = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( Word32 ) ); - set_val_Word32( tmpRotBuffer.data_fx, 0, imult1616( tmpRotBuffer.config.numSamplesPerChannel, tmpRotBuffer.config.numChannels ) ); + set32_fx( tmpRotBuffer.data_fx, 0, imult1616( tmpRotBuffer.config.numSamplesPerChannel, tmpRotBuffer.config.numChannels ) ); IF( NE_32( ( error = rotateFrameMc_fx( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, mcInput->rot_gains_prev_fx, mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ), IVAS_ERR_OK ) ) { @@ -10877,7 +10877,7 @@ static ivas_error renderMcToBinauralRoom( { tmpRotBuffer = mcInput->base.inputBuffer; tmpRotBuffer.data_fx = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( Word32 ) ); - set_val_Word32( tmpRotBuffer.data_fx, 0, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); + set32_fx( tmpRotBuffer.data_fx, 0, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); IF( NE_32( ( error = rotateFrameMc_fx( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, mcInput->rot_gains_prev_fx, @@ -11063,7 +11063,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( { tmpRotBuffer = mcInput->base.inputBuffer; tmpRotBuffer.data_fx = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( Word32 ) ); - set_val_Word32( tmpRotBuffer.data_fx, 0, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); + set32_fx( tmpRotBuffer.data_fx, 0, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); IF( NE_32( ( error = rotateFrameMc_fx( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, mcInput->rot_gains_prev_fx, @@ -11086,7 +11086,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( tmpMcBuffer.config.numChannels = tmp; move16(); tmpMcBuffer.data_fx = malloc( imult1616( tmpMcBuffer.config.numSamplesPerChannel, tmpMcBuffer.config.numChannels ) * sizeof( Word32 ) ); - set_val_Word32( tmpMcBuffer.data_fx, 0, imult1616( tmpMcBuffer.config.numSamplesPerChannel, tmpMcBuffer.config.numChannels ) ); + set32_fx( tmpMcBuffer.data_fx, 0, imult1616( tmpMcBuffer.config.numSamplesPerChannel, tmpMcBuffer.config.numChannels ) ); IF( combinedOrientationEnabled ) { @@ -11631,7 +11631,7 @@ static ivas_error renderSbaToBinaural( tmpRotBuffer.data_fx = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( Word32 ) ); /* copy input for in-place rotation */ - mvr2r_Word32( sbaInput->base.inputBuffer.data_fx, tmpRotBuffer.data_fx, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); + Copy32( sbaInput->base.inputBuffer.data_fx, tmpRotBuffer.data_fx, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); IF( NE_16( ( error = rotateFrameSba_fx( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev_fx, tmpRotBuffer ) ), @@ -11801,7 +11801,7 @@ static ivas_error renderSbaToBinauralRoom( tmpRotBuffer.data_fx = malloc( imult1616( tmpRotBuffer.config.numSamplesPerChannel, tmpRotBuffer.config.numChannels ) * sizeof( Word32 ) ); /* copy input for in-place rotation */ - mvr2r_Word32( sbaInput->base.inputBuffer.data_fx, tmpRotBuffer.data_fx, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); + Copy32( sbaInput->base.inputBuffer.data_fx, tmpRotBuffer.data_fx, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); IF( NE_32( ( error = rotateFrameSba_fx( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->base.ctx.pCombinedOrientationData, @@ -11824,7 +11824,7 @@ static ivas_error renderSbaToBinauralRoom( tmpMcBuffer.config.numChannels = tmp; move16(); tmpMcBuffer.data_fx = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( Word32 ) ); - set_val_Word32( tmpMcBuffer.data_fx, 0, tmpMcBuffer.config.numChannels * tmpMcBuffer.config.numSamplesPerChannel ); + set32_fx( tmpMcBuffer.data_fx, 0, tmpMcBuffer.config.numChannels * tmpMcBuffer.config.numSamplesPerChannel ); IF( combinedOrientationEnabled ) { @@ -12365,7 +12365,7 @@ static void renderMasaToMasa( test(); IF( EQ_16( masaInput->base.inputBuffer.config.numChannels, 1 ) && EQ_16( outAudio.config.numChannels, 2 ) ) { - mvr2r_Word32( tmpBuffer_fx[0], tmpBuffer_fx[1], masaInput->base.inputBuffer.config.numSamplesPerChannel ); + Copy32( tmpBuffer_fx[0], tmpBuffer_fx[1], masaInput->base.inputBuffer.config.numSamplesPerChannel ); } ELSE IF( EQ_16( masaInput->base.inputBuffer.config.numChannels, 2 ) && EQ_16( outAudio.config.numChannels, 1 ) ) { @@ -13282,7 +13282,7 @@ static ivas_error getSamplesInternal( /* Clear original output buffer */ set_zero( outAudio.data, imult1616( outAudio.config.numChannels, outAudio.config.numSamplesPerChannel ) ); - set_val_Word32( outAudio.data_fx, 0, imult1616( outAudio.config.numChannels, outAudio.config.numSamplesPerChannel ) ); + set32_fx( outAudio.data_fx, 0, imult1616( outAudio.config.numChannels, outAudio.config.numSamplesPerChannel ) ); IF( NE_32( ( error = renderActiveInputsIsm( hIvasRend, outAudio ) ), IVAS_ERR_OK ) ) { -- GitLab