From 2728e20fc66d6c2b2d27c1ebf028a40d106b475d Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:36:36 +0200 Subject: [PATCH 01/35] accept FIX_732_MS_PERIODOG_FLOOR --- lib_com/options.h | 1 - lib_dec/fd_cng_dec_fx.c | 15 --------------- 2 files changed, 16 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index fe5c38761..748b6c8eb 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -70,7 +70,6 @@ #ifndef BASOP_NOGLOB_DEV_USE_GLOBALS #define BASOP_NOGLOB_DECLARE_LOCAL #endif -#define FIX_732_MS_PERIODOG_FLOOR /* Eri: Issue-732: Dynamic range of msPeriodog leads to minimum value 1e-5 being truncated to zero. This uses the smallest non-zero value instead. */ #define FIX_867_CLDFB_NRG_SCALE #define FIX_1737_FIX_867_CLDFB_NRG_SCALE diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 8302f68b9..416b9c716 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -1500,9 +1500,7 @@ void perform_noise_estimation_dec_ivas_fx( Word32 enr, enr_tot, enr_tot0; Word16 enr_e, enr_ratio, alpha; Word32 *msPeriodog; -#ifdef FIX_732_MS_PERIODOG_FLOOR Word32 msPeriodog_floor; -#endif Word32 *msNoiseEst; Word32 *reIter; Word32 rescale_fac = 0; @@ -1511,10 +1509,8 @@ void perform_noise_estimation_dec_ivas_fx( Word16 q_shift; Word32 max_l; Word16 norm_shift; -#ifdef FIX_732_MS_PERIODOG_FLOOR Word16 check = 0; move16(); -#endif /* pointer initialization */ periodog = hFdCngDec->hFdCngCom->periodog; /*Q31 - hFdCngDec->hFdCngCom->periodog_exp*/ @@ -1713,23 +1709,13 @@ void perform_noise_estimation_dec_ivas_fx( msPeriodog[p] = L_add( msPeriodog[p], L_tmp ); /*Q31 - hFdCngDec->msPeriodog_exp*/ move32(); -#ifdef FIX_732_MS_PERIODOG_FLOOR msPeriodog_floor = L_max( 1, L_shr( 21474 /*Q31*/, hFdCngDec->msPeriodog_exp ) ); /*Q31 - hFdCngDec->msPeriodog_exp*/ IF( LT_32( msPeriodog[p], msPeriodog_floor ) ) -#else - IF( LT_32( msPeriodog[p], L_shr( 21474 /*Q31*/, hFdCngDec->msPeriodog_exp ) ) ) -#endif { -#ifdef FIX_732_MS_PERIODOG_FLOOR msPeriodog[p] = msPeriodog_floor; move32(); -#else - msPeriodog[p] = L_shr( 21474 /*Q31*/, hFdCngDec->msPeriodog_exp ); /*Q31 - hFdCngDec->msPeriodog_exp*/ - move32(); -#endif } } -#ifdef FIX_732_MS_PERIODOG_FLOOR FOR( p = 0; p < npart; p++ ) { IF( GT_32( msPeriodog[p], 1 ) ) @@ -1744,7 +1730,6 @@ void perform_noise_estimation_dec_ivas_fx( hFdCngDec->msPeriodog_exp = 14; /* msPeriodog buffer will have minimum value as 1e-5f */ move16(); } -#endif } /* calculate total energy (short-term and long-term) */ -- GitLab From 1b43fa8c3d9e406530fcd0f2fa3f6aad3be03c35 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:38:38 +0200 Subject: [PATCH 02/35] [cleanup] accept FIX_867_CLDFB_NRG_SCALE, FIX_1737_FIX_867_CLDFB_NRG_SCALE --- lib_com/cnst.h | 2 - lib_com/options.h | 2 - lib_dec/ivas_dirac_dec_fx.c | 171 ----- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 239 ------- lib_rend/ivas_dirac_rend_fx.c | 593 ------------------ lib_rend/ivas_prot_rend_fx.h | 4 - lib_rend/ivas_stat_rend.h | 17 - lib_rend/lib_rend_fx.c | 19 - 8 files changed, 1047 deletions(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index a8eeb1d89..59e9e89f1 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -788,9 +788,7 @@ enum #define L_HP20_MEM 4 /* HP20 filter memory length */ #define CLDFB_NO_CHANNELS_MAX 60 /* CLDFB resampling - max number of CLDFB channels, == IVAS_CLDFB_NO_CHANNELS_MAX */ -#ifdef FIX_867_CLDFB_NRG_SCALE #define CLDFB_NO_CHANNELS_HALF 30 /* CLDFB resampling - max number of CLDFB channels, == IVAS_CLDFB_NO_CHANNELS_MAX */ -#endif #define CLDFB_NO_CHANNELS_MAX_FX 30720 /*Q9*/ #define CLDFB_NO_COL_MAX 16 /* CLDFB resampling - max number of CLDFB col., == IVAS_CLDFB_NO_COL_MAX */ #define CLDFB_NO_COL_MAX_LOG2 4 /* To be used for shift operation instead of division */ diff --git a/lib_com/options.h b/lib_com/options.h index 748b6c8eb..01d928336 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -71,8 +71,6 @@ #define BASOP_NOGLOB_DECLARE_LOCAL #endif -#define FIX_867_CLDFB_NRG_SCALE -#define FIX_1737_FIX_867_CLDFB_NRG_SCALE #define FIX_1737_proto_fac_overflow diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 69c841dac..d989607a1 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -2332,12 +2332,8 @@ void ivas_dirac_dec_render_sf_fx( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; Word16 num_channels_dir, exp; -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 q_diffuseness_vector = Q31, q_reference_power_smooth[2] = { Q31, Q31 }; move16(); -#else - Word16 q_diffuseness_vector = Q31, q_reference_power_smooth = Q31; -#endif move16(); move16(); Word16 proto_power_smooth_len = 0; @@ -2588,7 +2584,6 @@ void ivas_dirac_dec_render_sf_fx( scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, imult1616( hSpatParamRendCom->num_freq_bands, hDirACRend->hOutSetup.nchan_out_woLFE ), tmp1 ); // Q(hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev+ tmp1) hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev = add( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, tmp1 ); move16(); -#ifdef FIX_867_CLDFB_NRG_SCALE tmp1 = 31; move16(); FOR( i = 0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); i = add( i, hSpatParamRendCom->num_freq_bands ) ) @@ -2613,12 +2608,6 @@ void ivas_dirac_dec_render_sf_fx( } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1], tmp1 ); move16(); -#else - tmp1 = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, imult1616( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ) ); - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, imult1616( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ), tmp1 ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q tmp1) - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, tmp1 ); - move16(); -#endif IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx != 0 ) { tmp1 = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, imult1616( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->hOutSetup.nchan_out_woLFE ) ); @@ -2940,11 +2929,7 @@ void ivas_dirac_dec_render_sf_fx( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, -#ifdef FIX_867_CLDFB_NRG_SCALE reference_power_fx, DirAC_mem.reference_power_q, -#else - reference_power_fx, &DirAC_mem.reference_power_q, -#endif slot_idx, nchan_transport, hDirACRend->num_outputs_diff, hSpatParamRendCom->num_freq_bands, @@ -2957,11 +2942,7 @@ void ivas_dirac_dec_render_sf_fx( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, -#ifdef FIX_867_CLDFB_NRG_SCALE reference_power_fx, DirAC_mem.reference_power_q, -#else - reference_power_fx, &DirAC_mem.reference_power_q, -#endif slot_idx, nchan_transport, hDirACRend->num_outputs_diff, hSpatParamRendCom->num_freq_bands, @@ -2980,17 +2961,9 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, reference_power_fx, -#ifdef FIX_867_CLDFB_NRG_SCALE DirAC_mem.reference_power_q, -#else - &DirAC_mem.reference_power_q, -#endif hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, -#ifdef FIX_867_CLDFB_NRG_SCALE hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, -#else - &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, -#endif 0, slot_idx, hSpatParamRendCom->num_freq_bands, hDirACRend->masa_stereo_type_detect, q_cldfb ); @@ -3014,17 +2987,9 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, reference_power_fx, -#ifdef FIX_867_CLDFB_NRG_SCALE DirAC_mem.reference_power_q, -#else - &DirAC_mem.reference_power_q, -#endif hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, -#ifdef FIX_867_CLDFB_NRG_SCALE hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, -#else - &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, -#endif slot_idx, hDirACRend->num_outputs_diff, hSpatParamRendCom->num_freq_bands, hDirACRend->hoa_decoder, @@ -3039,17 +3004,9 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, reference_power_fx, -#ifdef FIX_867_CLDFB_NRG_SCALE DirAC_mem.reference_power_q, -#else - &DirAC_mem.reference_power_q, -#endif hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, -#ifdef FIX_867_CLDFB_NRG_SCALE hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, -#else - &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, -#endif hDirACRend->hOutSetup.is_loudspeaker_setup, slot_idx, hSpatParamRendCom->num_freq_bands, @@ -3072,17 +3029,9 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, reference_power_fx, -#ifdef FIX_867_CLDFB_NRG_SCALE DirAC_mem.reference_power_q, -#else - &DirAC_mem.reference_power_q, -#endif hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, -#ifdef FIX_867_CLDFB_NRG_SCALE hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, -#else - &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, -#endif slot_idx, hDirACRend->num_protos_diff, hSpatParamRendCom->num_freq_bands, q_cldfb ); @@ -3145,12 +3094,8 @@ void ivas_dirac_dec_render_sf_fx( num_freq_bands, azimuth, elevation ); Copy32( reference_power_fx, &( hDirACRend->buffer_energy_fx[i_mult( sub( index, 1 ), num_freq_bands )] ), num_freq_bands ); -#ifdef FIX_867_CLDFB_NRG_SCALE Scale_sig32( &( hDirACRend->buffer_energy_fx[add( i_mult( sub( index, 1 ), num_freq_bands ), CLDFB_NO_CHANNELS_HALF )] ), s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_q[1] ) ); hDirACRend->q_buffer_energy[index - 1] = DirAC_mem.reference_power_q[0]; -#else - hDirACRend->q_buffer_energy[index - 1] = DirAC_mem.reference_power_q; -#endif move16(); computeDiffuseness_fixed( hDirACRend->buffer_intensity_real_fx, hDirACRend->buffer_energy_fx, num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], hDirACRend->q_buffer_intensity_real, hDirACRend->q_buffer_energy, &hSpatParamRendCom->q_diffuseness_vector ); @@ -3356,7 +3301,6 @@ void ivas_dirac_dec_render_sf_fx( IF( NE_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { -#ifdef FIX_867_CLDFB_NRG_SCALE v_add_fixed_me( reference_power_fx, sub( 31, DirAC_mem.reference_power_q[0] ), reference_power_smooth_fx, sub( 31, q_reference_power_smooth[0] ), reference_power_smooth_fx, &temp_q, @@ -3367,50 +3311,6 @@ void ivas_dirac_dec_render_sf_fx( reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, &temp_q, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), 1 ); q_reference_power_smooth[1] = sub( 31, temp_q ); -#else - IF( LT_16( q_reference_power_smooth, DirAC_mem.reference_power_q ) ) - { - Word32 temp; - FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - temp = L_shl( reference_power_fx[i], sub( q_reference_power_smooth, DirAC_mem.reference_power_q ) ); - test(); - IF( temp == 0 && ( reference_power_fx[i] != 0 ) ) - { - reference_power_fx[i] = 1; - } - ELSE - { - reference_power_fx[i] = temp; - } - move32(); - } - DirAC_mem.reference_power_q = q_reference_power_smooth; - move16(); - } - ELSE - { - Word32 temp; - FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - temp = L_shl( reference_power_smooth_fx[i], sub( DirAC_mem.reference_power_q, q_reference_power_smooth ) ); - test(); - IF( temp == 0 && ( reference_power_smooth_fx[i] != 0 ) ) - { - reference_power_smooth_fx[i] = 1; - } - ELSE - { - reference_power_smooth_fx[i] = temp; - } - move32(); - } - q_reference_power_smooth = DirAC_mem.reference_power_q; - move16(); - } - v_add_fixed( reference_power_fx, reference_power_smooth_fx, reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, 1 ); - q_reference_power_smooth = sub( q_reference_power_smooth, 1 ); -#endif } } @@ -3609,7 +3509,6 @@ void ivas_dirac_dec_render_sf_fx( Scale_sig32( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, i_mult( hDirACRend->num_outputs_dir, hSpatParamRendCom->num_freq_bands ), sub( Q31, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q ) ); // Q31 } -#ifdef FIX_867_CLDFB_NRG_SCALE exp = L_norm_arr( reference_power_smooth_fx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); scale_sig32( reference_power_smooth_fx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), exp ); // q_reference_power_smooth[0] + exp q_reference_power_smooth[0] = add( q_reference_power_smooth[0], exp ); @@ -3653,38 +3552,6 @@ void ivas_dirac_dec_render_sf_fx( q_reference_power_smooth[1] = hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1]; move16(); } -#else - exp = L_norm_arr( reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands ); - scale_sig32( reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, exp ); // q_reference_power_smooth + exp - q_reference_power_smooth = add( q_reference_power_smooth, exp ); - IF( LT_16( q_reference_power_smooth, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q ) ) - { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, hSpatParamRendCom->num_freq_bands, sub( q_reference_power_smooth, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q ) ); // q_reference_power_smooth - hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q = q_reference_power_smooth; - move16(); - } - ELSE - { - Word32 temp; - FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - temp = L_shl( reference_power_smooth_fx[i], sub( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, q_reference_power_smooth ) ); - test(); - IF( temp == 0 && ( reference_power_smooth_fx[i] != 0 ) ) - { - reference_power_smooth_fx[i] = 1; - } - ELSE - { - reference_power_smooth_fx[i] = temp; - } - move32(); - } - - q_reference_power_smooth = hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q; - move16(); - } -#endif IF( hDirACRend->masa_stereo_type_detect != NULL ) { @@ -3704,7 +3571,6 @@ void ivas_dirac_dec_render_sf_fx( } } -#ifdef FIX_867_CLDFB_NRG_SCALE exp = 31; move16(); FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) @@ -3766,24 +3632,6 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1]; move16(); } -#else - exp = getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, proto_power_smooth_len ); - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, proto_power_smooth_len, exp ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + exp) - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, exp ); - move16(); - IF( LT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q ) ) - { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, i_mult( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q ) ); // proto_power_smooth_q - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q; - move16(); - } - ELSE - { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, i_mult( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) ); // proto_power_smooth_prev_q - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q; - move16(); - } -#endif exp = getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, i_mult( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->hOutSetup.nchan_out_woLFE ) ); scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, i_mult( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->hOutSetup.nchan_out_woLFE ), exp ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q + exp) @@ -3827,16 +3675,11 @@ void ivas_dirac_dec_render_sf_fx( hSpatParamRendCom->subframe_nbslots[subframe_idx], diffuseness_vector_fx, reference_power_smooth_fx, -#ifdef FIX_867_CLDFB_NRG_SCALE q_reference_power_smooth, -#else - &q_reference_power_smooth, -#endif qualityBasedSmFactor_fx, hDirAC->hConfig->enc_param_start_band, &q_Cldfb ); -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 allZero = 1; move16(); FOR( i = 0; i < proto_power_smooth_len; i++ ) @@ -3857,20 +3700,6 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = 31; move16(); } -#else - Word16 sh = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q; - move16(); - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = 31; - move16(); - FOR( i = 0; i < proto_power_smooth_len; i++ ) - { - IF( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx[i] != 0 ) - { - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = sh; - move16(); - } - } -#endif FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) { diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 80dcf9009..1f2555dc6 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -311,15 +311,10 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } set32_fx( dirac_output_synthesis_state->reference_power_smooth_prev_fx, 0, hSpatParamRendCom->num_freq_bands ); -#ifdef FIX_867_CLDFB_NRG_SCALE dirac_output_synthesis_state->reference_power_smooth_prev_q[0] = Q31; dirac_output_synthesis_state->reference_power_smooth_prev_q[1] = Q31; move16(); move16(); -#else - dirac_output_synthesis_state->reference_power_smooth_prev_q = Q31; - move16(); -#endif IF( ( dirac_output_synthesis_state->direction_smoothness_prev_fx = (Word32 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) { @@ -500,15 +495,10 @@ void ivas_dirac_dec_output_synthesis_init_fx( IF( h_dirac_output_synthesis_state->proto_power_smooth_prev_fx != NULL ) { set32_fx( h_dirac_output_synthesis_state->proto_power_smooth_prev_fx, 0, imult1616( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ) ); -#ifdef FIX_867_CLDFB_NRG_SCALE h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] = Q31; h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] = Q31; move16(); move16(); -#else - h_dirac_output_synthesis_state->proto_power_smooth_prev_q = Q31; - move16(); -#endif } set32_fx( h_dirac_output_synthesis_state->gains_dir_prev_fx, 0, size ); h_dirac_output_synthesis_state->gains_dir_prev_q = 0; @@ -649,11 +639,7 @@ void ivas_dirac_dec_output_synthesis_close_fx( void ivas_dirac_dec_output_synthesis_process_slot_fx( const Word32 *reference_power, /* i : Estimated power Q(q_reference_power)*/ -#ifdef FIX_867_CLDFB_NRG_SCALE const Word16 *q_reference_power, /* i : Estimated power Q */ -#else - const Word16 q_reference_power, /* i : Estimated power Q */ -#endif const Word32 *onset, /* i : onset filter Q31*/ const Word16 *azimuth, const Word16 *elevation, @@ -1454,11 +1440,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( hDirACRend->proto_index_diff, h_dirac_output_synthesis_state->diffuse_power_factor_fx, reference_power, -#ifdef FIX_867_CLDFB_NRG_SCALE q_reference_power, -#else - &q_reference_power, -#endif h_dirac_output_synthesis_state->diffuse_responses_square_fx, onset, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, @@ -1471,15 +1453,9 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( /* process other PSDs only slot wise for 4 transport channels */ IF( EQ_16( dec_param_estim, TRUE ) ) { -#ifdef FIX_867_CLDFB_NRG_SCALE computeTargetPSDs_direct_fx( num_channels_dir, num_freq_bands, h_dirac_output_synthesis_state->direct_power_factor_fx, reference_power, q_reference_power, h_dirac_output_synthesis_state->direct_responses_fx, h_dirac_output_synthesis_state->direct_responses_square_fx, h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, &h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, &h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ); computeTargetPSDs_diffuse_fx( num_channels_dir, num_freq_bands, diff_start_band, h_dirac_output_synthesis_state->diffuse_power_factor_fx, reference_power, q_reference_power, h_dirac_output_synthesis_state->diffuse_responses_square_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, &h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); -#else - computeTargetPSDs_direct_fx( num_channels_dir, num_freq_bands, h_dirac_output_synthesis_state->direct_power_factor_fx, reference_power, &q_reference_power, h_dirac_output_synthesis_state->direct_responses_fx, h_dirac_output_synthesis_state->direct_responses_square_fx, h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, &h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, &h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ); - - computeTargetPSDs_diffuse_fx( num_channels_dir, num_freq_bands, diff_start_band, h_dirac_output_synthesis_state->diffuse_power_factor_fx, reference_power, &q_reference_power, h_dirac_output_synthesis_state->diffuse_responses_square_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, &h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); -#endif } return; @@ -2250,25 +2226,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, &h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ); -#ifndef FIX_867_CLDFB_NRG_SCALE - // Scale cy_auto_diff_smooth_fx if required - IF( diff_start_band != 0 ) - { - q_com = s_min( *q_reference_power_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); - scale_sig32( reference_power_smooth, num_freq_bands, sub( q_com, *q_reference_power_smooth ) ); /**q_reference_power_smooth->q_com*/ - scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, num_freq_bands, sub( q_com, *q_reference_power_smooth ) ); /**q_reference_power_smooth->q_com*/ - scale_sig32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, - i_mult( num_freq_bands, nchan_target_psds ), - sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ) ); /*h_dirac_output_synthesis_state->q_cy_auto_diff_smooth -> q_com*/ - *q_reference_power_smooth = q_com; - move16(); - h_dirac_output_synthesis_state->reference_power_smooth_prev_q = q_com; - move16(); - - h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = q_com; - move16(); - } -#endif computeTargetPSDs_diffuse_subframe_fx( nchan_target_psds, num_freq_bands, diff_start_band, h_dirac_output_synthesis_state->diffuse_power_factor_fx, @@ -2430,12 +2387,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( prevWeight = Mpy_32_32( L_sub( ONE_IN_Q31, DIRECTION_SMOOTHNESS_ALPHA_Q31 ), h_dirac_output_synthesis_state->reference_power_smooth_prev_fx[l] ); //(Q31, q_reference_power_smooth) -> q_reference_power_smooth -#ifdef FIX_867_CLDFB_NRG_SCALE assert( q_reference_power_smooth[0] == h_dirac_output_synthesis_state->reference_power_smooth_prev_q[0] ); assert( q_reference_power_smooth[1] == h_dirac_output_synthesis_state->reference_power_smooth_prev_q[1] ); -#else - assert( *q_reference_power_smooth == h_dirac_output_synthesis_state->reference_power_smooth_prev_q ); -#endif weightedDirectionSmoothness = L_add( Mpy_32_32( currWeight, instDirectionSmoothness ), Mpy_32_32( prevWeight, h_dirac_output_synthesis_state->direction_smoothness_prev_fx[l] ) ); //(q_reference_power_smooth, Q31) -> q_reference_power_smooth @@ -2486,12 +2439,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( *( p_power_smooth_prev ) = L_add( *( p_power_smooth_prev ), Mpy_32_32( g1, ( *p_power_smooth ) ) ); //(Q31, q_proto_power_smooth) -> q_proto_power_smooth move32(); -#ifdef FIX_867_CLDFB_NRG_SCALE assert( h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] == h_dirac_output_synthesis_state->proto_power_smooth_q[0] ); assert( h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] == h_dirac_output_synthesis_state->proto_power_smooth_q[1] ); -#else - assert( h_dirac_output_synthesis_state->proto_power_smooth_prev_q == h_dirac_output_synthesis_state->proto_power_smooth_q ); -#endif IF( EQ_32( *( p_power_smooth_prev ), EPSILON_FX ) ) { p_power_smooth_prev++; @@ -2516,7 +2465,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( // Move proto_power_smooth_fx to common Q-factor -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 min_exp2 = -64; min_exp = MIN_16; move16(); @@ -2569,44 +2517,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( h_dirac_output_synthesis_state->proto_power_smooth_q[1] = q_tmp2; move16(); move16(); -#else - min_exp = MIN_16; - move16(); - q_tmp = Q31; - move16(); - - FOR( k = 0; k < num_protos_dir; k++ ) - { - FOR( l = 0; l < num_freq_bands; l++ ) - { - IF( GT_16( exp_arr[k * num_freq_bands + l], min_exp ) ) - { - min_exp = exp_arr[k * num_freq_bands + l]; - move16(); - } - } - } - - p_power_smooth_prev = h_dirac_output_synthesis_state->proto_power_smooth_prev_fx; - p_power_smooth = h_dirac_output_synthesis_state->proto_power_smooth_fx; - - FOR( k = 0; k < num_protos_dir; k++ ) - { - FOR( l = 0; l < num_freq_bands; l++ ) - { - *p_power_smooth = L_shr( *p_power_smooth, sub( min_exp, exp_arr[k * num_freq_bands + l] ) ); /*(31-(exp-(31-q_proto_power_smooth)))->(31-(min_exp-(31-q_proto_power_smooth)))*/ - move32(); - p_power_smooth++; - q_tmp = add( sub( Q31, min_exp ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_q ) ); - } - } - - // Update the Q-factor - h_dirac_output_synthesis_state->proto_power_smooth_prev_q = h_dirac_output_synthesis_state->proto_power_smooth_q; - move16(); - h_dirac_output_synthesis_state->proto_power_smooth_q = q_tmp; - move16(); -#endif /*Direct gains and diffuse gains on number of output channels*/ p_power_diff_smooth_prev = h_dirac_output_synthesis_state->proto_power_diff_smooth_prev_fx; @@ -2659,9 +2569,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( FOR( k = 0; k < nchan_out_woLFE; k++ ) { Word32 power_smooth_temp; -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 qidx; -#endif p_power_smooth = h_dirac_output_synthesis_state->proto_power_smooth_fx + i_mult( proto_direct_index[k], num_freq_bands ); // q_proto_power_smooth FOR( l = 0; l < h_dirac_output_synthesis_params->max_band_decorr; l++ ) { @@ -2680,17 +2588,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( power_smooth_temp = L_shl( *p_power_smooth, norm_l( *p_power_smooth ) ); // proto_power_smooth_q + norm_l( *p_power_smooth ) L_tmp = Mpy_32_32( power_smooth_temp, ( *( p_cy_auto_dir_smooth_prev++ ) ) ); // proto_power_smooth_q + norm_l( *p_power_smooth ) ) + q_cy_auto_dir_smooth_prev_local - 31 -#ifdef FIX_867_CLDFB_NRG_SCALE qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); exp = sub( Q31, sub( add( add( h_dirac_output_synthesis_state->proto_power_smooth_q[qidx], norm_l( *p_power_smooth ) ), q_cy_auto_dir_smooth_prev_local[k] ), Q31 ) ); -#else - exp = sub( Q31, sub( add( add( h_dirac_output_synthesis_state->proto_power_smooth_q, norm_l( *p_power_smooth ) ), - q_cy_auto_dir_smooth_prev_local[k] ), - Q31 ) ); -#endif p_power_smooth++; *( p_gains_dir ) = Sqrt32( L_tmp, &exp ); // (Q31 - exp) @@ -2800,16 +2702,10 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( ( p_cy_cross_dir_smooth++ ); power_smooth_temp = L_shl( *p_power_smooth, norm_l( *p_power_smooth ) ); L_tmp = Mpy_32_32( power_smooth_temp, L_tmp ); // proto_power_smooth_q + norm_l( *p_power_smooth ) ) + q_cy_auto_dir_smooth_prev_local - 31 -#ifdef FIX_867_CLDFB_NRG_SCALE qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); exp = sub( Q31, sub( add( add( h_dirac_output_synthesis_state->proto_power_smooth_q[qidx], norm_l( *p_power_smooth ) ), add( q_cy_auto_dir_smooth_prev_local[k], q_tmp ) ), Q31 ) ); -#else - exp = sub( Q31, sub( add( add( h_dirac_output_synthesis_state->proto_power_smooth_q, norm_l( *p_power_smooth ) ), - add( q_cy_auto_dir_smooth_prev_local[k], q_tmp ) ), - Q31 ) ); -#endif *( p_gains_dir ) = Sqrt32( L_tmp, &exp ); // (Q31 - exp) move32(); @@ -2866,15 +2762,9 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( move32(); } ( p_cy_auto_diff_smooth_prev++ ); -#ifdef FIX_867_CLDFB_NRG_SCALE exp = sub( Q31, sub( add( add( h_dirac_output_synthesis_state->proto_power_smooth_q[qidx], norm_l( *p_power_smooth ) ), h_dirac_output_synthesis_state->q_cy_auto_diff_smooth_prev ), Q31 ) ); -#else - exp = sub( Q31, sub( add( add( h_dirac_output_synthesis_state->proto_power_smooth_q, norm_l( *p_power_smooth ) ), - h_dirac_output_synthesis_state->q_cy_auto_diff_smooth_prev ), - Q31 ) ); -#endif p_power_smooth++; *( p_gains_diff ) = Sqrt32( L_tmp, &exp ); /*31-exp*/ @@ -4071,13 +3961,8 @@ static void computeTargetPSDs_direct_fx( /* estimate direct and diffuse power */ v_mult_fixed( direct_power_factor, reference_power, direct_power, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 common1_q = s_min( *q_cy_auto_dir_smooth, s_min( q_reference_power[0], q_reference_power[1] ) ); Word16 common2_q = s_min( *q_cy_cross_dir_smooth, s_min( q_reference_power[0], q_reference_power[1] ) ); -#else - Word16 common1_q = s_min( *q_cy_auto_dir_smooth, *q_reference_power ); - Word16 common2_q = s_min( *q_cy_cross_dir_smooth, *q_reference_power ); -#endif /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) @@ -4085,22 +3970,14 @@ static void computeTargetPSDs_direct_fx( cur_idx = imult1616( ch_idx, num_freq_bands ); v_mult_fixed( direct_power, &direct_responses_square[cur_idx], aux_buffer_res, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ -#ifdef FIX_867_CLDFB_NRG_SCALE scale_sig32( aux_buffer_res, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( common1_q, q_reference_power[0] ) ); /* Q(common1_q) */ scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( common1_q, q_reference_power[1] ) ); /* Q(common1_q) */ -#else - scale_sig32( aux_buffer_res, num_freq_bands, sub( common1_q, *q_reference_power ) ); /* Q(common1_q) */ -#endif scale_sig32( &cy_auto_dir_smooth[cur_idx], num_freq_bands, sub( common1_q, *q_cy_auto_dir_smooth ) ); /* Q(common1_q) */ v_add_fixed( &cy_auto_dir_smooth[cur_idx], aux_buffer_res, &cy_auto_dir_smooth[cur_idx], num_freq_bands, Q1 ); /* Q(common1_q) - Q1 */ v_mult_fixed( direct_power, &direct_responses[cur_idx], aux_buffer_res, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ -#ifdef FIX_867_CLDFB_NRG_SCALE scale_sig32( aux_buffer_res, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( common2_q, q_reference_power[0] ) ); /* Q(common2_q) */ scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( common2_q, q_reference_power[1] ) ); /* Q(common2_q) */ -#else - scale_sig32( aux_buffer_res, num_freq_bands, sub( common2_q, *q_reference_power ) ); /* Q(common2_q) */ -#endif scale_sig32( &cy_cross_dir_smooth[cur_idx], num_freq_bands, sub( common2_q, *q_cy_cross_dir_smooth ) ); /* Q(common2_q) */ v_add_fixed( &cy_cross_dir_smooth[cur_idx], aux_buffer_res, &cy_cross_dir_smooth[cur_idx], num_freq_bands, Q1 ); /* Q(common2_q) - Q1 */ } @@ -4128,77 +4005,20 @@ static void computeTargetPSDs_direct_subframe_fx( Word32 *cy_cross_dir_smooth, /*q_cy_cross_dir_smooth*/ Word16 *q_cy_cross_dir_smooth ) { -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 ch_idx, cur_idx, q_tmp; Word32 L_tmp[CLDFB_NO_CHANNELS_MAX]; Word16 q_cy_auto_dir_smooth_local[2]; -#else - Word16 ch_idx, cur_idx, i, q_tmp; - Word64 W_tmp[CLDFB_NO_CHANNELS_MAX], W_max; - set64_fx( W_tmp, 0, CLDFB_NO_CHANNELS_MAX ); -#endif /* segment auxiliary buffer */ Word32 direct_power[CLDFB_NO_CHANNELS_MAX]; /* size: num_freq_bands. */ /* estimate direct and diffuse power */ -#ifndef FIX_867_CLDFB_NRG_SCALE - FOR( i = 0; i < num_freq_bands; i++ ) - { - direct_power[i] = Mpy_32_32( direct_power_factor[i], reference_power[i] ); - move32(); - test(); - if ( direct_power[i] == 0 && ( direct_power_factor[i] != 0 && reference_power[i] != 0 ) ) - { - direct_power[i] = 1; - move32(); - } - } -#else v_mult_fixed( direct_power_factor, reference_power, direct_power, num_freq_bands ); -#endif /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { cur_idx = imult1616( ch_idx, num_freq_bands ); -#ifndef FIX_867_CLDFB_NRG_SCALE - W_max = 0; - move64(); - FOR( i = 0; i < num_freq_bands; i++ ) - { - W_tmp[i] = W_mult_32_32( direct_power[i], direct_responses_square[cur_idx + i] ); // q_reference_power + Q31 + 1 - move64(); - IF( LT_64( W_max, W_abs( W_tmp[i] ) ) ) - { - W_max = W_abs( W_tmp[i] ); - } - } - q_tmp = W_norm( W_max ); -#ifdef FIX_867_CLDFB_NRG_SCALE - FOR( i = 0; i < s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ); i++ ) - { - cy_auto_dir_smooth[cur_idx + i] = W_extract_h( W_shl( W_tmp[i], q_tmp ) ); /*q_reference_power[0]+q_tmp*/ - move32(); - } - Word16 q_tmp2 = sub( q_tmp, sub( q_reference_power[1], q_reference_power[0] ) ); - FOR( i = CLDFB_NO_CHANNELS_HALF; i < num_freq_bands; i++ ) - { - cy_auto_dir_smooth[cur_idx + i] = W_extract_h( W_shl( W_tmp[i], q_tmp2 ) ); /*q_reference_power[1]+q_tmp*/ - move32(); - } - q_cy_auto_dir_smooth[ch_idx] = add( q_reference_power[0], q_tmp ); - move16(); -#else - FOR( i = 0; i < num_freq_bands; i++ ) - { - cy_auto_dir_smooth[cur_idx + i] = W_extract_h( W_shl( W_tmp[i], q_tmp ) ); /*q_reference_power+q_tmp*/ - move32(); - } - q_cy_auto_dir_smooth[ch_idx] = add( *q_reference_power, q_tmp ); - move16(); -#endif -#else q_tmp = L_norm_arr( &direct_responses_square[cur_idx], num_freq_bands ); Copy_Scale_sig32( &direct_responses_square[cur_idx], L_tmp, num_freq_bands, q_tmp ); v_mult_fixed( direct_power, L_tmp, &cy_auto_dir_smooth[cur_idx], num_freq_bands ); // (q_reference_power, q_tmp) -> q_reference_power + q_tmp @@ -4211,20 +4031,12 @@ static void computeTargetPSDs_direct_subframe_fx( Scale_sig32( cy_auto_dir_smooth + cur_idx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_cy_auto_dir_smooth[ch_idx], add( q_reference_power[0], q_tmp ) ) ); Scale_sig32( cy_auto_dir_smooth + cur_idx + CLDFB_NO_CHANNELS_HALF, s_max( sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 0 ), sub( q_cy_auto_dir_smooth[ch_idx], add( q_reference_power[1], q_tmp ) ) ); -#endif v_mult_fixed( direct_power, &direct_responses[cur_idx], &cy_cross_dir_smooth[cur_idx], num_freq_bands ); // (q_reference_power, Q31) -> q_reference_power -#ifdef FIX_867_CLDFB_NRG_SCALE Scale_sig32( &cy_cross_dir_smooth[cur_idx] + CLDFB_NO_CHANNELS_HALF, s_max( sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 0 ), sub( q_reference_power[0], q_reference_power[1] ) ); -#endif } -#ifdef FIX_867_CLDFB_NRG_SCALE *q_cy_cross_dir_smooth = q_reference_power[0]; move16(); -#else - *q_cy_cross_dir_smooth = *q_reference_power; - move16(); -#endif return; } @@ -4250,11 +4062,7 @@ static void computeTargetPSDs_diffuse_fx( /* estimate direct and diffuse power */ v_mult_fixed( diffuse_power_factor, reference_power, diffuse_power, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 common_q = s_min( *q_cy_auto_diff_smooth, s_min( q_reference_power[0], q_reference_power[1] ) ); -#else - Word16 common_q = s_min( *q_cy_auto_diff_smooth, *q_reference_power ); -#endif /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) @@ -4262,12 +4070,8 @@ static void computeTargetPSDs_diffuse_fx( cur_idx = imult1616( ch_idx, num_freq_bands ); v_multc_fixed( &diffuse_power[start_band], diffuse_responses_square[ch_idx], aux_buffer_res, sub( num_freq_bands, start_band ) ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ -#ifdef FIX_867_CLDFB_NRG_SCALE scale_sig32( aux_buffer_res, s_min( sub( num_freq_bands, start_band ), CLDFB_NO_CHANNELS_HALF ), sub( common_q, q_reference_power[0] ) ); /* Q(common_q) */ scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( sub( num_freq_bands, start_band ), CLDFB_NO_CHANNELS_HALF ) ), sub( common_q, q_reference_power[1] ) ); /* Q(common_q) */ -#else - scale_sig32( aux_buffer_res, sub( num_freq_bands, start_band ), sub( common_q, *q_reference_power ) ); /* Q(common_q) */ -#endif scale_sig32( &cy_auto_diff_smooth[cur_idx + start_band], sub( num_freq_bands, start_band ), sub( common_q, *q_cy_auto_diff_smooth ) ); /* Q(common_q) */ v_add_fixed( &cy_auto_diff_smooth[cur_idx + start_band], aux_buffer_res, &cy_auto_diff_smooth[cur_idx + start_band], sub( num_freq_bands, start_band ), Q1 ); /* Q(common_q) - Q1 */ } @@ -4293,14 +4097,11 @@ static void computeTargetPSDs_diffuse_subframe_fx( { Word16 ch_idx, cur_idx; Word32 diffuse_power[CLDFB_NO_CHANNELS_MAX]; /* segment auxiliary buffer; size: num_freq_bands. */ -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 q_cy_auto_diff_smooth_new, q_diffuse_power; -#endif /* estimate direct and diffuse power */ v_mult_fixed( diffuse_power_factor, reference_power, diffuse_power, num_freq_bands ); // (Q31, q_reference_power) -> q_reference_power -#ifdef FIX_867_CLDFB_NRG_SCALE q_diffuse_power = s_min( q_reference_power[0], q_reference_power[1] ); Scale_sig32( diffuse_power, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_diffuse_power, q_reference_power[0] ) ); Scale_sig32( diffuse_power + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_diffuse_power, q_reference_power[1] ) ); @@ -4311,28 +4112,20 @@ static void computeTargetPSDs_diffuse_subframe_fx( q_cy_auto_diff_smooth_new = *q_cy_auto_diff_smooth; move16(); } -#endif /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { cur_idx = imult1616( ch_idx, num_freq_bands ); -#ifdef FIX_867_CLDFB_NRG_SCALE IF( GT_16( *q_cy_auto_diff_smooth, q_diffuse_power ) ) { Scale_sig32( &cy_auto_diff_smooth[cur_idx], start_band, sub( q_diffuse_power, *q_cy_auto_diff_smooth ) ); } -#endif v_multc_fixed( &diffuse_power[start_band], diffuse_responses_square[ch_idx], &cy_auto_diff_smooth[cur_idx + start_band], sub( num_freq_bands, start_band ) ); // (q_reference_power, Q31) -> q_reference_power } -#ifdef FIX_867_CLDFB_NRG_SCALE *q_cy_auto_diff_smooth = q_cy_auto_diff_smooth_new; move16(); -#else - *q_cy_auto_diff_smooth = *q_reference_power; - move16(); -#endif return; } @@ -4356,34 +4149,15 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( /* segment auxiliary buffer */ Word32 diffuse_power[CLDFB_NO_CHANNELS_MAX]; /* size: num_freq_bands. */ Word32 aux_buffer_res[CLDFB_NO_CHANNELS_MAX]; /* size: num_freq_bands. */ -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 q_common, q_reference_power_min_one[2]; q_reference_power_min_one[0] = sub( q_reference_power[0], Q1 ); q_reference_power_min_one[1] = sub( q_reference_power[1], Q1 ); -#else - Word16 q_common, q_reference_power_min_one; - - q_reference_power_min_one = sub( *q_reference_power, Q1 ); -#endif /* estimate direct and diffuse power */ v_mult_fixed( diffuse_power_factor, reference_power, diffuse_power, num_decorr_freq_bands ); // (Q31, q_reference_power) -> q_reference_power -#ifdef FIX_867_CLDFB_NRG_SCALE q_common = s_min( *q_cy_auto_diff_smooth, s_min( q_reference_power_min_one[0], q_reference_power_min_one[1] ) ); -#else - IF( GT_16( *q_cy_auto_diff_smooth, q_reference_power_min_one ) ) - { - q_common = q_reference_power_min_one; - move16(); - } - ELSE - { - q_common = *q_cy_auto_diff_smooth; - move16(); - } -#endif /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) @@ -4400,7 +4174,6 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( v_add_fixed( aux_buffer_res1, aux_buffer_res, aux_buffer_res, num_decorr_freq_bands, Q1 ); // Q30 v_mult_fixed( aux_buffer_res, diffuse_power, aux_buffer_res, num_decorr_freq_bands ); // (Q30, q_reference_power) -> q_reference_power - Q1 -#ifdef FIX_867_CLDFB_NRG_SCALE IF( NE_16( q_common, q_reference_power_min_one[0] ) ) { scale_sig32( aux_buffer_res, s_min( num_decorr_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_common, q_reference_power_min_one[0] ) ); // q_common @@ -4415,18 +4188,6 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( } v_add_fixed( &cy_auto_diff_smooth[cur_idx], aux_buffer_res, &cy_auto_diff_smooth[cur_idx], num_decorr_freq_bands, Q1 ); // (q_common - Q1) scale_sig32( &cy_auto_diff_smooth[cur_idx + num_decorr_freq_bands], sub( num_freq_bands, num_decorr_freq_bands ), sub( sub( q_common, Q1 ), *q_cy_auto_diff_smooth ) ); // (q_common - Q1) -#else - IF( NE_16( q_common, q_reference_power_min_one ) ) - { - scale_sig32( aux_buffer_res, num_decorr_freq_bands, sub( q_common, q_reference_power_min_one ) ); // q_common - } - IF( NE_16( q_common, *q_cy_auto_diff_smooth ) ) - { - scale_sig32( &cy_auto_diff_smooth[cur_idx], num_decorr_freq_bands, sub( q_common, *q_cy_auto_diff_smooth ) ); // q_common - } - v_add_fixed( &cy_auto_diff_smooth[cur_idx], aux_buffer_res, &cy_auto_diff_smooth[cur_idx], num_decorr_freq_bands, Q1 ); // (q_common - Q1) - scale_sig32( &cy_auto_diff_smooth[cur_idx + num_decorr_freq_bands], sub( num_freq_bands, num_decorr_freq_bands ), sub( sub( q_common, Q1 ), *q_cy_auto_diff_smooth ) ); // (q_common - Q1) -#endif } /* Q adjustment */ diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 428d14f28..994074913 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -783,7 +783,6 @@ ivas_error ivas_dirac_alloc_mem_fx( } } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx = hDirAC_mem->proto_power_smooth_fx; -#ifdef FIX_867_CLDFB_NRG_SCALE hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = Q31; hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = Q31; move16(); @@ -792,12 +791,6 @@ ivas_error ivas_dirac_alloc_mem_fx( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] = Q31; move16(); move16(); -#else - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = Q31; - move16(); - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = Q31; - move16(); -#endif hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx = hDirAC_mem->proto_power_diff_smooth_fx; hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = hDirAC_mem->proto_power_diff_smooth_q; move16(); @@ -951,7 +944,6 @@ ivas_error ivas_dirac_alloc_mem_fx( hDirAC_mem->reference_power_len = imult1616( 2, num_freq_bands ); move16(); -#ifdef FIX_867_CLDFB_NRG_SCALE hDirAC_mem->reference_power_q[0] = Q31; hDirAC_mem->reference_power_q[1] = Q31; move16(); @@ -960,12 +952,6 @@ ivas_error ivas_dirac_alloc_mem_fx( hDirAC_mem->reference_power_smooth_q[1] = Q31; move16(); move16(); -#else - hDirAC_mem->reference_power_q = Q31; - move16(); - hDirAC_mem->reference_power_smooth_q = Q31; - move16(); -#endif IF( hDirACRend->proto_signal_decorr_on ) { IF( ( hDirAC_mem->onset_filter_fx = (Word32 *) malloc( sizeof( Word32 ) * num_outputs_diff * num_freq_bands ) ) == NULL ) @@ -986,12 +972,7 @@ ivas_error ivas_dirac_alloc_mem_fx( } hDirAC_mem->reference_power_len = imult1616( 5, num_freq_bands ); -#ifdef FIX_867_CLDFB_NRG_SCALE set16_fx( hDirAC_mem->reference_power_q, Q31, 2 ); -#else - hDirAC_mem->reference_power_q = Q31; - move16(); -#endif } IF( hDirACRend->proto_signal_decorr_on ) @@ -1494,14 +1475,9 @@ void protoSignalComputation_shd_fx( *proto_direct_buffer_f_q = add( q_cldfb, min_q_shift ); move16(); -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); reference_power_q[qidx] = sub( add( *proto_direct_buffer_f_q, *proto_direct_buffer_f_q ), 31 ); move16(); -#else - *reference_power_q = sub( add( *proto_direct_buffer_f_q, *proto_direct_buffer_f_q ), 31 ); - move16(); -#endif Word16 shift = sub( *proto_direct_buffer_f_q, q_cldfb ); FOR( k = 1; k < 4; k++ ) @@ -1536,15 +1512,10 @@ void protoSignalComputation_shd_fx( } *proto_direct_buffer_f_q = q_cldfb; move16(); -#ifdef FIX_867_CLDFB_NRG_SCALE reference_power_q[0] = sub( add( add( q_cldfb, min_q_shift ), add( q_cldfb, min_q_shift ) ), 31 ); reference_power_q[1] = reference_power_q[0]; move16(); move16(); -#else - *reference_power_q = sub( add( add( q_cldfb, min_q_shift ), add( q_cldfb, min_q_shift ) ), 31 ); - move16(); -#endif } /* Additional transport channels = planar SBA components of degree higher than 1*/ @@ -1606,11 +1577,7 @@ void protoSignalComputation1_fx( { Word16 l, k, idx; Word32 *p_proto_buffer_fx; -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 proto_power_smooth_fx_q[2], min_q_shift, q_shift; -#else - Word16 proto_power_smooth_fx_q, min_q_shift, q_shift; -#endif Word32 re, im; min_q_shift = Q31; @@ -1633,30 +1600,21 @@ void protoSignalComputation1_fx( q_shift = sub( q_shift, find_guarded_bits_fx( 2 ) ); Scale_sig32( proto_power_smooth_fx, num_freq_bands, q_shift ); /*proto_power_smooth_q+q_shift*/ -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_q[0] = add( proto_power_smooth_q[0], q_shift ); proto_power_smooth_q[1] = add( proto_power_smooth_q[1], q_shift ); proto_power_smooth_fx_q[0] = proto_power_smooth_q[0]; proto_power_smooth_fx_q[1] = proto_power_smooth_q[1]; move16(); move16(); -#else - *proto_power_smooth_q = add( *proto_power_smooth_q, q_shift ); - proto_power_smooth_fx_q = *proto_power_smooth_q; - move16(); -#endif FOR( l = 0; l < num_freq_bands; l++ ) { -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); -#endif re = L_shl( RealBuffer_fx[0][0][l], min_q_shift ); // q_cldfb+min_q_shift im = L_shl( ImagBuffer_fx[0][0][l], min_q_shift ); // q_cldfb+min_q_shift reference_power_fx[l] = Madd_32_32( Mpy_32_32( re, re ), im, im ); // 2*(q_cldfb+min_q_shift)-31 move32(); -#ifdef FIX_867_CLDFB_NRG_SCALE reference_power_q[qidx] = sub( add( add( q_cldfb, min_q_shift ), add( q_cldfb, min_q_shift ) ), 31 ); move16(); @@ -1674,25 +1632,6 @@ void protoSignalComputation1_fx( proto_power_smooth_fx_q[qidx] = proto_power_smooth_q[qidx]; move16(); } -#else - *reference_power_q = sub( add( add( q_cldfb, min_q_shift ), add( q_cldfb, min_q_shift ) ), 31 ); - move16(); - - IF( LT_16( *reference_power_q, *proto_power_smooth_q ) ) - { - proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( *proto_power_smooth_q, *reference_power_q ) ), reference_power_fx[l] ); // reference_power_q - move32(); - proto_power_smooth_fx_q = *reference_power_q; - move16(); - } - ELSE - { - proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( reference_power_fx[l], sub( *reference_power_q, *proto_power_smooth_q ) ) ); // proto_power_smooth_q - move32(); - proto_power_smooth_fx_q = *proto_power_smooth_q; - move16(); - } -#endif idx = 2 * l; p_proto_buffer_fx[idx] = RealBuffer_fx[0][0][l]; // q_cldfb @@ -1714,15 +1653,10 @@ void protoSignalComputation1_fx( move16(); *proto_direct_buffer_f_q = q_cldfb; move16(); -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_q[0] = proto_power_smooth_fx_q[0]; proto_power_smooth_q[1] = proto_power_smooth_fx_q[1]; move16(); move16(); -#else - *proto_power_smooth_q = proto_power_smooth_fx_q; - move16(); -#endif return; } @@ -1770,29 +1704,18 @@ void protoSignalComputation2_fx( Word32 a_fx, b_fx, a2_fx, b2_fx; Word16 interpolatorSpaced_fx, interpolatorDmx_fx; Word32 tempSpaced_fx, tempDmx_fx; -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 q_shift, min_q_shift[2], exp, q_temp[2]; -#else - Word16 q_shift, min_q_shift, exp, q_temp, temp_q_shift, q_temp2; -#endif Word32 temp; Word64 W_tmp1, W_tmp2, W_tmp3; Word64 reference_power_64fx[CLDFB_NO_CHANNELS_MAX]; Word16 q_reference_power_64fx; Word16 head_room, q_Left_Right_power; -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 num_proto = 3; -#endif /* Calculate maximum possible shift for the buffers RealBuffer_fx and ImagBuffer_fx */ -#ifdef FIX_867_CLDFB_NRG_SCALE min_q_shift[0] = Q31; min_q_shift[1] = Q31; move16(); move16(); -#else - min_q_shift = Q31; - move16(); -#endif q_sum_total_ratio = 0; move16(); exp = 0; @@ -1805,30 +1728,20 @@ void protoSignalComputation2_fx( /* Calculate the max shift possible for the buffers RealBuffer_fx and ImagBuffer_fx */ FOR( l = 0; l < 2; l++ ) { -#ifdef FIX_867_CLDFB_NRG_SCALE q_shift = s_min( L_norm_arr( RealBuffer_fx[l][0], s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ) ), L_norm_arr( ImagBuffer_fx[l][0], s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ) ) ); min_q_shift[0] = s_min( min_q_shift[0], q_shift ); q_shift = s_min( L_norm_arr( RealBuffer_fx[l][0] + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ), L_norm_arr( ImagBuffer_fx[l][0] + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); min_q_shift[1] = s_min( min_q_shift[1], q_shift ); #if ( MASA_SUM_FREQ_RANGE_BINS > CLDFB_NO_CHANNELS_HALF ) #error MASA_SUM_FREQ_RANGE_BINS if greater than CLDFB_NO_CHANNELS_HALF, this does not work -#endif -#else - q_shift = s_min( L_norm_arr( RealBuffer_fx[l][0], num_freq_bands ), L_norm_arr( ImagBuffer_fx[l][0], num_freq_bands ) ); - min_q_shift = s_min( min_q_shift, q_shift ); #endif q_shift = s_min( L_norm_arr( RealBuffer_fx[l][0], s_min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ) ), L_norm_arr( ImagBuffer_fx[l][0], s_min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ) ) ); } -#ifdef FIX_867_CLDFB_NRG_SCALE min_q_shift[0] = sub( min_q_shift[0], 2 ); // guard bits min_q_shift[1] = sub( min_q_shift[1], 2 ); // guard bits -#else - min_q_shift = sub( min_q_shift, 2 ); // guard bits -#endif /* Upscaling of the buffer proto_power_smooth_fx */ -#ifdef FIX_867_CLDFB_NRG_SCALE IF( isloudspeaker ) { num_proto = 3; @@ -1867,48 +1780,22 @@ void protoSignalComputation2_fx( } q_proto_power_smooth[1] = add( q_proto_power_smooth[1], sub( q_shift, 1 ) ); move16(); -#else - IF( isloudspeaker ) - { - q_shift = getScaleFactor32( proto_power_smooth_fx, i_mult( 3, num_freq_bands ) ); - scale_sig32( proto_power_smooth_fx, i_mult( 3, num_freq_bands ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 - } - ELSE - { - q_shift = getScaleFactor32( proto_power_smooth_fx, i_mult( 2, num_freq_bands ) ); - scale_sig32( proto_power_smooth_fx, i_mult( 2, num_freq_bands ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 - } - *q_proto_power_smooth = add( *q_proto_power_smooth, sub( q_shift, 1 ) ); - move16(); -#endif IF( isloudspeaker ) { p_proto_buffer_fx = proto_direct_buffer_f_fx + i_mult( i_mult( i_mult( slot_index, 2 ), num_freq_bands ), 3 ); // q_proto_direct_buffer_f -#ifdef FIX_867_CLDFB_NRG_SCALE q_temp[0] = sub( add( add( q_cldfb, min_q_shift[0] ), add( q_cldfb, min_q_shift[0] ) ), 31 ); q_temp[1] = sub( add( add( q_cldfb, min_q_shift[1] ), add( q_cldfb, min_q_shift[1] ) ), 31 ); -#else - q_temp = sub( add( add( q_cldfb, min_q_shift ), add( q_cldfb, min_q_shift ) ), 31 ); - move16(); -#endif FOR( l = 0; l < num_freq_bands; l++ ) { -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); re1 = L_shl( RealBuffer_fx[0][0][l], min_q_shift[qidx] ); // q_cldfb+min_q_shift im1 = L_shl( ImagBuffer_fx[0][0][l], min_q_shift[qidx] ); // q_cldfb+min_q_shift re2 = L_shl( RealBuffer_fx[1][0][l], min_q_shift[qidx] ); // q_cldfb+min_q_shift im2 = L_shl( ImagBuffer_fx[1][0][l], min_q_shift[qidx] ); // q_cldfb+min_q_shift -#else - re1 = L_shl( RealBuffer_fx[0][0][l], min_q_shift ); // q_cldfb+min_q_shift - im1 = L_shl( ImagBuffer_fx[0][0][l], min_q_shift ); // q_cldfb+min_q_shift - re2 = L_shl( RealBuffer_fx[1][0][l], min_q_shift ); // q_cldfb+min_q_shift - im2 = L_shl( ImagBuffer_fx[1][0][l], min_q_shift ); // q_cldfb+min_q_shift -#endif Real_aux_fx = L_add( re1, re2 ); // q_cldfb+min_q_shift Imag_aux_fx = L_add( im1, im2 ); // q_cldfb+min_q_shift @@ -1925,26 +1812,14 @@ void protoSignalComputation2_fx( temp = Madd_32_32( Mpy_32_32( Real_aux_fx, Real_aux_fx ), Imag_aux_fx, Imag_aux_fx ); // 2*(q_cldfb+min_q_shift)-31 -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) -#else - IF( LT_16( q_temp, *q_proto_power_smooth ) ) -#endif { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), temp ); // q_temp -#else - proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( *q_proto_power_smooth, q_temp ) ), temp ); // q_temp -#endif move32(); } ELSE { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -#else - proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( temp, sub( q_temp, *q_proto_power_smooth ) ) ); // q_proto_power_smooth -#endif move32(); } @@ -1955,26 +1830,14 @@ void protoSignalComputation2_fx( temp = Madd_32_32( Mpy_32_32( re1, re1 ), im1, im1 ); // 2*(q_cldfb+min_q_shift)-31 -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) -#else - IF( LT_16( q_temp, *q_proto_power_smooth ) ) -#endif { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l + num_freq_bands] = L_add( L_shr( proto_power_smooth_fx[l + num_freq_bands], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), temp ); // q_temp -#else - proto_power_smooth_fx[l + num_freq_bands] = L_add( L_shr( proto_power_smooth_fx[l + num_freq_bands], sub( *q_proto_power_smooth, q_temp ) ), temp ); // q_temp -#endif move32(); } ELSE { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l + num_freq_bands] = L_add( proto_power_smooth_fx[l + num_freq_bands], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -#else - proto_power_smooth_fx[l + num_freq_bands] = L_add( proto_power_smooth_fx[l + num_freq_bands], L_shr( temp, sub( q_temp, *q_proto_power_smooth ) ) ); // q_proto_power_smooth -#endif move32(); } @@ -1984,26 +1847,14 @@ void protoSignalComputation2_fx( move32(); temp = Madd_32_32( Mpy_32_32( re2, re2 ), im2, im2 ); // 2*(q_cldfb+min_q_shift)-31 -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) -#else - IF( LT_16( q_temp, *q_proto_power_smooth ) ) -#endif { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l + ( 2 * num_freq_bands )] = L_add( L_shr( proto_power_smooth_fx[l + ( 2 * num_freq_bands )], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), temp ); // q_temp -#else - proto_power_smooth_fx[l + ( 2 * num_freq_bands )] = L_add( L_shr( proto_power_smooth_fx[l + ( 2 * num_freq_bands )], sub( *q_proto_power_smooth, q_temp ) ), temp ); // q_temp -#endif move32(); } ELSE { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l + ( 2 * num_freq_bands )] = L_add( proto_power_smooth_fx[l + ( 2 * num_freq_bands )], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -#else - proto_power_smooth_fx[l + ( 2 * num_freq_bands )] = L_add( proto_power_smooth_fx[l + ( 2 * num_freq_bands )], L_shr( temp, sub( q_temp, *q_proto_power_smooth ) ) ); // q_proto_power_smooth -#endif move32(); } @@ -2074,7 +1925,6 @@ void protoSignalComputation2_fx( } } -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 total_shift[2]; /* total_shift shift required to get common Q of sum power values */ total_shift[0] = shl( s_max( 0, sub( min_q_shift[0], min_q_shift[1] ) ), 1 ); @@ -2083,28 +1933,16 @@ void protoSignalComputation2_fx( min_q_shift[1] = sub( min_q_shift[1], idiv1616( find_guarded_bits_fx( num_freq_bands ), 2 ) ); q_temp[0] = sub( add( add( q_cldfb, min_q_shift[0] ), add( q_cldfb, min_q_shift[0] ) ), 31 ); q_temp[1] = sub( add( add( q_cldfb, min_q_shift[1] ), add( q_cldfb, min_q_shift[1] ) ), 31 ); -#else - min_q_shift = sub( min_q_shift, idiv1616( find_guarded_bits_fx( num_freq_bands ), 2 ) ); - - q_temp = sub( add( add( q_cldfb, min_q_shift ), add( q_cldfb, min_q_shift ) ), 31 ); -#endif head_room = 63; move16(); FOR( l = 0; l < num_freq_bands; l++ ) { -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); re1 = L_shl( RealBuffer_fx[0][0][l], min_q_shift[qidx] ); // q_cldfb+min_q_shift im1 = L_shl( ImagBuffer_fx[0][0][l], min_q_shift[qidx] ); // q_cldfb+min_q_shift re2 = L_shl( RealBuffer_fx[1][0][l], min_q_shift[qidx] ); // q_cldfb+min_q_shift im2 = L_shl( ImagBuffer_fx[1][0][l], min_q_shift[qidx] ); // q_cldfb+min_q_shift -#else - re1 = L_shl( RealBuffer_fx[0][0][l], min_q_shift ); // q_cldfb+min_q_shift - im1 = L_shl( ImagBuffer_fx[0][0][l], min_q_shift ); // q_cldfb+min_q_shift - re2 = L_shl( RealBuffer_fx[1][0][l], min_q_shift ); // q_cldfb+min_q_shift - im2 = L_shl( ImagBuffer_fx[1][0][l], min_q_shift ); // q_cldfb+min_q_shift -#endif W_tmp1 = W_add( W_mult0_32_32( re1, re1 ), W_mult0_32_32( im1, im1 ) ); W_tmp2 = W_add( W_mult0_32_32( re2, re2 ), W_mult0_32_32( im2, im2 ) ); @@ -2113,32 +1951,21 @@ void protoSignalComputation2_fx( } head_room = sub( head_room, find_guarded_bits_fx( num_freq_bands ) ); -#ifdef FIX_867_CLDFB_NRG_SCALE #if ( MASA_SUM_FREQ_RANGE_BINS > CLDFB_NO_CHANNELS_HALF ) #error MASA_SUM_FREQ_RANGE_BINS must be less than CLDFB_NO_CHANNELS_HALF #endif q_Left_Right_power = add( shl( add( q_cldfb, min_q_shift[0] ), 1 ), sub( head_room, 32 ) ); -#else - q_Left_Right_power = add( shl( add( q_cldfb, min_q_shift ), 1 ), sub( head_room, 32 ) ); -#endif Word16 exp_left_hi_power = 0, exp_right_hi_power = 0, exp_total_hi_power = 0, exp_temppp; move16(); move16(); move16(); FOR( l = 0; l < num_freq_bands; l++ ) { -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); re1 = L_shl( RealBuffer_fx[0][0][l], min_q_shift[qidx] ); // q_cldfb+min_q_shift im1 = L_shl( ImagBuffer_fx[0][0][l], min_q_shift[qidx] ); // q_cldfb+min_q_shift re2 = L_shl( RealBuffer_fx[1][0][l], min_q_shift[qidx] ); // q_cldfb+min_q_shift im2 = L_shl( ImagBuffer_fx[1][0][l], min_q_shift[qidx] ); // q_cldfb+min_q_shift -#else - re1 = L_shl( RealBuffer_fx[0][0][l], min_q_shift ); // q_cldfb+min_q_shift - im1 = L_shl( ImagBuffer_fx[0][0][l], min_q_shift ); // q_cldfb+min_q_shift - re2 = L_shl( RealBuffer_fx[1][0][l], min_q_shift ); // q_cldfb+min_q_shift - im2 = L_shl( ImagBuffer_fx[1][0][l], min_q_shift ); // q_cldfb+min_q_shift -#endif /* Compute sum signal */ Real_aux_fx = L_add( re1, re2 ); // q_cldfb+min_q_shift @@ -2157,19 +1984,12 @@ void protoSignalComputation2_fx( reference_power_64fx[l] = W_add( W_tmp1, W_tmp2 ); // 2*(q_cldfb+min_q_shift) move64(); -#ifdef FIX_867_CLDFB_NRG_SCALE Left_power_fx = L_shr( Left_power_fx, total_shift[qidx] ); Right_power_fx = L_shr( Right_power_fx, total_shift[qidx] ); left_bb_power_fx = L_add( left_bb_power_fx, Left_power_fx ); // q_Left_Right_power right_bb_power_fx = L_add( right_bb_power_fx, Right_power_fx ); // q_Left_Right_power // total_bb_power_fx = L_add( total_bb_power_fx, reference_power_fx[l] ); total_bb_power_fx = L_add( total_bb_power_fx, W_extract_h( W_shl( reference_power_64fx[l], sub( head_room, total_shift[qidx] ) ) ) ); // q_Left_Right_power -#else - left_bb_power_fx = L_add( left_bb_power_fx, Left_power_fx ); // q_Left_Right_power - right_bb_power_fx = L_add( right_bb_power_fx, Right_power_fx ); // q_Left_Right_power - // total_bb_power_fx = L_add( total_bb_power_fx, reference_power_fx[l] ); - total_bb_power_fx = L_add( total_bb_power_fx, W_extract_h( W_shl( reference_power_64fx[l], head_room ) ) ); // q_Left_Right_power -#endif IF( GT_16( l, MASA_HI_FREQ_START_BIN ) ) { W_tmp1 = W_add( W_mult0_32_32( RealBuffer_fx[0][0][l], RealBuffer_fx[0][0][l] ), W_mult0_32_32( ImagBuffer_fx[0][0][l], ImagBuffer_fx[0][0][l] ) ); @@ -2248,7 +2068,6 @@ void protoSignalComputation2_fx( ImagSubtract_fx = L_sub( im1, im2 ); // q_cldfb+min_q_shift temp = Madd_32_32( Mpy_32_32( RealSubtract_fx, RealSubtract_fx ), ImagSubtract_fx, ImagSubtract_fx ); // 2*(q_cldfb+min_q_shift)-31 -#ifdef FIX_867_CLDFB_NRG_SCALE assert( qidx == 0 ); IF( LT_16( q_temp[qidx], stereo_type_detect->q_subtract_power_y ) ) { @@ -2263,20 +2082,6 @@ void protoSignalComputation2_fx( move32(); } -#else - IF( LT_16( q_temp, stereo_type_detect->q_subtract_power_y ) ) - { - stereo_type_detect->subtract_power_y_fx = L_add( L_shr( stereo_type_detect->subtract_power_y_fx, sub( stereo_type_detect->q_subtract_power_y, q_temp ) ), temp ); // q_temp - move32(); - stereo_type_detect->q_subtract_power_y = q_temp; - move16(); - } - ELSE - { - stereo_type_detect->subtract_power_y_fx = L_add( stereo_type_detect->subtract_power_y_fx, L_shr( temp, sub( q_temp, stereo_type_detect->q_subtract_power_y ) ) ); // stereo_type_detect->q_subtract_power_y - move32(); - } -#endif } /* Compute protos (and their power) for direct sound rendering */ @@ -2290,26 +2095,14 @@ void protoSignalComputation2_fx( Imag_aux_fx = Madd_32_16( Mpy_32_16_1( Imag_aux_fx, shr( interpolatorSpaced_fx, 1 ) ), Imag_aux_fx, interpolatorDmx_fx ); // q_cldfb+min_q_shift temp = Madd_32_32( Mpy_32_32( Real_aux_fx, Real_aux_fx ), Imag_aux_fx, Imag_aux_fx ); // 2*(q_cldfb+min_q_shift) -31 -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) -#else - IF( LT_16( q_temp, *q_proto_power_smooth ) ) -#endif { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), temp ); // q_temp -#else - proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( *q_proto_power_smooth, q_temp ) ), temp ); // q_temp -#endif move32(); } ELSE { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -#else - proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( temp, sub( q_temp, *q_proto_power_smooth ) ) ); // q_proto_power_smooth -#endif move32(); } @@ -2324,26 +2117,14 @@ void protoSignalComputation2_fx( tempDmx_fx = Madd_32_32( Mpy_32_32( Real_aux_fx, Real_aux_fx ), Imag_aux_fx, Imag_aux_fx ); // 2*(q_cldfb+min_q_shift)-31 temp = Madd_32_16( Mpy_32_16_1( tempSpaced_fx, interpolatorSpaced_fx ), tempDmx_fx, interpolatorDmx_fx ); // 2*(q_cldfb+min_q_shift)-31 -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) -#else - IF( LT_16( q_temp, *q_proto_power_smooth ) ) -#endif { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), temp ); // q_temp -#else - proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( *q_proto_power_smooth, q_temp ) ), temp ); // q_temp -#endif move32(); } ELSE { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -#else - proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( temp, sub( q_temp, *q_proto_power_smooth ) ) ); // q_proto_power_smooth -#endif move32(); } @@ -2360,26 +2141,14 @@ void protoSignalComputation2_fx( Real_aux_fx = L_shr( Real_aux_fx, 1 ); // q_cldfb+min_q_shift Imag_aux_fx = L_shr( Imag_aux_fx, 1 ); // q_cldfb+min_q_shift temp = Madd_32_32( Mpy_32_32( Real_aux_fx, Real_aux_fx ), Imag_aux_fx, Imag_aux_fx ); // 2*(q_cldfb+min_q_shift)-31 -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) -#else - IF( LT_16( q_temp, *q_proto_power_smooth ) ) -#endif { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), temp ); // q_temp -#else - proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( *q_proto_power_smooth, q_temp ) ), temp ); // q_temp -#endif move32(); } ELSE { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -#else - proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( temp, sub( q_temp, *q_proto_power_smooth ) ) ); // q_proto_power_smooth -#endif move32(); } @@ -2391,26 +2160,14 @@ void protoSignalComputation2_fx( ELSE { temp = Madd_32_32( Mpy_32_32( re1, re1 ), im1, im1 ); // 2*(q_cldfb+min_q_shift)-31 -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) -#else - IF( LT_16( q_temp, *q_proto_power_smooth ) ) -#endif { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), temp ); // q_temp -#else - proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( *q_proto_power_smooth, q_temp ) ), temp ); // q_temp -#endif move32(); } ELSE { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -#else - proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( temp, sub( q_temp, *q_proto_power_smooth ) ) ); // q_proto_power_smooth -#endif move32(); } @@ -2423,26 +2180,14 @@ void protoSignalComputation2_fx( ELSE { temp = Madd_32_32( Mpy_32_32( Real_aux_fx, Real_aux_fx ), Imag_aux_fx, Imag_aux_fx ); // 2*(q_cldfb+min_q_shift)-31 -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) -#else - IF( LT_16( q_temp, *q_proto_power_smooth ) ) -#endif { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), temp ); // q_temp -#else - proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( *q_proto_power_smooth, q_temp ) ), temp ); // q_temp -#endif move32(); } ELSE { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -#else - proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( temp, sub( q_temp, *q_proto_power_smooth ) ) ); // q_proto_power_smooth -#endif move32(); } @@ -2478,26 +2223,14 @@ void protoSignalComputation2_fx( } temp = Madd_32_32( Mpy_32_32( p_proto_buffer_fx[2 * ( num_freq_bands + l )], p_proto_buffer_fx[2 * ( num_freq_bands + l )] ), p_proto_buffer_fx[2 * ( num_freq_bands + l ) + 1], p_proto_buffer_fx[2 * ( num_freq_bands + l ) + 1] ); // 2*(q_cldfb+min_q_shift)-31 -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) -#else - IF( LT_16( q_temp, *q_proto_power_smooth ) ) -#endif { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l + num_freq_bands] = L_add( L_shr( proto_power_smooth_fx[l + num_freq_bands], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), temp ); // q_temp -#else - proto_power_smooth_fx[l + num_freq_bands] = L_add( L_shr( proto_power_smooth_fx[l + num_freq_bands], sub( *q_proto_power_smooth, q_temp ) ), temp ); // q_temp -#endif move32(); } ELSE { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l + num_freq_bands] = L_add( proto_power_smooth_fx[l + num_freq_bands], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -#else - proto_power_smooth_fx[l + num_freq_bands] = L_add( proto_power_smooth_fx[l + num_freq_bands], L_shr( temp, sub( q_temp, *q_proto_power_smooth ) ) ); // q_proto_power_smooth -#endif move32(); } } @@ -2520,26 +2253,14 @@ void protoSignalComputation2_fx( move32(); temp = Madd_32_32( Mpy_32_32( p_proto_buffer_fx[2 * ( num_freq_bands + l )], p_proto_buffer_fx[2 * ( num_freq_bands + l )] ), p_proto_buffer_fx[2 * ( num_freq_bands + l ) + 1], p_proto_buffer_fx[2 * ( num_freq_bands + l ) + 1] ); // 2*(q_cldfb+min_q_shift)-31 -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) -#else - IF( LT_16( q_temp, *q_proto_power_smooth ) ) -#endif { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l + num_freq_bands] = L_add( L_shr( proto_power_smooth_fx[l + num_freq_bands], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), temp ); // q_temp -#else - proto_power_smooth_fx[l + num_freq_bands] = L_add( L_shr( proto_power_smooth_fx[l + num_freq_bands], sub( *q_proto_power_smooth, q_temp ) ), temp ); // q_temp -#endif move32(); } ELSE { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l + num_freq_bands] = L_add( proto_power_smooth_fx[l + num_freq_bands], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -#else - proto_power_smooth_fx[l + num_freq_bands] = L_add( proto_power_smooth_fx[l + num_freq_bands], L_shr( temp, sub( q_temp, *q_proto_power_smooth ) ) ); // q_proto_power_smooth -#endif move32(); } } @@ -2561,26 +2282,14 @@ void protoSignalComputation2_fx( move32(); temp = Madd_32_32( Mpy_32_32( p_proto_buffer_fx[2 * ( num_freq_bands + l )], p_proto_buffer_fx[2 * ( num_freq_bands + l )] ), p_proto_buffer_fx[2 * ( num_freq_bands + l ) + 1], p_proto_buffer_fx[2 * ( num_freq_bands + l ) + 1] ); // 2*(q_cldfb+min_q_shift)-31 -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) -#else - IF( LT_16( q_temp, *q_proto_power_smooth ) ) -#endif { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l + num_freq_bands] = L_add( L_shr( proto_power_smooth_fx[l + num_freq_bands], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), temp ); // q_temp -#else - proto_power_smooth_fx[l + num_freq_bands] = L_add( L_shr( proto_power_smooth_fx[l + num_freq_bands], sub( *q_proto_power_smooth, q_temp ) ), temp ); // q_temp -#endif move32(); } ELSE { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l + num_freq_bands] = L_add( proto_power_smooth_fx[l + num_freq_bands], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -#else - proto_power_smooth_fx[l + num_freq_bands] = L_add( proto_power_smooth_fx[l + num_freq_bands], L_shr( temp, sub( q_temp, *q_proto_power_smooth ) ) ); // q_proto_power_smooth -#endif move32(); } } @@ -2679,7 +2388,6 @@ void protoSignalComputation2_fx( // 20480 = 10 in Q11 lr_total_bb_ratio_fx = Mpy_32_16_1( temp, 20480 ); // Q21 -#ifdef FIX_867_CLDFB_NRG_SCALE stereo_type_detect->left_hi_power_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a2_fx, left_hi_power_fx ), exp_left_hi_power, Mpy_32_32( b2_fx, stereo_type_detect->left_hi_power_fx ), sub( 31, stereo_type_detect->q_left_hi_power ), &stereo_type_detect->q_left_hi_power ); move32(); stereo_type_detect->q_left_hi_power = sub( 31, stereo_type_detect->q_left_hi_power ); @@ -2691,18 +2399,6 @@ void protoSignalComputation2_fx( move16(); stereo_type_detect->total_hi_power_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a2_fx, total_hi_power_fx ), exp_total_hi_power, Mpy_32_32( b2_fx, stereo_type_detect->total_hi_power_fx ), sub( 31, stereo_type_detect->q_total_hi_power ), &stereo_type_detect->q_total_hi_power ); move32(); -#else - stereo_type_detect->left_hi_power_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a2_fx, left_hi_power_fx ), sub( 31, q_temp ), Mpy_32_32( b2_fx, stereo_type_detect->left_hi_power_fx ), sub( 31, stereo_type_detect->q_left_hi_power ), &stereo_type_detect->q_left_hi_power ); - move32(); - stereo_type_detect->q_left_hi_power = sub( 31, stereo_type_detect->q_left_hi_power ); - move16(); - stereo_type_detect->right_hi_power_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a2_fx, right_hi_power_fx ), sub( 31, q_temp ), Mpy_32_32( b2_fx, stereo_type_detect->right_hi_power_fx ), sub( 31, stereo_type_detect->q_right_hi_power ), &stereo_type_detect->q_right_hi_power ); - move32(); - stereo_type_detect->q_right_hi_power = sub( 31, stereo_type_detect->q_right_hi_power ); - move16(); - stereo_type_detect->total_hi_power_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a2_fx, total_hi_power_fx ), sub( 31, q_temp ), Mpy_32_32( b2_fx, stereo_type_detect->total_hi_power_fx ), sub( 31, stereo_type_detect->q_total_hi_power ), &stereo_type_detect->q_total_hi_power ); - move32(); -#endif stereo_type_detect->q_total_hi_power = sub( 31, stereo_type_detect->q_total_hi_power ); move16(); @@ -2759,27 +2455,16 @@ void protoSignalComputation2_fx( { p_proto_buffer_fx = proto_direct_buffer_f_fx + ( slot_index * num_freq_bands * 4 ); // q_proto_direct_buffer_f -#ifdef FIX_867_CLDFB_NRG_SCALE q_temp[0] = sub( add( add( q_cldfb, min_q_shift[0] ), add( q_cldfb, min_q_shift[0] ) ), 31 ); q_temp[1] = sub( add( add( q_cldfb, min_q_shift[1] ), add( q_cldfb, min_q_shift[1] ) ), 31 ); -#else - q_temp = sub( add( add( q_cldfb, min_q_shift ), add( q_cldfb, min_q_shift ) ), 31 ); -#endif FOR( l = 0; l < num_freq_bands; l++ ) { -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); re1 = L_shl( RealBuffer_fx[0][0][l], min_q_shift[qidx] ); // q_cldfb+ min_q_shift re2 = L_shl( RealBuffer_fx[1][0][l], min_q_shift[qidx] ); // q_cldfb+ min_q_shift im1 = L_shl( ImagBuffer_fx[0][0][l], min_q_shift[qidx] ); // q_cldfb+ min_q_shift im2 = L_shl( ImagBuffer_fx[1][0][l], min_q_shift[qidx] ); // q_cldfb+ min_q_shift -#else - re1 = L_shl( RealBuffer_fx[0][0][l], min_q_shift ); // q_cldfb+ min_q_shift - re2 = L_shl( RealBuffer_fx[1][0][l], min_q_shift ); // q_cldfb+ min_q_shift - im1 = L_shl( ImagBuffer_fx[0][0][l], min_q_shift ); // q_cldfb+ min_q_shift - im2 = L_shl( ImagBuffer_fx[1][0][l], min_q_shift ); // q_cldfb+ min_q_shift -#endif Real_aux_fx = L_add( re1, re2 ); // q_cldfb+ min_q_shift Imag_aux_fx = L_add( im1, im2 ); // q_cldfb+ min_q_shift @@ -2788,26 +2473,14 @@ void protoSignalComputation2_fx( reference_power_64fx[l] = W_add( W_mult0_32_32( Real_aux_fx, Real_aux_fx ), W_mult0_32_32( Imag_aux_fx, Imag_aux_fx ) ); // q_temp move64(); -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) -#else - IF( LT_16( q_temp, *q_proto_power_smooth ) ) -#endif { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), W_extract_l( W_shr( reference_power_64fx[l], 31 ) ) ); // q_temp -#else - proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( *q_proto_power_smooth, q_temp ) ), W_extract_l( W_shr( reference_power_64fx[l], 31 ) ) ); // q_temp -#endif move32(); } ELSE { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( W_extract_l( W_shr( reference_power_64fx[l], 31 ) ), sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -#else - proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( W_extract_l( W_shr( reference_power_64fx[l], 31 ) ), sub( q_temp, *q_proto_power_smooth ) ) ); // q_proto_power_smooth -#endif move32(); } @@ -2822,26 +2495,14 @@ void protoSignalComputation2_fx( move32(); temp = Madd_32_32( Mpy_32_32( p_proto_buffer_fx[2 * ( num_freq_bands + l )], p_proto_buffer_fx[2 * ( num_freq_bands + l )] ), p_proto_buffer_fx[2 * ( num_freq_bands + l ) + 1], p_proto_buffer_fx[2 * ( num_freq_bands + l ) + 1] ); // q_temp -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) -#else - IF( LT_16( q_temp, *q_proto_power_smooth ) ) -#endif { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l + num_freq_bands] = L_add( L_shr( proto_power_smooth_fx[l + num_freq_bands], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), temp ); // q_temp -#else - proto_power_smooth_fx[l + num_freq_bands] = L_add( L_shr( proto_power_smooth_fx[l + num_freq_bands], sub( *q_proto_power_smooth, q_temp ) ), temp ); // q_temp -#endif move32(); } ELSE { -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_fx[l + num_freq_bands] = L_add( proto_power_smooth_fx[l + num_freq_bands], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -#else - proto_power_smooth_fx[l + num_freq_bands] = L_add( proto_power_smooth_fx[l + num_freq_bands], L_shr( temp, sub( q_temp, *q_proto_power_smooth ) ) ); // q_proto_power_smooth -#endif move32(); } @@ -2860,7 +2521,6 @@ void protoSignalComputation2_fx( move32(); } } -#ifdef FIX_867_CLDFB_NRG_SCALE q_reference_power_64fx = shl( add( q_cldfb, min_q_shift[0] ), 1 ); Word16 norm_shift = 63; @@ -2897,27 +2557,7 @@ void protoSignalComputation2_fx( } q_reference_power[1] = sub( add( q_reference_power_64fx, norm_shift ), 32 ); move16(); -#else - q_reference_power_64fx = shl( add( q_cldfb, min_q_shift ), 1 ); - Word16 norm_shift = 63; - move16(); - FOR( l = 0; l < num_freq_bands; l++ ) - { - IF( reference_power_64fx[l] ) - { - norm_shift = s_min( norm_shift, W_norm( reference_power_64fx[l] ) ); - } - } - FOR( l = 0; l < num_freq_bands; l++ ) - { - reference_power_fx[l] = W_extract_h( W_shl( reference_power_64fx[l], norm_shift ) ); // q_reference_power_64fx+norm_shift-32 - move32(); - } - *q_reference_power = sub( add( q_reference_power_64fx, norm_shift ), 32 ); - move16(); -#endif -#ifdef FIX_867_CLDFB_NRG_SCALE IF( GT_16( min_q_shift[0], min_q_shift[1] ) ) { FOR( l = 0; l < i_mult( num_proto, num_freq_bands ); l += num_freq_bands ) @@ -2954,21 +2594,10 @@ void protoSignalComputation2_fx( *q_proto_direct_buffer_f = add( q_cldfb, min_q_shift[0] ); move16(); } -#else - *q_proto_frame_f = add( q_cldfb, min_q_shift ); - move16(); - *q_proto_direct_buffer_f = add( q_cldfb, min_q_shift ); - move16(); -#endif -#ifdef FIX_867_CLDFB_NRG_SCALE q_proto_power_smooth[0] = s_min( q_proto_power_smooth[0], q_temp[0] ); q_proto_power_smooth[1] = s_min( q_proto_power_smooth[1], q_temp[1] ); move16(); move16(); -#else - *q_proto_power_smooth = s_min( *q_proto_power_smooth, q_temp ); - move16(); -#endif return; } @@ -3004,9 +2633,7 @@ void protoSignalComputation4_fx( Word32 sq_tmp_fx; Word32 *p_proto_buffer_fx; Word16 min_q_shift, q_shift; -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 min_q_shift2, q_shift2; -#endif Word32 re, im; Word16 proto_power_smooth_fx_q, sq_tmp_q; @@ -3014,12 +2641,10 @@ void protoSignalComputation4_fx( move16(); q_shift = Q31; move16(); -#ifdef FIX_867_CLDFB_NRG_SCALE min_q_shift2 = Q31; move16(); q_shift2 = Q31; move16(); -#endif sq_tmp_q = 0; move16(); @@ -3028,7 +2653,6 @@ void protoSignalComputation4_fx( /* calculate the shift possible for both RealBuffer_fx and ImagBuffer_fx buffers*/ FOR( k = 0; k < s_max( 4, nchan_transport ); k++ ) { -#ifdef FIX_867_CLDFB_NRG_SCALE q_shift = L_norm_arr( RealBuffer_fx[k][0], s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ) ); min_q_shift = s_min( q_shift, min_q_shift ); q_shift = L_norm_arr( ImagBuffer_fx[k][0], s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ) ); @@ -3037,23 +2661,14 @@ void protoSignalComputation4_fx( min_q_shift2 = s_min( q_shift2, min_q_shift2 ); q_shift2 = L_norm_arr( ImagBuffer_fx[k][0] + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); min_q_shift2 = s_min( q_shift2, min_q_shift2 ); -#else - q_shift = L_norm_arr( RealBuffer_fx[k][0], num_freq_bands ); - min_q_shift = s_min( q_shift, min_q_shift ); - q_shift = L_norm_arr( ImagBuffer_fx[k][0], num_freq_bands ); - min_q_shift = s_min( q_shift, min_q_shift ); -#endif } q_shift = min_q_shift; min_q_shift = sub( min_q_shift, find_guarded_bits_fx( i_mult( 2, 4 ) ) ); -#ifdef FIX_867_CLDFB_NRG_SCALE q_shift2 = min_q_shift2; min_q_shift2 = sub( min_q_shift2, find_guarded_bits_fx( i_mult( 2, 4 ) ) ); -#endif FOR( k = 0; k < 4; k++ ) { -#ifdef FIX_867_CLDFB_NRG_SCALE FOR( l = 0; l < s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ); l++ ) { re = L_shl( RealBuffer_fx[k][0][l], min_q_shift ); // q_cldfb+min_q_shift @@ -3074,20 +2689,7 @@ void protoSignalComputation4_fx( reference_power_fx[l] = Madd_32_16( reference_power_fx[l], sq_tmp_fx, 16384 /*0.5 in Q15*/ ); // 2*(q_cldfb+min_q_shift)-31 move32(); } -#else - FOR( l = 0; l < num_freq_bands; l++ ) - { - re = L_shl( RealBuffer_fx[k][0][l], min_q_shift ); // q_cldfb+min_q_shift - im = L_shl( ImagBuffer_fx[k][0][l], min_q_shift ); // q_cldfb+min_q_shift - - sq_tmp_fx = Madd_32_32( Mpy_32_32( re, re ), im, im ); // 2*(q_cldfb+min_q_shift)-31 - - reference_power_fx[l] = Madd_32_16( reference_power_fx[l], sq_tmp_fx, 16384 /*0.5 in Q15*/ ); // 2*(q_cldfb+min_q_shift)-31 - move32(); - } -#endif } -#ifdef FIX_867_CLDFB_NRG_SCALE sq_tmp_q = sub( add( add( q_cldfb, min_q_shift ), add( q_cldfb, min_q_shift ) ), 31 ); reference_power_q[0] = sq_tmp_q; move16(); @@ -3096,13 +2698,6 @@ void protoSignalComputation4_fx( move16(); min_q_shift = sub( s_min( q_shift, q_shift2 ), find_guarded_bits_fx( 2 ) ); -#else - sq_tmp_q = sub( add( add( q_cldfb, min_q_shift ), add( q_cldfb, min_q_shift ) ), 31 ); - *reference_power_q = sub( add( sq_tmp_q, Q15 ), 15 ); - move16(); - - min_q_shift = sub( q_shift, find_guarded_bits_fx( 2 ) ); -#endif /*For decorrelated diffuseness*/ FOR( l = 0; l < num_outputs_diff; l++ ) @@ -3189,15 +2784,10 @@ void protoSignalComputation4_fx( *proto_direct_buffer_f_q = *proto_frame_f_q; move16(); -#ifdef FIX_867_CLDFB_NRG_SCALE proto_power_smooth_q[0] = proto_power_smooth_fx_q; proto_power_smooth_q[1] = proto_power_smooth_fx_q; move16(); move16(); -#else - *proto_power_smooth_q = proto_power_smooth_fx_q; - move16(); -#endif return; } @@ -4254,11 +3844,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, -#ifdef FIX_867_CLDFB_NRG_SCALE reference_power_fix, DirAC_mem.reference_power_q, slot_idx, nchan_transport, -#else - reference_power_fix, &DirAC_mem.reference_power_q, slot_idx, nchan_transport, -#endif hDirACRend->num_outputs_diff, hSpatParamRendCom->num_freq_bands, 0, q_cldfb ); @@ -4271,18 +3857,12 @@ static void ivas_masa_ext_dirac_render_sf_fx( protoSignalComputation2_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hDirACRend->proto_frame_f_fx, &hDirACRend->proto_frame_f_q, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, -#ifdef FIX_867_CLDFB_NRG_SCALE reference_power_fix, DirAC_mem.reference_power_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, -#else - reference_power_fix, &DirAC_mem.reference_power_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, - &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, -#endif 0, slot_idx, hSpatParamRendCom->num_freq_bands, hDirACRend->masa_stereo_type_detect, q_cldfb ); proto_direct_buffer_f_temp_q[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; move16(); -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ) { FOR( i = hSpatParamRendCom->num_freq_bands; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) @@ -4302,39 +3882,17 @@ static void ivas_masa_ext_dirac_render_sf_fx( { FOR( i = hSpatParamRendCom->num_freq_bands; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { -#ifdef FIX_1737_FIX_867_CLDFB_NRG_SCALE Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ); // DirAC_mem.reference_power_q -#else - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i, s_min( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ); // DirAC_mem.reference_power_q -#endif } DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1]; move16(); } ELSE { -#ifdef FIX_1737_FIX_867_CLDFB_NRG_SCALE Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_smooth_q[1], DirAC_mem.reference_power_q[1] ) ); // DirAC_mem.reference_power_smooth_q -#else - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF, s_min( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_smooth_q[1], DirAC_mem.reference_power_q[1] ) ); // DirAC_mem.reference_power_smooth_q -#endif DirAC_mem.reference_power_q[1] = DirAC_mem.reference_power_smooth_q[1]; move16(); } -#else - IF( LT_16( DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q ) ) - { - Scale_sig32( reference_power_fix + hSpatParamRendCom->num_freq_bands, sub( DirAC_mem.reference_power_len, hSpatParamRendCom->num_freq_bands ), sub( DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q ) ); // DirAC_mem.reference_power_q - DirAC_mem.reference_power_smooth_q = DirAC_mem.reference_power_q; - move16(); - } - ELSE - { - Scale_sig32( reference_power_fix, hSpatParamRendCom->num_freq_bands, sub( DirAC_mem.reference_power_smooth_q, DirAC_mem.reference_power_q ) ); // DirAC_mem.reference_power_smooth_q - DirAC_mem.reference_power_q = DirAC_mem.reference_power_smooth_q; - move16(); - } -#endif temp_proto_frame_q = sub( getScaleFactor32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_len ), 2 ); Scale_sig32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_len, temp_proto_frame_q ); // hDirACRend->proto_frame_f_q+temp_proto_frame_q hDirACRend->proto_frame_f_q = add( hDirACRend->proto_frame_f_q, temp_proto_frame_q ); @@ -4350,15 +3908,9 @@ static void ivas_masa_ext_dirac_render_sf_fx( &hDirACRend->proto_frame_f_q, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, -#ifdef FIX_867_CLDFB_NRG_SCALE reference_power_fix, DirAC_mem.reference_power_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, -#else - reference_power_fix, &DirAC_mem.reference_power_q, - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, - &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, -#endif hDirACRend->hOutSetup.is_loudspeaker_setup, slot_idx, hSpatParamRendCom->num_freq_bands, @@ -4366,7 +3918,6 @@ static void ivas_masa_ext_dirac_render_sf_fx( proto_direct_buffer_f_temp_q[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; move16(); -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ) { FOR( i = hSpatParamRendCom->num_freq_bands; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) @@ -4386,44 +3937,18 @@ static void ivas_masa_ext_dirac_render_sf_fx( { FOR( i = hSpatParamRendCom->num_freq_bands; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { -#ifdef FIX_1737_FIX_867_CLDFB_NRG_SCALE Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ); // DirAC_mem.reference_power_q -#else - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i, s_min( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ); // DirAC_mem.reference_power_q -#endif } -#ifdef FIX_1737_FIX_867_CLDFB_NRG_SCALE DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1]; -#else - DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[1]; -#endif move16(); } ELSE { -#ifdef FIX_1737_FIX_867_CLDFB_NRG_SCALE Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_smooth_q[1], DirAC_mem.reference_power_q[1] ) ); // DirAC_mem.reference_power_smooth_q -#else - Scale_sig32( reference_power_fix, s_min( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_smooth_q[1], DirAC_mem.reference_power_q[1] ) ); // DirAC_mem.reference_power_smooth_q -#endif DirAC_mem.reference_power_q[1] = DirAC_mem.reference_power_smooth_q[1]; move16(); } -#else - IF( LT_16( DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q ) ) - { - Scale_sig32( reference_power_fix + hSpatParamRendCom->num_freq_bands, sub( DirAC_mem.reference_power_len, hSpatParamRendCom->num_freq_bands ), sub( DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q ) ); // DirAC_mem.reference_power_q - DirAC_mem.reference_power_smooth_q = DirAC_mem.reference_power_q; - move16(); - } - ELSE - { - Scale_sig32( reference_power_fix, hSpatParamRendCom->num_freq_bands, sub( DirAC_mem.reference_power_smooth_q, DirAC_mem.reference_power_q ) ); // DirAC_mem.reference_power_smooth_q - DirAC_mem.reference_power_q = DirAC_mem.reference_power_smooth_q; - move16(); - } -#endif temp_proto_frame_q = sub( getScaleFactor32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_len ), 2 ); Scale_sig32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_len, temp_proto_frame_q ); // hDirACRend->proto_frame_f_q+temp_proto_frame_q hDirACRend->proto_frame_f_q = add( hDirACRend->proto_frame_f_q, temp_proto_frame_q ); @@ -4436,15 +3961,9 @@ static void ivas_masa_ext_dirac_render_sf_fx( &hDirACRend->proto_frame_f_q, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, -#ifdef FIX_867_CLDFB_NRG_SCALE reference_power_fix, DirAC_mem.reference_power_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, -#else - reference_power_fix, &DirAC_mem.reference_power_q, - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, - &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, -#endif slot_idx, hDirACRend->num_protos_diff, hSpatParamRendCom->num_freq_bands, q_cldfb ); @@ -4452,7 +3971,6 @@ static void ivas_masa_ext_dirac_render_sf_fx( proto_direct_buffer_f_temp_q[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; move16(); -#ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ) { FOR( i = hSpatParamRendCom->num_freq_bands; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) @@ -4472,39 +3990,17 @@ static void ivas_masa_ext_dirac_render_sf_fx( { FOR( i = hSpatParamRendCom->num_freq_bands; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { -#ifdef FIX_1737_FIX_867_CLDFB_NRG_SCALE Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ); // DirAC_mem.reference_power_q -#else - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i, s_min( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ); // DirAC_mem.reference_power_q -#endif } DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1]; move16(); } ELSE { -#ifdef FIX_1737_FIX_867_CLDFB_NRG_SCALE Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_smooth_q[1], DirAC_mem.reference_power_q[1] ) ); // DirAC_mem.reference_power_smooth_q -#else - Scale_sig32( reference_power_fix, s_min( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_smooth_q[1], DirAC_mem.reference_power_q[1] ) ); // DirAC_mem.reference_power_smooth_q -#endif DirAC_mem.reference_power_q[1] = DirAC_mem.reference_power_smooth_q[1]; move16(); } -#else - IF( LT_16( DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q ) ) - { - Scale_sig32( reference_power_fix + hSpatParamRendCom->num_freq_bands, sub( DirAC_mem.reference_power_len, hSpatParamRendCom->num_freq_bands ), sub( DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q ) ); // DirAC_mem.reference_power_q - DirAC_mem.reference_power_smooth_q = DirAC_mem.reference_power_q; - move16(); - } - ELSE - { - Scale_sig32( reference_power_fix, hSpatParamRendCom->num_freq_bands, sub( DirAC_mem.reference_power_smooth_q, DirAC_mem.reference_power_q ) ); // DirAC_mem.reference_power_smooth_q - DirAC_mem.reference_power_q = DirAC_mem.reference_power_smooth_q; - move16(); - } -#endif temp_proto_frame_q = sub( getScaleFactor32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_len ), 2 ); Scale_sig32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_len, temp_proto_frame_q ); // hDirACRend->proto_frame_f_q+temp_proto_frame_q @@ -4622,7 +4118,6 @@ static void ivas_masa_ext_dirac_render_sf_fx( IF( NE_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { Scale_sig32( DirAC_mem.reference_power_fx, DirAC_mem.reference_power_len, -1 ); // DirAC_mem.reference_power_q-1 -#ifdef FIX_867_CLDFB_NRG_SCALE DirAC_mem.reference_power_q[0] = sub( DirAC_mem.reference_power_q[0], 1 ); DirAC_mem.reference_power_q[1] = sub( DirAC_mem.reference_power_q[1], 1 ); move16(); @@ -4631,12 +4126,6 @@ static void ivas_masa_ext_dirac_render_sf_fx( DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1]; move16(); move16(); -#else - DirAC_mem.reference_power_q = sub( DirAC_mem.reference_power_q, 1 ); - move16(); - DirAC_mem.reference_power_smooth_q = DirAC_mem.reference_power_q; - move16(); -#endif v_add_fixed_no_hdrm( reference_power_fix, reference_power_smooth_fx, reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands ); // DirAC_mem.reference_power_smooth_q } } @@ -4747,19 +4236,12 @@ static void ivas_masa_ext_dirac_render_sf_fx( Word16 reference_power_temp_q = getScaleFactor32( DirAC_mem.reference_power_fx, DirAC_mem.reference_power_len ); scale_sig32( DirAC_mem.reference_power_fx, DirAC_mem.reference_power_len, reference_power_temp_q ); /*DirAC_mem.reference_power_q + reference_power_temp_q*/ -#ifdef FIX_867_CLDFB_NRG_SCALE DirAC_mem.reference_power_q[0] = add( DirAC_mem.reference_power_q[0], reference_power_temp_q ); DirAC_mem.reference_power_q[1] = add( DirAC_mem.reference_power_q[1], reference_power_temp_q ); move16(); DirAC_mem.reference_power_smooth_q[0] = add( DirAC_mem.reference_power_q[0], reference_power_temp_q ); DirAC_mem.reference_power_smooth_q[1] = add( DirAC_mem.reference_power_q[1], reference_power_temp_q ); move16(); -#else - DirAC_mem.reference_power_q = add( DirAC_mem.reference_power_q, reference_power_temp_q ); - move16(); - DirAC_mem.reference_power_smooth_q = add( DirAC_mem.reference_power_q, reference_power_temp_q ); - move16(); -#endif Word16 q_cy_auto_diff_smooth = getScaleFactor32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth_len ); Scale_sig32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth_len, q_cy_auto_diff_smooth ); // h_dirac_output_synthesis_state->q_cy_auto_diff_smooth+ q_cy_auto_diff_smooth @@ -4790,7 +4272,6 @@ static void ivas_masa_ext_dirac_render_sf_fx( move16(); } -#ifdef FIX_867_CLDFB_NRG_SCALE FOR( i = 0; hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + i, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q ) @@ -4799,11 +4280,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( move16(); FOR( i = 0; hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { -#ifdef FIX_1737_FIX_867_CLDFB_NRG_SCALE Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + i, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q ) -#else - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + i, s_min( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q ) -#endif } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ); move16(); @@ -4814,26 +4291,12 @@ static void ivas_masa_ext_dirac_render_sf_fx( } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] = s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ); move16(); -#ifdef FIX_1737_FIX_867_CLDFB_NRG_SCALE FOR( i = 0; hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + i, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) -#else - FOR( i = 0; hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) - { - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + i, s_min( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) -#endif } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] = s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ); move16(); -#else - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q ) - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q ); - move16(); - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_len, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q ); - move16(); -#endif Word16 proto_power_diff_smooth_prev_temp_q = getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len ); Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len, proto_power_diff_smooth_prev_temp_q ); // hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q + proto_power_diff_smooth_prev_temp_q @@ -4856,21 +4319,12 @@ static void ivas_masa_ext_dirac_render_sf_fx( /*Buffer rescaling*/ -#ifdef FIX_867_CLDFB_NRG_SCALE Scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0], DirAC_mem.reference_power_q[0] ), hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ) -#ifdef FIX_1737_FIX_867_CLDFB_NRG_SCALE Scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1], DirAC_mem.reference_power_q[1] ), hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ) -#else - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_min( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1], DirAC_mem.reference_power_q[1] ), hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ) -#endif FOR( i = 0; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { Scale_sig32( DirAC_mem.reference_power_fx + i, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0], DirAC_mem.reference_power_q[0] ), DirAC_mem.reference_power_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ) -#ifdef FIX_1737_FIX_867_CLDFB_NRG_SCALE Scale_sig32( DirAC_mem.reference_power_fx + CLDFB_NO_CHANNELS_HALF + i, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1], DirAC_mem.reference_power_q[1] ), DirAC_mem.reference_power_q[1] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ) -#else - Scale_sig32( DirAC_mem.reference_power_fx + CLDFB_NO_CHANNELS_HALF + i, s_min( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1], DirAC_mem.reference_power_q[1] ), DirAC_mem.reference_power_q[1] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ) -#endif } hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] = s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0], DirAC_mem.reference_power_q[0] ); move16(); @@ -4884,17 +4338,6 @@ static void ivas_masa_ext_dirac_render_sf_fx( move16(); DirAC_mem.reference_power_smooth_q[1] = s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1], DirAC_mem.reference_power_q[1] ); move16(); -#else - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, hSpatParamRendCom->num_freq_bands, sub( s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ), hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ) - Scale_sig32( DirAC_mem.reference_power_fx, DirAC_mem.reference_power_len, sub( s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ), DirAC_mem.reference_power_q ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ) - - hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q = s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ); - move16(); - DirAC_mem.reference_power_q = s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ); - move16(); - DirAC_mem.reference_power_smooth_q = s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ); - move16(); -#endif ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, @@ -4903,17 +4346,12 @@ static void ivas_masa_ext_dirac_render_sf_fx( hSpatParamRendCom->subframe_nbslots[subframe_idx], diffuseness_vector_fx, reference_power_smooth_fx, -#ifdef FIX_867_CLDFB_NRG_SCALE DirAC_mem.reference_power_smooth_q, -#else - &DirAC_mem.reference_power_smooth_q, -#endif ONE_IN_Q31, 0, &q_cldfb ); hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q; move16(); -#ifdef FIX_867_CLDFB_NRG_SCALE hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] = DirAC_mem.reference_power_smooth_q[0]; hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] = DirAC_mem.reference_power_smooth_q[1]; move16(); @@ -4936,41 +4374,17 @@ static void ivas_masa_ext_dirac_render_sf_fx( { FOR( i = hSpatParamRendCom->num_freq_bands; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { -#ifdef FIX_1737_FIX_867_CLDFB_NRG_SCALE Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ); // DirAC_mem.reference_power_q -#else - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i, s_min( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ); // DirAC_mem.reference_power_q -#endif } DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1]; move16(); } ELSE { -#ifdef FIX_1737_FIX_867_CLDFB_NRG_SCALE Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_smooth_q[1], DirAC_mem.reference_power_q[1] ) ); // DirAC_mem.reference_power_smooth_q -#else - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF, s_min( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_smooth_q[1], DirAC_mem.reference_power_q[1] ) ); // DirAC_mem.reference_power_smooth_q -#endif DirAC_mem.reference_power_q[1] = DirAC_mem.reference_power_smooth_q[1]; move16(); } -#else - hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q = DirAC_mem.reference_power_smooth_q; - move16(); - IF( LT_16( DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q ) ) - { - Scale_sig32( reference_power_fix + hSpatParamRendCom->num_freq_bands, sub( DirAC_mem.reference_power_len, hSpatParamRendCom->num_freq_bands ), sub( DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q ) ); // DirAC_mem.reference_power_q - DirAC_mem.reference_power_smooth_q = DirAC_mem.reference_power_q; - move16(); - } - ELSE - { - Scale_sig32( reference_power_fix, hSpatParamRendCom->num_freq_bands, sub( DirAC_mem.reference_power_smooth_q, DirAC_mem.reference_power_q ) ); // DirAC_mem.reference_power_smooth_q - DirAC_mem.reference_power_q = DirAC_mem.reference_power_smooth_q; - move16(); - } -#endif } /*-----------------------------------------------------------------* @@ -4991,17 +4405,10 @@ static void ivas_masa_ext_dirac_render_sf_fx( { FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { -#ifdef FIX_1737_FIX_867_CLDFB_NRG_SCALE scale_factor = s_min( scale_factor, L_norm_arr( Cldfb_RealBuffer_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands ) ); scale_factor = s_min( scale_factor, L_norm_arr( Cldfb_ImagBuffer_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands ) ); -#else - scale_factor = s_min( scale_factor, getScaleFactor32( Cldfb_RealBuffer_fx[ch][slot_idx], - hSpatParamRendCom->num_freq_bands ) ); - scale_factor = s_min( scale_factor, getScaleFactor32( Cldfb_ImagBuffer_fx[ch][slot_idx], - hSpatParamRendCom->num_freq_bands ) ); -#endif } } scale_factor = sub( scale_factor, find_guarded_bits_fx( hSpatParamRendCom->num_freq_bands ) ); // guard bits diff --git a/lib_rend/ivas_prot_rend_fx.h b/lib_rend/ivas_prot_rend_fx.h index a8729ddbf..5eb3fa4dd 100644 --- a/lib_rend/ivas_prot_rend_fx.h +++ b/lib_rend/ivas_prot_rend_fx.h @@ -460,11 +460,7 @@ void ivas_dirac_dec_output_synthesis_close_fx( void ivas_dirac_dec_output_synthesis_process_slot_fx( const Word32 *reference_power, /* i : Estimated power */ -#ifdef FIX_867_CLDFB_NRG_SCALE const Word16 *q_reference_power, /* i : Estimated power */ -#else - const Word16 q_reference_power, /* i : Estimated power */ -#endif const Word32 *onset, /* i : onset filter */ const Word16 *azimuth, const Word16 *elevation, diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 638e928f1..2462c1326 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -228,13 +228,8 @@ typedef struct dirac_dec_stack_mem Word32 *cy_auto_diff_smooth_fx; Word32 *reference_power_fx; -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 reference_power_q[2]; Word16 reference_power_smooth_q[2]; -#else - Word16 reference_power_q; - Word16 reference_power_smooth_q; -#endif Word16 reference_power_len; Word32 *onset_filter_fx; /* Q31 */ @@ -282,11 +277,7 @@ typedef struct dirac_output_synthesis_state_structure /* Temporal smoothing memories */ Word32 *reference_power_smooth_prev_fx; /* Q(reference_power_smooth_prev_q) */ -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 reference_power_smooth_prev_q[2]; -#else - Word16 reference_power_smooth_prev_q; -#endif Word32 *direction_smoothness_prev_fx; /* Q31 */ /* only pointer to local buffers */ @@ -304,18 +295,10 @@ typedef struct dirac_output_synthesis_state_structure Word16 diff_dir_power_factor_len; Word32 *proto_power_smooth_fx; /* Smoothed power of the prototype signals. Size: num_freq_bands*num_channels. */ -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 proto_power_smooth_q[2]; -#else - Word16 proto_power_smooth_q; -#endif Word16 proto_power_smooth_len; Word32 *proto_power_smooth_prev_fx; /* Smoothed power of the prototype signals of the previous synthesis block. Size: num_freq_bands*num_channels. */ -#ifdef FIX_867_CLDFB_NRG_SCALE Word16 proto_power_smooth_prev_q[2]; -#else - Word16 proto_power_smooth_prev_q; -#endif Word16 proto_power_smooth_prev_len; Word32 *proto_power_diff_smooth_fx; diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index 1fa9801e1..1ef5cd9f6 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -10021,15 +10021,10 @@ static void intermidiate_ext_dirac_render( IF( to_fix ) { -#ifdef FIX_867_CLDFB_NRG_SCALE DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[0] = Q31; DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1] = Q31; move16(); move16(); -#else - DirAC_mem.reference_power_smooth_q = DirAC_mem.reference_power_q = Q31; - move16(); -#endif move16(); FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { @@ -10158,7 +10153,6 @@ static void intermidiate_ext_dirac_render( IF( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx ) { -#ifdef FIX_867_CLDFB_NRG_SCALE tmp = 0; move16(); FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) @@ -10183,13 +10177,6 @@ static void intermidiate_ext_dirac_render( } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], tmp ); move16(); -#else - tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, imult1616( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ) ); - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + tmp) */ - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, tmp ); - move16(); -#endif -#ifdef FIX_867_CLDFB_NRG_SCALE tmp = 0; FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) { @@ -10211,12 +10198,6 @@ static void intermidiate_ext_dirac_render( } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ); move16(); -#else - tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, imult1616( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ) ); - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_len, tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q + tmp) */ - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q ); - move16(); -#endif } IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx != NULL ) { -- GitLab From 02f9987e44318f1acb61a4efb8ed5b153ef991d1 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:39:27 +0200 Subject: [PATCH 03/35] [cleanup] accept FIX_1737_proto_fac_overflow --- lib_com/options.h | 1 - lib_dec/ivas_mc_param_dec_fx.c | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 01d928336..02768deb6 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -71,7 +71,6 @@ #define BASOP_NOGLOB_DECLARE_LOCAL #endif -#define FIX_1737_proto_fac_overflow diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index c8cfe7af2..f47db8689 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -2374,21 +2374,13 @@ static void param_mc_protoSignalComputation_fx( FOR( band = 0; band < num_freq_bands; band++ ) { -#ifdef FIX_1737_proto_fac_overflow Word32 tmp_x = L_shl( Mpy_32_32( fac_fx, ( *( p_real_buffer_fx++ ) ) ), 4 ); // Q(26 + 4 + 6 - 31) :: Q5 -#else - Word32 tmp_x = Mpy_32_32( fac_fx, ( *( p_real_buffer_fx++ ) ) ); // Q(30 + 6 - 31) :: Q5 -#endif *( p_proto_frame_fx ) = L_add( *( p_proto_frame_fx ), tmp_x ); move32(); p_proto_frame_fx++; -#ifdef FIX_1737_proto_fac_overflow tmp_x = L_shl( Mpy_32_32( fac_fx, ( *( p_imag_buffer_fx++ ) ) ), 4 ); // Q(26 + 4 + 6 - 31) :: Q5 -#else - tmp_x = Mpy_32_32( fac_fx, ( *( p_imag_buffer_fx++ ) ) ); // Q(30 + 6 - 31) :: Q5 -#endif *( p_proto_frame_fx ) = L_add( *( p_proto_frame_fx ), tmp_x ); move32(); @@ -3614,11 +3606,7 @@ static ivas_error param_mc_get_diff_proto_info_fx( { p_diff_proto_info->source_chan_idx[cur_diff_proto][p_diff_proto_info->num_source_chan_diff[cur_diff_proto]] = cur_transport_ch; move16(); -#ifdef FIX_1737_proto_fac_overflow p_diff_proto_info->proto_fac_fx[cur_diff_proto][p_diff_proto_info->num_source_chan_diff[cur_diff_proto]] = *proto_fac_ptr; // (proto_fac_fx)Q26 = Q26 -#else - p_diff_proto_info->proto_fac_fx[cur_diff_proto][p_diff_proto_info->num_source_chan_diff[cur_diff_proto]] = L_shl( *proto_fac_ptr, 4 ); // (proto_fac_fx)Q26 + 4 = Q30 -#endif move16(); p_diff_proto_info->num_source_chan_diff[cur_diff_proto] = add( p_diff_proto_info->num_source_chan_diff[cur_diff_proto], 1 ); move16(); -- GitLab From 4124906b5ab11887952bc4e40b9c2285ff762ff3 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:40:54 +0200 Subject: [PATCH 04/35] [cleanup] accept OPT_MCT_ENC_V3_NBE, OPT_MCT_ENC_V2_BE --- lib_com/ivas_sns_com_fx.c | 39 ---------------- lib_com/options.h | 2 - lib_com/tools.c | 8 ---- lib_enc/cod_tcx_fx.c | 2 - lib_enc/ivas_stereo_mdct_stereo_enc_fx.c | 18 -------- lib_enc/tcx_utils_enc_fx.c | 58 ------------------------ 6 files changed, 127 deletions(-) diff --git a/lib_com/ivas_sns_com_fx.c b/lib_com/ivas_sns_com_fx.c index 1a0219b25..48be0cfd0 100644 --- a/lib_com/ivas_sns_com_fx.c +++ b/lib_com/ivas_sns_com_fx.c @@ -376,14 +376,6 @@ void sns_shape_spectrum_fx( { L64_tmp[k] = W_mult_32_32( spectrum[k], scf_int[i] ); // Q = q_spectrum + q_scf_int + 1 move64(); -#ifndef OPT_MCT_ENC_V3_NBE - shift = W_norm( L64_tmp[k] ); - if ( LT_16( shift, min_shift ) ) - { - min_shift = shift; - move16(); - } -#endif } } tmp_k = k; @@ -393,29 +385,18 @@ void sns_shape_spectrum_fx( *length = k; move16(); } -#ifdef OPT_MCT_ENC_V3_NBE min_shift = W_norm_arr( L64_tmp, k ); -#endif q_tmp = sub( add( add( *q_spectrum, q_scf_int ), min_shift ), 32 ); if ( GT_16( q_tmp, 30 ) ) { q_tmp = 30; move16(); } -#ifdef OPT_MCT_ENC_V3_NBE shift = sub( q_tmp, add( *q_spectrum, q_scf_int ) ); FOR( k = 0; k < tmp_k; k++ ) { spectrum[k] = W_shl_sat_l( L64_tmp[k], shift ); // q_tmp+1 move32(); -#else - FOR( k = 0; k < tmp_k; k++ ) - { - L64_tmp[k] = W_shr( L64_tmp[k], sub( add( *q_spectrum, q_scf_int ), q_tmp ) ); // Q = q_tmp+1 - move64(); - spectrum[k] = W_sat_l( L64_tmp[k] ); // Q = q_tmp+1 - move64(); -#endif } *q_spectrum = q_tmp; move16(); @@ -431,15 +412,6 @@ void sns_shape_spectrum_fx( { L64_tmp[k] = W_mult_32_32( spectrum[k], scf_int[i] ); // Q = q_spectrum + q_scf_int + 1 move64(); -#ifndef OPT_MCT_ENC_V3_NBE - shift = W_norm( L64_tmp[k] ); - test(); - if ( LT_16( shift, min_shift ) && NE_64( L64_tmp[k], 0 ) ) - { - min_shift = shift; - move16(); - } -#endif } } tmp_k = k; @@ -449,29 +421,18 @@ void sns_shape_spectrum_fx( *length = k; move16(); } -#ifdef OPT_MCT_ENC_V3_NBE min_shift = W_norm_arr( L64_tmp, k ); -#endif q_tmp = sub( add( add( *q_spectrum, q_scf_int ), min_shift ), 32 ); if ( GT_16( q_tmp, 30 ) ) { q_tmp = 30; move16(); } -#ifdef OPT_MCT_ENC_V3_NBE shift = sub( q_tmp, add( *q_spectrum, q_scf_int ) ); FOR( k = 0; k < tmp_k; k++ ) { spectrum[k] = W_shl_sat_l( L64_tmp[k], shift ); // q_tmp+1 move32(); -#else - FOR( k = 0; k < tmp_k; k++ ) - { - L64_tmp[k] = W_shr( L64_tmp[k], sub( add( *q_spectrum, q_scf_int ), q_tmp ) ); // q_tmp+1 - move64(); - spectrum[k] = W_sat_l( L64_tmp[k] ); // Q = q_tmp+1 - move64(); -#endif } *q_spectrum = q_tmp; move16(); diff --git a/lib_com/options.h b/lib_com/options.h index 02768deb6..f1f4bf2c1 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -76,8 +76,6 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE -#define OPT_MCT_ENC_V3_NBE -#define OPT_MCT_ENC_V2_BE #define OPT_BIN_REND_V2_NBE #define OPT_MCH_DEC_V1_NBE #define OPT_MASA_DEC_V1_NBE diff --git a/lib_com/tools.c b/lib_com/tools.c index 61c489157..909460c5d 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -687,11 +687,7 @@ Word32 dotp_fixed_o( move16(); test(); test(); -#ifdef OPT_MCT_ENC_V2_BE FOR( ; ( suma > MAX_32 ) || ( suma < MIN_32 ) || ( *res_q > 31 ); ) -#else - WHILE( GT_64( suma, MAX_32 ) || LT_64( suma, MIN_32 ) || GT_16( *res_q, 31 ) ) -#endif { suma = W_shr( suma, 1 ); *res_q = sub( *res_q, 1 ); @@ -721,11 +717,7 @@ Word32 dotp_fixed_32( move16(); test(); test(); -#ifdef OPT_MCT_ENC_V2_BE FOR( ; ( suma > MAX_32 ) || ( suma < MIN_32 ) || ( *res_q > 31 ); ) -#else - WHILE( GT_64( suma, MAX_32 ) || LT_64( suma, MIN_32 ) || GT_16( *res_q, 31 ) ) -#endif { suma = W_shr( suma, 1 ); *res_q = sub( *res_q, 1 ); diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index b520d9eeb..ff1e8a233 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -3203,11 +3203,9 @@ void QuantizeTCXSpectrum_fx( IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) { -#ifdef OPT_MCT_ENC_V3_NBE Word16 scale = sub( L_norm_arr( spectrum_fx, L_spec ), 2 ); scale_sig32( spectrum_fx, L_spec, scale ); *spectrum_e = sub( *spectrum_e, scale ); -#endif sqGain_fx = SQ_gain_estimate_fx( spectrum_fx, *spectrum_e, shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ), L_spec, &sqGain_e ); } ELSE diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c index f7735e8df..af00d5b3a 100644 --- a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c @@ -911,9 +911,7 @@ static Word32 SQ_gain_estimate_stereo_fx( // e_res offset_fx = fac_fx; /* Q25 */ move32(); -#ifdef OPT_MCT_ENC_V2_BE Word64 target_64_fx = W_shl( target_fx, 7 ); // Q25 -#endif /* find offset (0 to 128 dB with step of 0.125dB) */ FOR( iter = 0; iter < 10; iter++ ) { @@ -926,7 +924,6 @@ static Word32 SQ_gain_estimate_stereo_fx( // e_res { tmp_32 = L_sub( en_fx[i], offset_fx ); /* Q25 */ -#ifdef OPT_MCT_ENC_V2_BE /* avoid SV with 1 bin of amp < 0.5f */ if ( GT_32( tmp_32, 10066329 /*0.3 Q25*/ ) ) { @@ -938,21 +935,6 @@ static Word32 SQ_gain_estimate_stereo_fx( // e_res offset_fx = L_add( offset_fx, fac_fx ); /* Q25 */ BREAK; } -#else - - /* avoid SV with 1 bin of amp < 0.5f */ - IF( GT_32( tmp_32, 10066329 /*0.3 Q25*/ ) ) - { - W_tmp = W_add( W_tmp, W_deposit32_l( tmp_32 ) ); /* Q25 */ - - /* if ener is above target -> break and increase offset */ - IF( GT_64( W_tmp, W_shl( W_deposit32_l( target_fx ), 7 ) ) ) - { - offset_fx = L_add( offset_fx, fac_fx ); /* Q25 */ - BREAK; - } - } -#endif } } diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index cd4c07297..c42a8c755 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -1053,10 +1053,8 @@ Word16 SQ_gain_estimate_fx( /* output: SQ gain Word32 tmp = 0, tmpp = 0; move32(); move32(); -#ifdef OPT_MCT_ENC_V3_NBE Word64 ener64_fx; Word16 tmp_exp; -#endif /* tmp = 0.5f * (float) log10( (float) lg / (float) NORM_MDCT_FACTOR ) + + 0.94f; lowest gain + expected value of the quantization noise energy per quadruple (log10(4/12)) in Q16*/ /* tmpp = 0.5f * (float) log10( (float) lg / (float) NORM_MDCT_FACTOR ) * log2(10) in Q16 */ @@ -1170,13 +1168,10 @@ Word16 SQ_gain_estimate_fx( /* output: SQ gain lg_4 = shr( lg, 2 ); -#ifdef OPT_MCT_ENC_V3_NBE tmp_exp = shl( x_e, 1 ); -#endif /* SNR of quadruples for unit step quantizer and lowest possible gain */ FOR( i = 0; i < lg_4; i++ ) { -#ifdef OPT_MCT_ENC_V3_NBE ener64_fx = W_mac_32_32( 1, x[0], x[0] ); // exp:2*x_e ener64_fx = W_mac_32_32( ener64_fx, x[1], x[1] ); // exp:2*x_e ener64_fx = W_mac_32_32( ener64_fx, x[2], x[2] ); // exp:2*x_e @@ -1184,54 +1179,6 @@ Word16 SQ_gain_estimate_fx( /* output: SQ gain s = W_norm( ener64_fx ); ener = W_extract_h( W_shl( ener64_fx, s ) ); s = sub( tmp_exp, s ); -#else - /* normalization */ - s = 15; - move16(); - - tmp16 = norm_l( x[0] ); - IF( x[0] != 0 ) - { - s = s_min( s, tmp16 ); - } - - tmp16 = norm_l( x[1] ); - IF( x[1] != 0 ) - { - s = s_min( s, tmp16 ); - } - - tmp16 = norm_l( x[2] ); - IF( x[2] != 0 ) - { - s = s_min( s, tmp16 ); - } - - tmp16 = norm_l( x[3] ); - IF( x[3] != 0 ) - { - s = s_min( s, tmp16 ); - } - - s = sub( s, 2 ); /* 2 bits headroom */ - - /* calc quadruple energy */ - ener = L_deposit_l( 1 ); - - tmp16 = extract_h( L_shl( x[0], s ) ); - ener = L_mac( ener, tmp16, tmp16 ); - - tmp16 = extract_h( L_shl( x[1], s ) ); - ener = L_mac( ener, tmp16, tmp16 ); - - tmp16 = extract_h( L_shl( x[2], s ) ); - ener = L_mac( ener, tmp16, tmp16 ); - - tmp16 = extract_h( L_shl( x[3], s ) ); - ener = L_mac( ener, tmp16, tmp16 ); - - s = shl( sub( x_e, s ), 1 ); -#endif /* log */ tmp32 = L_add_sat( BASOP_Util_Log2( ener ), L_shl_sat( L_deposit_l( s ), 25 ) ); /* log2, 6Q25 */ en[i] = L_add_sat( L_shr( tmp32, 9 ), tmp ); /* 15Q16 */ @@ -1257,13 +1204,8 @@ Word16 SQ_gain_estimate_fx( /* output: SQ gain { tmp32 = L_sub( en[i], offset ); -#ifdef OPT_MCT_ENC_V3_NBE /* avoid SV with 1 bin of amp < 0.5f */ if ( GT_32( tmp32, 0xFF20 ) ) /* 0xFF20 -> 0.3*log2(10); */ -#else - /* avoid SV with 1 bin of amp < 0.5f */ - IF( GT_32( tmp32, 0xFF20 ) ) /* 0xFF20 -> 0.3*log2(10); */ -#endif { ener = L_add( ener, tmp32 ); } -- GitLab From c03667b759aa1ddcc61e89f47716ea2fd6c3602f Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:41:57 +0200 Subject: [PATCH 05/35] [cleanup] accept OPT_MCH_DEC_V1_NBE --- lib_com/options.h | 1 - lib_dec/ivas_dirac_output_synthesis_cov_fx.c | 36 --------- lib_dec/ivas_svd_dec_fx.c | 66 ---------------- lib_rend/ivas_dirac_decorr_dec_fx.c | 82 -------------------- 4 files changed, 185 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index f1f4bf2c1..3b17f0e7c 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,7 +77,6 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE #define OPT_BIN_REND_V2_NBE -#define OPT_MCH_DEC_V1_NBE #define OPT_MASA_DEC_V1_NBE #define OPT_MASA_DEC_V2_NBE #define OPT_MCT_ENC_48KB_NBE diff --git a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c index 238ca3704..0996a9700 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c @@ -886,11 +886,7 @@ Word16 computeMixingMatrices_fx( move16(); FOR( i = 1; i < lengthCx; i++ ) { -#ifdef OPT_MCH_DEC_V1_NBE IF( GT_32( svd_s_buffer_fx[i], L_shl_sat( limit_fx, sub( limit_e, svd_s_buffer_e[i] ) ) ) ) -#else /* OPT_MCH_DEC_V1_NBE */ - IF( BASOP_Util_Cmp_Mant32Exp( svd_s_buffer_fx[i], svd_s_buffer_e[i], limit_fx, limit_e ) > 0 ) -#endif /* OPT_MCH_DEC_V1_NBE */ { limit_fx = svd_s_buffer_fx[i]; move32(); @@ -910,11 +906,7 @@ Word16 computeMixingMatrices_fx( FOR( i = 0; i < lengthCx; ++i ) { -#ifdef OPT_MCH_DEC_V1_NBE IF( LT_32( L_shl_sat( svd_s_buffer_fx[i], sub( svd_s_buffer_e[i], limit_e ) ), limit_fx ) ) -#else /* OPT_MCH_DEC_V1_NBE */ - IF( BASOP_Util_Cmp_Mant32Exp( svd_s_buffer_fx[i], svd_s_buffer_e[i], limit_fx, limit_e ) < 0 ) -#endif /* OPT_MCH_DEC_V1_NBE */ { svd_s_buffer_fx[i] = limit_fx; move32(); @@ -959,16 +951,10 @@ Word16 computeMixingMatrices_fx( matrix_product_diag_fx( Q_Cx_fx, Q_Cx_e, lengthCy, lengthCx, 0, Q_fx, Q_e, lengthCy, lengthCx, 1, Cy_hat_diag_fx, &Cy_hat_diag_e ); -#ifdef OPT_MCH_DEC_V1_NBE Word16 com_e = sub( limit_e, Cy_hat_diag_e ); -#endif /* OPT_MCH_DEC_V1_NBE */ FOR( i = 0; i < lengthCy; ++i ) { -#ifdef OPT_MCH_DEC_V1_NBE IF( GT_32( Cy_hat_diag_fx[i], L_shl_sat( limit_fx, com_e ) ) ) -#else /* OPT_MCH_DEC_V1_NBE */ - IF( BASOP_Util_Cmp_Mant32Exp( Cy_hat_diag_fx[i], Cy_hat_diag_e, limit_fx, limit_e ) > 0 ) -#endif /* OPT_MCH_DEC_V1_NBE */ { limit_fx = Cy_hat_diag_fx[i]; move32(); @@ -984,19 +970,13 @@ Word16 computeMixingMatrices_fx( #endif /* OPT_MCH_DEC_V1_BE */ limit_e = add( limit_e, reg_ghat_e ); -#ifdef OPT_MCH_DEC_V1_NBE com_e = sub( Cy_hat_diag_e, limit_e ); -#endif /* OPT_MCH_DEC_V1_NBE */ FOR( i = 0; i < lengthCy; ++i ) { Cy_hat_diag_buff_e[i] = Cy_hat_diag_e; move16(); -#ifdef OPT_MCH_DEC_V1_NBE IF( GT_32( limit_fx, L_shl_sat( Cy_hat_diag_fx[i], com_e ) ) ) -#else /* OPT_MCH_DEC_V1_NBE */ - IF( BASOP_Util_Cmp_Mant32Exp( limit_fx, limit_e, Cy_hat_diag_fx[i], Cy_hat_diag_buff_e[i] ) > 0 ) /* Computing Cy_hat_diag = max(Cy_hat_diag,limit) */ -#endif /* OPT_MCH_DEC_V1_NBE */ { Cy_hat_diag_fx[i] = limit_fx; move32(); @@ -1416,11 +1396,7 @@ Word16 computeMixingMatricesResidual_fx( FOR( i = 0; i < lengthCx; ++i ) { -#ifdef OPT_MCH_DEC_V1_NBE IF( GT_32( Kx_fx[i], L_shl_sat( limit_fx, sub( limit_e, Kx_fx_e[i] ) ) ) ) -#else /* OPT_MCH_DEC_V1_NBE */ - IF( BASOP_Util_Cmp_Mant32Exp( Kx_fx[i], Kx_fx_e[i], limit_fx, limit_e ) > 0 ) -#endif /* OPT_MCH_DEC_V1_NBE */ { div_tmp = Kx_fx[i]; move32(); @@ -1461,16 +1437,10 @@ Word16 computeMixingMatricesResidual_fx( Cy_hat_diag_e = Cx_e; move16(); -#ifdef OPT_MCH_DEC_V1_NBE Word16 com_e = sub( limit_e, Cy_hat_diag_e ); -#endif /* OPT_MCH_DEC_V1_NBE */ FOR( i = 0; i < lengthCy; ++i ) { -#ifdef OPT_MCH_DEC_V1_NBE IF( GT_32( Cy_hat_diag_fx[i], L_shl_sat( limit_fx, com_e ) ) ) -#else /* OPT_MCH_DEC_V1_NBE */ - IF( BASOP_Util_Cmp_Mant32Exp( Cy_hat_diag_fx[i], Cy_hat_diag_e, limit_fx, limit_e ) > 0 ) -#endif /* OPT_MCH_DEC_V1_NBE */ { limit_fx = Cy_hat_diag_fx[i]; move32(); @@ -1489,18 +1459,12 @@ Word16 computeMixingMatricesResidual_fx( /* Computing G_hat */ -#ifdef OPT_MCH_DEC_V1_NBE com_e = sub( Cy_hat_diag_e, limit_e ); -#endif /* OPT_MCH_DEC_V1_NBE */ FOR( i = 0; i < lengthCy; ++i ) { Cy_hat_diag_fx_e[i] = Cy_hat_diag_e; move16(); -#ifdef OPT_MCH_DEC_V1_NBE IF( GT_32( limit_fx, L_shl_sat( Cy_hat_diag_fx[i], com_e ) ) ) /* Computing Cy_hat_diag = max(Cy_hat_diag,limit) */ -#else /* OPT_MCH_DEC_V1_NBE */ - IF( BASOP_Util_Cmp_Mant32Exp( limit_fx, limit_e, Cy_hat_diag_fx[i], Cy_hat_diag_e ) > 0 ) /* Computing Cy_hat_diag = max(Cy_hat_diag,limit) */ -#endif /* OPT_MCH_DEC_V1_NBE */ { Cy_hat_diag_fx[i] = limit_fx; move32(); diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index ba65c4b7b..84fad45ba 100644 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -322,11 +322,7 @@ Word16 svd_fx( move16(); FOR( iCh = 0; iCh < lengthSingularValues - 1; iCh++ ) { -#ifdef OPT_MCH_DEC_V1_NBE IF( LT_32( L_shl_sat( singularValues_fx[iCh], sub( singularValues_fx_e[iCh], singularValues_fx_e[iCh + 1] ) ), singularValues_fx[iCh + 1] ) ) -#else /* OPT_MCH_DEC_V1_NBE */ - IF( BASOP_Util_Cmp_Mant32Exp( singularValues_fx[iCh], singularValues_fx_e[iCh], singularValues_fx[iCh + 1], singularValues_fx_e[iCh + 1] ) < 0 ) -#endif /* OPT_MCH_DEC_V1_NBE */ { condition = 1; move16(); @@ -431,24 +427,15 @@ static Word16 BidagonalDiagonalisation_fx( FOR( jCh = iCh; jCh >= 0; jCh-- ) { -#ifdef OPT_MCH_DEC_V1_NBE Word16 com_e = s_max( secDiag_new_e[jCh], eps_x_e ); IF( LE_32( L_shr( L_abs( secDiag_fx[jCh] ), sub( com_e, secDiag_new_e[jCh] ) ), L_shr( Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), sub( com_e, eps_x_e ) ) ) ) /* is secDiag[ch] vanishing compared to eps_x */ -#else - split = sub( jCh, 1 ); /* Q0 */ /* OPT_MCH_DEC_V1_NBE */ - IF( LE_16( BASOP_Util_Cmp_Mant32Exp( L_abs( secDiag_fx[jCh] ), secDiag_new_e[jCh], Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), eps_x_e ), 0 ) ) /* is secDiag[ch] vanishing compared to eps_x */ -#endif /* OPT_MCH_DEC_V1_NBE */ { found_split = 0; move16(); BREAK; } -#ifdef OPT_MCH_DEC_V1_NBE com_e = s_max( singularValues_new_e[jCh - 1], eps_x_e ); IF( LE_32( L_shr( L_abs( singularValues_fx[jCh - 1] ), sub( com_e, singularValues_new_e[jCh - 1] ) ), L_shr( Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), sub( com_e, eps_x_e ) ) ) ) /* is singularValues[jCh - 1] vanishing compared to eps_x */ -#else /* OPT_MCH_DEC_V1_NBE */ - IF( LE_16( BASOP_Util_Cmp_Mant32Exp( L_abs( singularValues_fx[split] ), singularValues_new_e[split], Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), eps_x_e ), 0 ) ) /* is singularValues[split] vanishing compared to eps_x */ -#endif /* OPT_MCH_DEC_V1_NBE */ { BREAK; } @@ -476,21 +463,15 @@ static Word16 BidagonalDiagonalisation_fx( move32(); c_e = 0; move16(); -#ifdef OPT_MCH_DEC_V1_NBE split = sub( jCh, 1 ); /* Q0 */ -#endif /* OPT_MCH_DEC_V1_NBE */ FOR( kCh = jCh; kCh <= iCh; kCh++ ) { g = Mpy_32_32( s, secDiag_fx[kCh] ); /* exp(s_e + secDiag_new_e) */ g_e = add( s_e, secDiag_new_e[kCh] ); secDiag_fx[kCh] = Mpy_32_32( c, secDiag_fx[kCh] ); /* exp(c_e + secDiag_new_e) */ secDiag_new_e[kCh] = add( c_e, secDiag_new_e[kCh] ); -#ifdef OPT_MCH_DEC_V1_NBE Word16 com_e = s_max( g_e, eps_x_e ); IF( LE_32( L_shr( L_abs( g ), sub( com_e, g_e ) ), L_shr( Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), sub( com_e, eps_x_e ) ) ) ) -#else /* OPT_MCH_DEC_V1_NBE */ - IF( LE_16( BASOP_Util_Cmp_Mant32Exp( L_abs( g ), g_e, Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), eps_x_e ), 0 ) ) /* is singularValues[split] vanishing compared to eps_x */ -#endif /* OPT_MCH_DEC_V1_NBE */ { BREAK; } @@ -950,15 +931,9 @@ static void biDiagonalReductionLeft_fx( Word16 invVal_e; Word32 invVal; invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e ); -#ifdef OPT_MCH_DEC_V1_NBE Word64 temp = 0; move64(); Word16 max_e = MIN_16; -#else /* OPT_MCH_DEC_V1_NBE */ - norm_x = 0; - move32(); - norm_x_e = 0; -#endif /* OPT_MCH_DEC_V1_NBE */ move16(); FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { @@ -967,14 +942,9 @@ static void biDiagonalReductionLeft_fx( move32(); singularVectors2_e[jCh][currChannel] = sub( add( invVal_e, sub( singularVectors2_e[jCh][currChannel], *sig_x_e ) ), temp_e ); move16(); -#ifdef OPT_MCH_DEC_V1_NBE max_e = s_max( max_e, singularVectors2_e[jCh][currChannel] ); -#else /* OPT_MCH_DEC_V1_NBE */ - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][currChannel] ), shl( singularVectors2_e[jCh][currChannel], 1 ), &norm_x_e ); /* exp(norm_x_e) */ -#endif /* OPT_MCH_DEC_V1_NBE */ } -#ifdef OPT_MCH_DEC_V1_NBE FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { temp = W_add( temp, L_shr( Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][currChannel] ), shl( sub( max_e, singularVectors2_e[jCh][currChannel] ), 1 ) ) ); @@ -984,7 +954,6 @@ static void biDiagonalReductionLeft_fx( nrm = sub( nrm, 32 ); norm_x = W_shl_sat_l( temp, nrm ); norm_x_e = sub( add( max_e, max_e ), nrm ); -#endif /* OPT_MCH_DEC_V1_NBE */ IF( GT_16( norm_x_e, 0 ) ) { @@ -1013,7 +982,6 @@ static void biDiagonalReductionLeft_fx( FOR( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ { -#ifdef OPT_MCH_DEC_V1_NBE Word16 max2_e = MIN_16; max_e = MIN_16; move16(); @@ -1036,16 +1004,6 @@ static void biDiagonalReductionLeft_fx( nrm = sub( nrm, 32 ); norm_x = W_shl_sat_l( temp, nrm ); norm_x_e = sub( max_e, nrm ); -#else /* OPT_MCH_DEC_V1_NBE */ - norm_x = 0; - move32(); - norm_x_e = 0; - move16(); - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ - { - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][iCh] ), add( singularVectors2_e[jCh][currChannel], singularVectors2_e[jCh][iCh] ), &norm_x_e ); /* exp(norm_x_e) */ - } -#endif /* OPT_MCH_DEC_V1_NBE */ f = Mpy_32_32( norm_x, invVal ); /* invVal_e + (norm_x_e - r_e) */ f_e = add( invVal_e, sub( norm_x_e, r_e ) ); @@ -1297,16 +1255,11 @@ static void singularVectorsAccumulationLeft_fx( move32(); } } -#ifdef OPT_MCH_DEC_V1_NBE Word16 exp = s_max( singularVectors_Left_e[nCh][nCh], 1 ); singularVectors_Left[nCh][nCh] = L_sub( L_shr( singularVectors_Left[nCh][nCh], sub( exp, singularVectors_Left_e[nCh][nCh] ) ), L_shr( MINUS_ONE_IN_Q31, exp ) ); /* exp(sing_exp2) */ move32(); singularVectors_Left_e[nCh][nCh] = exp; move16(); -#else /* OPT_MCH_DEC_V1_NBE */ - singularVectors_Left[nCh][nCh] = BASOP_Util_Add_Mant32Exp( singularVectors_Left[nCh][nCh], singularVectors_Left_e[nCh][nCh], ONE_IN_Q30, 1, &singularVectors_Left_e[nCh][nCh] ); /* exp(sing_exp2) */ - move32(); -#endif /* OPT_MCH_DEC_V1_NBE */ } // fclose(fp); FOR( nCh = 0; nCh < nChannelsL; nCh++ ) @@ -1369,7 +1322,6 @@ static void singularVectorsAccumulationRight_fx( FOR( iCh = nCh + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ { -#ifdef OPT_MCH_DEC_V1_NBE Word64 norm_val = 0; move64(); Word16 maxL_e = MIN_16; @@ -1384,41 +1336,23 @@ static void singularVectorsAccumulationRight_fx( maxR_e = s_max( maxR_e, sing_right_exp[k][iCh] ); maxR2_e = s_max( maxR2_e, sing_right_exp[k][nCh] ); } -#else /* OPT_MCH_DEC_V1_NBE */ - norm_y = 0; - move32(); - norm_y_e = 0; - move16(); -#endif /* OPT_MCH_DEC_V1_NBE */ FOR( k = nCh + 1; k < nChannelsC; k++ ) /* nChannelsC */ { -#ifdef OPT_MCH_DEC_V1_NBE norm_val = W_mac_32_32( norm_val, L_shr( singularVectors_Left[nCh][k], sub( maxL_e, singularVectors_Left_e[nCh][k] ) ), L_shr( singularVectors_Right[k][iCh], sub( maxR_e, sing_right_exp[k][iCh] ) ) ); -#else /* OPT_MCH_DEC_V1_NBE */ - norm_y = BASOP_Util_Add_Mant32Exp( norm_y, norm_y_e, Mpy_32_32( singularVectors_Left[nCh][k], singularVectors_Right[k][iCh] ), add( singularVectors_Left_e[nCh][k], sing_right_exp[k][iCh] ), &norm_y_e ); /* exp(norm_y_e) */ -#endif /* OPT_MCH_DEC_V1_NBE */ } -#ifdef OPT_MCH_DEC_V1_NBE norm_y_e = W_norm( norm_val ); norm_y = W_extract_h( W_shl( norm_val, norm_y_e ) ); norm_y_e = sub( add( maxL_e, maxR_e ), norm_y_e ); Word16 max_new = s_max( maxR_e, add( maxR2_e, norm_y_e ) ); -#endif /* OPT_MCH_DEC_V1_NBE */ FOR( k = nCh + 1; k < nChannelsC; k++ ) /* nChannelsC */ { -#ifdef OPT_MCH_DEC_V1_NBE Word32 temp = Mpy_32_32( norm_y, singularVectors_Right[k][nCh] ); Word32 op2 = L_shr( temp, sub( max_new, add( norm_y_e, sing_right_exp[k][nCh] ) ) ); singularVectors_Right[k][iCh] = L_add_sat( L_shr( singularVectors_Right[k][iCh], sub( max_new, sing_right_exp[k][iCh] ) ), op2 ); /* exp(sing_right_exp) */ move32(); singularVectors_Right[k][iCh] = L_shl_sat( singularVectors_Right[k][iCh], max_new ); /* Q31 */ -#else /* OPT_MCH_DEC_V1_NBE */ - singularVectors_Right[k][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors_Right[k][iCh], sing_right_exp[k][iCh], Mpy_32_32( norm_y, singularVectors_Right[k][nCh] ), add( norm_y_e, sing_right_exp[k][nCh] ), &sing_right_exp[k][iCh] ); /* exp(sing_right_exp) */ - move32(); - singularVectors_Right[k][iCh] = L_shl_sat( singularVectors_Right[k][iCh], sing_right_exp[k][iCh] ); /* Q31 */ -#endif /* OPT_MCH_DEC_V1_NBE */ move32(); sing_right_exp[k][iCh] = 0; move16(); diff --git a/lib_rend/ivas_dirac_decorr_dec_fx.c b/lib_rend/ivas_dirac_decorr_dec_fx.c index 28c3cd5e7..f6c09d55b 100644 --- a/lib_rend/ivas_dirac_decorr_dec_fx.c +++ b/lib_rend/ivas_dirac_decorr_dec_fx.c @@ -514,9 +514,7 @@ void ivas_dirac_dec_decorr_process_fx( max_band_decorr = h_freq_domain_decorr_ap_params->max_band_decorr; move16(); -#if ( defined OPT_MCH_DEC_V1_NBE || defined OPT_MCH_DEC_V1_BE ) Word16 decorX2 = shl( max_band_decorr, 1 ); -#endif set32_fx( onset_filter_fx, ONE_IN_Q31, imult1616( num_protos_diff, num_freq_bands ) ); @@ -869,25 +867,17 @@ void ivas_dirac_dec_decorr_process_fx( Word16 max_e = s_max( aux_e, e_reverb_energy_smooth ); Word16 shr_aux = sub( max_e, aux_e ); /* Note: headroom is zero */ Word16 shr_res = sub( max_e, e_reverb_energy_smooth ); /* Note: headroom is zero */ -#ifdef OPT_MCH_DEC_V1_NBE Word32 temp1 = L_shr( ONE_M_DIRAC_DUCK_ALPHA, shr_aux ); Word32 temp2 = L_shr( DIRAC_DUCK_ALPHA_FX, shr_res ); -#endif /* OPT_MCH_DEC_V1_NBE */ /* Note: DIRAC_DUCK_ALPHA_FX and ONE_M_DIRAC_DUCK_ALPHA are both in Q31 (e=0) */ /* => a multiplication with this values does not change the q/e value. */ FOR( Word16 i = 0; i < len; i++ ) { -#ifdef OPT_MCH_DEC_V1_NBE h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx[i] = Madd_32_32( Mpy_32_32( aux_buffer_fx[i], temp1 ), h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx[i], temp2 ); -#else /* OPT_MCH_DEC_V1_NBE */ - h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx[i] = L_add( - L_shr( Mpy_32_32( aux_buffer_fx[i], ONE_M_DIRAC_DUCK_ALPHA ), shr_aux ), - L_shr( Mpy_32_32( h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx[i], DIRAC_DUCK_ALPHA_FX ), shr_res ) ); -#endif /* OPT_MCH_DEC_V1_NBE */ move32(); } e_reverb_energy_smooth = max_e; @@ -900,22 +890,14 @@ void ivas_dirac_dec_decorr_process_fx( Word16 max_x = s_max( den_e, e_direct_energy_smooth ); Word16 shr_den = sub( max_x, den_e ); /* Note: headroom is zero */ Word16 shr_des = sub( max_x, e_direct_energy_smooth ); /* Note: headroom is zero */ -#ifdef OPT_MCH_DEC_V1_NBE temp1 = L_shr( ONE_M_DIRAC_DUCK_ALPHA, shr_den ); temp2 = L_shr( DIRAC_DUCK_ALPHA_FX, shr_des ); -#endif /* OPT_MCH_DEC_V1_NBE */ FOR( Word16 i = 0; i < len; i++ ) { -#ifdef OPT_MCH_DEC_V1_NBE h_freq_domain_decorr_ap_state->direct_energy_smooth_fx[i] = Madd_32_32( Mpy_32_32( direct_energy_fx[i], temp1 ), h_freq_domain_decorr_ap_state->direct_energy_smooth_fx[i], temp2 ); -#else /* OPT_MCH_DEC_V1_NBE */ - h_freq_domain_decorr_ap_state->direct_energy_smooth_fx[i] = L_add( - L_shr( Mpy_32_32( direct_energy_fx[i], ONE_M_DIRAC_DUCK_ALPHA ), shr_den ), - L_shr( Mpy_32_32( h_freq_domain_decorr_ap_state->direct_energy_smooth_fx[i], DIRAC_DUCK_ALPHA_FX ), shr_des ) ); -#endif /* OPT_MCH_DEC_V1_NBE */ move32(); } e_direct_energy_smooth = max_x; @@ -924,22 +906,6 @@ void ivas_dirac_dec_decorr_process_fx( move16(); // scaling energy buffers for better precision for higher values// -#ifndef OPT_MCH_DEC_V1_NBE - q_shift = L_norm_arr( h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, imult1616( num_protos_dir, max_band_decorr ) ); - IF( q_shift != 0 ) - { - Scale_sig32( h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, imult1616( num_protos_dir, max_band_decorr ), q_shift ); - h_freq_domain_decorr_ap_state->q_direct_energy_smooth = add( h_freq_domain_decorr_ap_state->q_direct_energy_smooth, q_shift ); - move16(); - } - q_shift = L_norm_arr( h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, imult1616( num_channels, max_band_decorr ) ); - IF( q_shift != 0 ) - { - Scale_sig32( h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, imult1616( num_channels, max_band_decorr ), q_shift ); - h_freq_domain_decorr_ap_state->q_reverb_energy_smooth = add( h_freq_domain_decorr_ap_state->q_reverb_energy_smooth, q_shift ); - move16(); - } -#endif h_freq_domain_decorr_ap_state->q_reverb_energy_smooth = s_min( MAX_Q_FX, h_freq_domain_decorr_ap_state->q_reverb_energy_smooth ); h_freq_domain_decorr_ap_state->q_direct_energy_smooth = s_min( MAX_Q_FX, h_freq_domain_decorr_ap_state->q_direct_energy_smooth ); @@ -951,16 +917,9 @@ void ivas_dirac_dec_decorr_process_fx( move16(); FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { -#ifdef OPT_MCH_DEC_V1_NBE q_shift = s_min( q_shift, L_norm_arr( &frame_dec_fx[2 * ch_idx * num_freq_bands], decorX2 ) ); -#else /* OPT_MCH_DEC_V1_NBE */ - q_shift = s_min( q_shift, - sub( L_norm_arr( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ) ), - Q2 ) ); -#endif /* OPT_MCH_DEC_V1_NBE */ } -#ifdef OPT_MCH_DEC_V1_NBE q_shift = sub( q_shift, 2 ); FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { @@ -970,13 +929,6 @@ void ivas_dirac_dec_decorr_process_fx( Word16 diff1 = sub( e_direct_energy_smooth, e_reverb_energy_smooth ); Word16 diff2 = add( Q30, diff1 ); diff1 = sub( Q30, diff1 ); -#else /* OPT_MCH_DEC_V1_NBE */ - FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) - { - Scale_sig32( &frame_dec_fx[shl( imult1616( ch_idx, num_freq_bands ), 1 )], shl( max_band_decorr, 1 ), q_shift ); - } - q_frame_f = add( q_frame_f, q_shift ); -#endif /* OPT_MCH_DEC_V1_NBE */ FOR( ch_idx = 0; ch_idx < num_channels; ch_idx++ ) { @@ -996,22 +948,12 @@ void ivas_dirac_dec_decorr_process_fx( move32(); move32(); -#ifdef OPT_MCH_DEC_V1_NBE Word64 temp_1 = W_sub( W_shl( reverb_energy_loc, diff1 ), W_mult0_32_32( direct_energy_loc, DIRAC_DUCK_GAMMA_FX ) ); Word64 temp_2 = W_sub( W_shl( direct_energy_loc, diff2 ), W_mult0_32_32( reverb_energy_loc, DIRAC_DUCK_GAMMA_FX ) ); IF( temp_1 > 0 ) { duck_gain = BASOP_Util_Divide3232_Scale( Mpy_32_32( direct_energy_loc, DIRAC_DUCK_GAMMA_FX ), L_add( reverb_energy_loc, EPSILON_FX ), &e_duck_gain ); -#else /* OPT_MCH_DEC_V1_NBE */ - Word32 temp_1 = Mpy_32_32( direct_energy_loc, DIRAC_DUCK_GAMMA_FX ); // e+1 - Word32 temp_2 = Mpy_32_32( reverb_energy_loc, DIRAC_DUCK_GAMMA_FX ); // e+1 - Word16 comp_flag_1 = BASOP_Util_Cmp_Mant32Exp( reverb_energy_loc, e_reverb_energy_smooth, temp_1, add( e_direct_energy_smooth, 1 ) ); - Word16 comp_flag_2 = BASOP_Util_Cmp_Mant32Exp( direct_energy_loc, e_direct_energy_smooth, temp_2, add( e_reverb_energy_smooth, 1 ) ); - IF( EQ_16( comp_flag_1, 1 ) ) - { - duck_gain = BASOP_Util_Divide3232_Scale( temp_1, L_add( reverb_energy_loc, EPSILON_FX ), &e_duck_gain ); -#endif /* OPT_MCH_DEC_V1_NBE */ e_duck_gain = add( e_duck_gain, sub( add( e_direct_energy_smooth, 1 ), e_reverb_energy_smooth ) ); duck_gain = Sqrt16( duck_gain, &e_duck_gain ); @@ -1023,17 +965,10 @@ void ivas_dirac_dec_decorr_process_fx( move32(); move32(); } -#ifdef OPT_MCH_DEC_V1_NBE ELSE IF( temp_2 > 0 ) { duck_gain = BASOP_Util_Divide3232_Scale( direct_energy_loc, L_add( Mpy_32_32( reverb_energy_loc, DIRAC_DUCK_GAMMA_FX ), EPSILON_FX ), &e_duck_gain ); -#else /* OPT_MCH_DEC_V1_NBE */ - ELSE IF( EQ_16( comp_flag_2, 1 ) ) - { - - duck_gain = BASOP_Util_Divide3232_Scale( direct_energy_loc, L_add( temp_2, EPSILON_FX ), &e_duck_gain ); -#endif /* OPT_MCH_DEC_V1_NBE */ e_duck_gain = add( e_duck_gain, sub( e_direct_energy_smooth, add( e_reverb_energy_smooth, 1 ) ) ); duck_gain = Sqrt16( duck_gain, &e_duck_gain ); @@ -1104,7 +1039,6 @@ void ivas_dirac_dec_decorr_process_fx( IF( EQ_16( h_freq_domain_decorr_ap_params->add_back_onsets_on, 1 ) ) { -#ifdef OPT_MCH_DEC_V1_NBE IF( q_if_local ) { FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) @@ -1141,22 +1075,6 @@ void ivas_dirac_dec_decorr_process_fx( v_add_fx( &frame_dec_fx[2 * ch_idx * num_freq_bands], aux_buffer_fx, &frame_dec_fx[2 * ch_idx * num_freq_bands], decorX2 ); } } -#else /* OPT_MCH_DEC_V1_NBE */ - FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) - { - offset = imult1616( proto_index_dir[ch_idx], num_freq_bands ); - - FOR( k = 0; k < max_band_decorr; ++k ) - { - aux_buffer_fx[2 * k] = Mpy_32_32( L_shr_r( input_frame_fx[2 * ( offset + k )], q_if_local ), L_sub( ONE_IN_Q31, onset_filter_fx[offset + k] ) ); - aux_buffer_fx[add( shl( k, 1 ), 1 )] = Mpy_32_32( L_shr_r( input_frame_fx[2 * ( offset + k ) + 1], q_if_local ), L_sub( ONE_IN_Q31, onset_filter_fx[offset + k] ) ); // q_frame_f - move32(); - move32(); - } - - v_add_fx( &frame_dec_fx[2 * ch_idx * num_freq_bands], aux_buffer_fx, &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ) ); - } -#endif /* OPT_MCH_DEC_V1_NBE */ } /* avoid decorrelation above maximum frequency -> set to zero the remaining frequencies*/ -- GitLab From a93f4a8626d9a11e7f2f9697ed5003d582708e82 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:43:35 +0200 Subject: [PATCH 06/35] [cleanup] accept OPT_MASA_DEC_V1_NBE, OPT_MASA_DEC_V2_NBE --- lib_com/options.h | 2 - lib_rend/ivas_objectRenderer_hrFilt_fx.c | 112 ----------------------- lib_rend/ivas_objectRenderer_sfx_fx.c | 39 -------- 3 files changed, 153 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 3b17f0e7c..2acf7e8e5 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,8 +77,6 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE #define OPT_BIN_REND_V2_NBE -#define OPT_MASA_DEC_V1_NBE -#define OPT_MASA_DEC_V2_NBE #define OPT_MCT_ENC_48KB_NBE #define OPT_MCH_DEC_V1_BE #define OPT_MCT_ENC_V2_NBE diff --git a/lib_rend/ivas_objectRenderer_hrFilt_fx.c b/lib_rend/ivas_objectRenderer_hrFilt_fx.c index 8504722af..f86973171 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt_fx.c +++ b/lib_rend/ivas_objectRenderer_hrFilt_fx.c @@ -254,7 +254,6 @@ static void GenerateFilter_fx( move16(); FOR( p = 0; p < num_ev_idx; p++ ) { -#ifdef OPT_MASA_DEC_V1_NBE Word32 expt = L_shl_sat( modelEval->elevBfVec_fx[p], 1 ); FOR( i = 0; i < num_az_idx[p]; i++ ) { @@ -263,80 +262,35 @@ static void GenerateFilter_fx( BM_idx[qp + i] = add( model->azim_start_idx[EvIdx[p]], AzIdx[p][i] ); move16(); } -#else /* OPT_MASA_DEC_V1_NBE */ - FOR( i = 0; i < num_az_idx[p]; i++ ) - { - modelEval->BM_fx[add( qp, i )] = L_shl( Mpy_32_32( modelEval->elevBfVec_fx[p], modelEval->azimBfVec_fx[p][i] ), 1 ); /*Q30 - ( Q30 * 2 - 31 )*/ // Q30 - move32(); - BM_idx[add( qp, i )] = add( model->azim_start_idx[EvIdx[p]], AzIdx[p][i] ); - move16(); - } -#endif /* OPT_MASA_DEC_V1_NBE */ qp = add( qp, num_az_idx[p] ); } -#ifdef OPT_MASA_DEC_V1_NBE Word16 expL = add( model->AlphaL_e, 1 ); Word16 expR = add( model->AlphaR_e, 1 ); BMEnergiesL_e = add( model->EL_e, 2 ); BMEnergiesR_e = add( model->ER_e, 2 ); -#endif /* OPT_MASA_DEC_V1_NBE */ /* Compute HR filters, approximate optimized model evaluation */ FOR( iSec = 0; iSec < HRTF_MODEL_N_SECTIONS; iSec++ ) { -#ifndef OPT_MASA_DEC_V1_NBE - ETotL = 0; - move32(); - ETotR = 0; - move32(); - ESynL = 0; - move32(); - ESynR = 0; - move32(); - ETotL_e = 0; - move16(); - ETotR_e = 0; - move16(); - ESynR_e = 0; - move16(); - ESynL_e = 0; - move16(); - - BMEnergiesL_e = add( model->EL_e, 2 ); - BMEnergiesR_e = add( model->ER_e, 2 ); - -#else /* OPT_MASA_DEC_V1_NBE */ Word64 temp1 = 0; move64(); Word64 temp2 = 0; move64(); -#endif /* OPT_MASA_DEC_V1_NBE */ /* Energy is precalculated part updated with square of BM value. Store index for sorting */ FOR( i = 0; i < qp; i++ ) { -#ifdef OPT_MASA_DEC_V1_NBE modelEval->BMEnergiesL[i].val_fx = Mpy_32_32( Mpy_32_32( modelEval->BM_fx[i], modelEval->BM_fx[i] ) /*Q29*/, model->EL_fx[( iSec * model->AlphaN ) + BM_idx[i]] ); // exp: model->EL_e + 2 modelEval->BMEnergiesR[i].val_fx = Mpy_32_32( Mpy_32_32( modelEval->BM_fx[i], modelEval->BM_fx[i] ) /*Q29*/, model->ER_fx[( iSec * model->AlphaN ) + BM_idx[i]] ); // exp: model->ER_e + 2 -#else /* OPT_MASA_DEC_V1_NBE */ - modelEval->BMEnergiesL[i].val_fx = Mpy_32_32( Mpy_32_32( modelEval->BM_fx[i], modelEval->BM_fx[i] ) /*Q29*/, model->EL_fx[add( i_mult( iSec, model->AlphaN ), BM_idx[i] )] ); // exp: model->EL_e + 2 - modelEval->BMEnergiesR[i].val_fx = Mpy_32_32( Mpy_32_32( modelEval->BM_fx[i], modelEval->BM_fx[i] ) /*Q29*/, model->ER_fx[add( i_mult( iSec, model->AlphaN ), BM_idx[i] )] ); // exp: model->ER_e + 2 -#endif /* OPT_MASA_DEC_V1_NBE */ move32(); move32(); modelEval->BMEnergiesL[i].i = i; move16(); modelEval->BMEnergiesR[i].i = i; move16(); -#ifndef OPT_MASA_DEC_V1_NBE - ETotL = BASOP_Util_Add_Mant32Exp( ETotL, ETotL_e, modelEval->BMEnergiesL[i].val_fx, BMEnergiesL_e, &ETotL_e ); - ETotR = BASOP_Util_Add_Mant32Exp( ETotR, ETotR_e, modelEval->BMEnergiesR[i].val_fx, BMEnergiesR_e, &ETotR_e ); -#else /* OPT_MASA_DEC_V1_NBE */ temp1 = W_add( temp1, modelEval->BMEnergiesL[i].val_fx ); // BMEnergiesL_e temp2 = W_add( temp2, modelEval->BMEnergiesR[i].val_fx ); // BMEnergiesR_e -#endif /* OPT_MASA_DEC_V1_NBE */ } -#ifdef OPT_MASA_DEC_V1_NBE ETotL_e = W_norm( temp1 ); ETotL_e = sub( ETotL_e, 32 ); ETotL = W_shl_sat_l( temp1, ETotL_e ); @@ -346,21 +300,12 @@ static void GenerateFilter_fx( ETotR_e = sub( ETotR_e, 32 ); ETotR = W_shl_sat_l( temp2, ETotR_e ); ETotR_e = sub( BMEnergiesR_e, ETotR_e ); -#endif /* OPT_MASA_DEC_V1_NBE */ /* Number of basis components actually used. */ p = s_min( HRTF_MODEL_N_CPTS_VAR[iSec], qp ); SkipSmallest_ValueIndex_fx( modelEval->UseIndsL, modelEval->BMEnergiesL, qp, sub( qp, p ) ); SkipSmallest_ValueIndex_fx( modelEval->UseIndsR, modelEval->BMEnergiesR, qp, sub( qp, p ) ); -#ifndef OPT_MASA_DEC_V1_NBE - /* Account for lost energy */ - FOR( i = 0; i < p; i++ ) - { - ESynL = BASOP_Util_Add_Mant32Exp( ESynL, ESynL_e, modelEval->BMEnergiesL[modelEval->UseIndsL[i]].val_fx, BMEnergiesL_e, &ESynL_e ); - ESynR = BASOP_Util_Add_Mant32Exp( ESynR, ESynR_e, modelEval->BMEnergiesR[modelEval->UseIndsR[i]].val_fx, BMEnergiesR_e, &ESynR_e ); - } -#else /* OPT_MASA_DEC_V1_NBE */ temp1 = 0; move64(); temp2 = 0; @@ -382,49 +327,20 @@ static void GenerateFilter_fx( ESynR = W_shl_sat_l( temp2, ESynR_e ); ESynR_e = sub( BMEnergiesR_e, ESynR_e ); -#endif /* OPT_MASA_DEC_V1_NBE */ tmp32 = L_deposit_h( BASOP_Util_Divide3232_Scale( ETotL, ESynL, &ScaleL_e ) ); ScaleL_e = add( ScaleL_e, sub( ETotL_e, ESynL_e ) ); ScaleL = Sqrt32( tmp32, &ScaleL_e ); -#ifdef OPT_MASA_DEC_V1_NBE ScaleL_e = sub( ScaleL_e, 1 ); -#endif /* OPT_MASA_DEC_V1_NBE */ tmp32 = L_deposit_h( BASOP_Util_Divide3232_Scale( ETotR, ESynR, &ScaleR_e ) ); ScaleR_e = add( ScaleR_e, sub( ETotR_e, ESynR_e ) ); ScaleR = Sqrt32( tmp32, &ScaleR_e ); -#ifdef OPT_MASA_DEC_V1_NBE ScaleR_e = sub( ScaleR_e, 1 ); -#endif /* OPT_MASA_DEC_V1_NBE */ /* Build using only the most energetic components. */ FOR( k = model->iSecFirst[iSec]; k <= model->iSecLast[iSec]; k++ ) { -#ifndef OPT_MASA_DEC_V1_NBE - modelEval->hrfModL_fx[k] = 0; - move32(); - modelEval->hrfModR_fx[k] = 0; - move32(); - - tmp_hrfModL_e = 0; - move16(); - tmp_hrfModR_e = 0; - move16(); - - Word32 index; - FOR( i = 0; i < p; i++ ) - { - index = L_add( BM_idx[modelEval->BMEnergiesL[modelEval->UseIndsL[i]].i], imult3216( model->AlphaN, k ) ); - tmp32 = Mpy_32_32( modelEval->BM_fx[modelEval->BMEnergiesL[modelEval->UseIndsL[i]].i], model->AlphaL_fx[index] ); - modelEval->hrfModL_fx[k] = BASOP_Util_Add_Mant32Exp( modelEval->hrfModL_fx[k], tmp_hrfModL_e, tmp32, add( model->AlphaL_e, 1 ), &tmp_hrfModL_e ); - move32(); - index = L_add( BM_idx[modelEval->BMEnergiesR[modelEval->UseIndsR[i]].i], imult3216( model->AlphaN, k ) ); - tmp32 = Mpy_32_32( modelEval->BM_fx[modelEval->BMEnergiesR[modelEval->UseIndsR[i]].i], model->AlphaR_fx[index] ); - modelEval->hrfModR_fx[k] = BASOP_Util_Add_Mant32Exp( modelEval->hrfModR_fx[k], tmp_hrfModR_e, tmp32, add( model->AlphaR_e, 1 ), &tmp_hrfModR_e ); - move32(); - } -#else /* OPT_MASA_DEC_V1_NBE */ temp1 = 0; move64(); temp2 = 0; @@ -459,7 +375,6 @@ static void GenerateFilter_fx( move16(); } -#endif /* OPT_MASA_DEC_V1_NBE */ /* Account for lost energy */ modelEval->hrfModL_fx[k] = Mpy_32_32( modelEval->hrfModL_fx[k], ScaleL ); move32(); @@ -467,13 +382,8 @@ static void GenerateFilter_fx( move32(); /* NOTE: Assuming that finally, hrfMod values will be <= 1. Hence making it Q30 */ -#ifdef OPT_MASA_DEC_V1_NBE modelEval->hrfModL_fx[k] = L_shl( modelEval->hrfModL_fx[k], add( tmp_hrfModL_e, ScaleL_e ) ); // assuming Q30 modelEval->hrfModR_fx[k] = L_shl( modelEval->hrfModR_fx[k], add( tmp_hrfModR_e, ScaleR_e ) ); // assuming Q30 -#else /* OPT_MASA_DEC_V1_NBE */ - modelEval->hrfModL_fx[k] = L_shl( modelEval->hrfModL_fx[k], sub( add( tmp_hrfModL_e, ScaleL_e ), 1 ) ); // assuming Q30 - modelEval->hrfModR_fx[k] = L_shl( modelEval->hrfModR_fx[k], sub( add( tmp_hrfModR_e, ScaleR_e ), 1 ) ); // assuming Q30 -#endif /* OPT_MASA_DEC_V1_NBE */ // move32(); move32(); } @@ -604,18 +514,12 @@ static void GenerateITD_fx( } ELSE { -#ifdef OPT_MASA_DEC_V2_NBE Word16 temp_e = add( imult1616( EvIdx[p], model->azimDim3 ), elev_offset ); -#endif /* OPT_MASA_DEC_V2_NBE */ FOR( i = 0; i < num_az_idx; i++ ) { modelEval->BM_ITD_fx[qp + i] = L_shl( Mpy_32_32( modelEval->elevBfVecITD_fx[p], modelEval->azimBfVecITD_fx[i] ), 1 ); // Q30 move32(); -#ifdef OPT_MASA_DEC_V2_NBE BM_idx[qp + i] = add( temp_e, AzIdx[i] ); -#else /* OPT_MASA_DEC_V2_NBE */ - BM_idx[qp + i] = add( add( imult1616( EvIdx[p], model->azimDim3 ), elev_offset ), AzIdx[i] ); -#endif /* OPT_MASA_DEC_V2_NBE */ move16(); } qp = add( qp, num_az_idx ); @@ -630,35 +534,19 @@ static void GenerateITD_fx( } /* Matrix multiplcation (row x column) */ -#ifndef OPT_MASA_DEC_V2_NBE - modelEval->itdMod_fx = 0; - move16(); - itdMod_e = 0; - move16(); -#else /* OPT_MASA_DEC_V2_NBE */ Word64 temp = 0; move64(); Word16 res_e = add( model->W_e, 1 ); -#endif /* OPT_MASA_DEC_V2_NBE */ FOR( i = 0; i < qp; i++ ) { index = BM_idx[i]; move32(); -#ifndef OPT_MASA_DEC_V2_NBE - Word16 tmp_e; - modelEval->itdMod_fx = BASOP_Util_Add_Mant32Exp( modelEval->itdMod_fx, itdMod_e, Mpy_32_32( modelEval->BM_ITD_fx[i], model->W_fx[index] ), add( model->W_e, 1 ), &tmp_e ); - itdMod_e = tmp_e; - move16(); -#else /* OPT_MASA_DEC_V2_NBE */ temp = W_add( temp, Mpy_32_32( modelEval->BM_ITD_fx[i], model->W_fx[index] ) ); -#endif /* OPT_MASA_DEC_V2_NBE */ } -#ifdef OPT_MASA_DEC_V2_NBE itdMod_e = W_norm( temp ); itdMod_e = sub( itdMod_e, 32 ); modelEval->itdMod_fx = W_shl_sat_l( temp, itdMod_e ); itdMod_e = sub( res_e, itdMod_e ); -#endif /* OPT_MASA_DEC_V2_NBE */ Word32 tmp32 = Mpy_32_16_1( modelEval->itdMod_fx, model->resamp_factor_fx ); // Q = 31 - ( itdMod_e + 1 ) Word16 tmp_q = sub( 30, itdMod_e ); diff --git a/lib_rend/ivas_objectRenderer_sfx_fx.c b/lib_rend/ivas_objectRenderer_sfx_fx.c index 5f6ee03a7..8967b89a2 100644 --- a/lib_rend/ivas_objectRenderer_sfx_fx.c +++ b/lib_rend/ivas_objectRenderer_sfx_fx.c @@ -191,9 +191,7 @@ static void sincResample_fx( Word16 t_step_e; Word32 t_frac_fx; Word16 t_frac_e; -#ifdef OPT_MASA_DEC_V2_NBE Word64 t_frac_fx_acc; -#endif /* OPT_MASA_DEC_V2_NBE */ Word64 tmp64_fx; // Qx + 32 const Word32 *p_mid_fx; const Word32 *p_forward_fx; @@ -215,10 +213,8 @@ static void sincResample_fx( /* Compute fractional time step */ t_step_fx = L_deposit_h( BASOP_Util_Divide1616_Scale( length_in, length_out, &t_step_e ) ); // exp(t_step_e) -#ifdef OPT_MASA_DEC_V2_NBE t_frac_fx_acc = 0; move64(); -#endif /* OPT_MASA_DEC_V2_NBE */ t_frac_fx = 0; move32(); t_frac_e = 0; @@ -232,20 +228,12 @@ static void sincResample_fx( /* Calculate the sinc-index for the center value of the sinc */ Word16 center_val_e; -#ifndef OPT_MASA_DEC_V2_NBE - Word32 center_val; - center_val = BASOP_Util_Add_Mant32Exp( t_frac_plus_eps, t_frac_plus_eps_e, L_negate( L_deposit_h( t ) ), 15, ¢er_val_e ); // exp(center_val_e) - center_val_e = add( center_val_e, 6 ); // center_val * SFX_SPAT_BIN_NUM_SUBSAMPLES (i.e. 64) - center_val = BASOP_Util_Add_Mant32Exp( center_val, center_val_e, ONE_IN_Q29, 1, ¢er_val_e ); // exp(center_val_e) - snc0 = extract_l( L_shr( center_val, sub( 31, center_val_e ) ) ); // Q0 -#else /* OPT_MASA_DEC_V2_NBE */ Word64 center_val; center_val = W_sub( t_frac_plus_eps, W_shl( t, sub( 31, t_frac_plus_eps_e ) ) ); // exp(center_val_e) center_val_e = add( t_frac_plus_eps_e, 6 ); Word16 com_e = s_max( 0, center_val_e ); center_val = W_add( W_shr( center_val, sub( com_e, center_val_e ) ), W_shl( 1, sub( 30, com_e ) ) ); // exp(center_val_e) snc0 = extract_l( W_shl_sat_l( center_val, sub( com_e, 31 ) ) ); -#endif /* OPT_MASA_DEC_V2_NBE */ /* Run convolution forward and backward from mid point */ p_mid_fx = input_fx + t; // Qx p_forward_fx = p_mid_fx + 1; // Qx @@ -270,16 +258,12 @@ static void sincResample_fx( move32(); /* Advance fractional time */ -#ifndef OPT_MASA_DEC_V2_NBE - t_frac_fx = BASOP_Util_Add_Mant32Exp( t_frac_fx, t_frac_e, t_step_fx, t_step_e, &t_frac_e ); // exp( t_frac_fx ) -#else /* OPT_MASA_DEC_V2_NBE */ t_frac_fx_acc = W_add( t_frac_fx_acc, t_step_fx ); // t_step_e Word16 hdrm = W_norm( t_frac_fx_acc ); hdrm = sub( hdrm, 32 ); t_frac_fx = W_shl_sat_l( t_frac_fx_acc, hdrm ); t_frac_e = sub( t_step_e, hdrm ); move16(); -#endif /* OPT_MASA_DEC_V2_NBE */ } return; @@ -316,9 +300,7 @@ void TDREND_firfilt_fx( Word32 step_fx /* Q31 */, gain_tmp_fx /* Q31 */, gain_delta_fx /* Q30 */; Word16 tmp_e; Word64 tmp64_fx; -#ifdef OPT_MASA_DEC_V1_NBE Word16 shift = sub( filter_e, 32 ); -#endif /* OPT_MASA_DEC_V1_NBE */ gain_delta_fx = L_sub( Gain_fx, prevGain_fx ); // Q30 step_fx = L_deposit_h( BASOP_Util_Divide3232_Scale( gain_delta_fx, subframe_length, &tmp_e ) ); // exp(tmp_e) tmp_e = sub( tmp_e, Q30 ); @@ -332,18 +314,10 @@ void TDREND_firfilt_fx( Copy32( signal_fx + add( sub( subframe_length, filterlength ), 1 ), mem_fx, sub( filterlength, 1 ) ); /* Update memory for next frame */ // Qx /* Convolution */ -#ifdef OPT_MASA_DEC_V1_NBE FOR( i = 0; i < intp_count; i++ ) -#else /* OPT_MASA_DEC_V1_NBE */ - FOR( i = 0; i < subframe_length; i++ ) -#endif /* OPT_MASA_DEC_V1_NBE */ { tmp64_fx = 0; move64(); -#ifndef OPT_MASA_DEC_V1_NBE - tmp_e = 0; - move16(); -#endif /* OPT_MASA_DEC_V1_NBE */ p_tmp_fx = p_signal_fx + i; // Qx p_filter_fx = filter_fx; // exp(filter_e) @@ -356,24 +330,12 @@ void TDREND_firfilt_fx( } // This is done to keep the output Q same as input Q for signal -#ifdef OPT_MASA_DEC_V1_NBE tmp_fx = W_shl_sat_l( tmp64_fx, shift ); // Qx -#else /* OPT_MASA_DEC_V1_NBE */ - tmp64_fx = W_shl( tmp64_fx, filter_e ); // Qx + 32 - tmp_fx = W_extract_h( tmp64_fx ); // Qx -#endif /* OPT_MASA_DEC_V1_NBE */ /* Apply linear gain interpolation in case of abrupt gain changes */ gain_tmp_fx = L_add_sat( gain_tmp_fx, step_fx ); /* Saturating values which just exceeds 1, Q31*/ signal_fx[i] = Mpy_32_32( tmp_fx, gain_tmp_fx ); // Qx move32(); -#ifndef OPT_MASA_DEC_V1_NBE - IF( LT_16( i, intp_count ) ) - { - v_add_fx( filter_fx, filter_delta_fx, filter_fx, filterlength ); // exp(filter_e) - } - } -#else /* OPT_MASA_DEC_V1_NBE */ v_add_fx( filter_fx, filter_delta_fx, filter_fx, filterlength ); // exp(filter_e) } FOR( ; i < subframe_length; i++ ) @@ -399,7 +361,6 @@ void TDREND_firfilt_fx( signal_fx[i] = Mpy_32_32( tmp_fx, gain_tmp_fx ); // Qx move32(); } -#endif /* OPT_MASA_DEC_V1_NBE */ return; } -- GitLab From 687b12f88faf42460e8fa3d6fc6cff14fafc4da4 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:44:27 +0200 Subject: [PATCH 07/35] [cleanup] accept OPT_MCT_ENC_48KB_NBE --- lib_com/options.h | 1 - lib_enc/ivas_mcmasa_enc_fx.c | 44 ------------------------------------ 2 files changed, 45 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2acf7e8e5..3c3e8e5a7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,7 +77,6 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE #define OPT_BIN_REND_V2_NBE -#define OPT_MCT_ENC_48KB_NBE #define OPT_MCH_DEC_V1_BE #define OPT_MCT_ENC_V2_NBE #define OPT_SBA_DEC_V2_NBE diff --git a/lib_enc/ivas_mcmasa_enc_fx.c b/lib_enc/ivas_mcmasa_enc_fx.c index b24623003..c9b64866e 100644 --- a/lib_enc/ivas_mcmasa_enc_fx.c +++ b/lib_enc/ivas_mcmasa_enc_fx.c @@ -1942,14 +1942,12 @@ static void ivas_mcmasa_dmx_fx( Word32 alpha_fx, L_tmp, L_tmp1; Word16 multiChEne_e, scale, downmixEne_e = 0, prevEQ_e, tmp, currEQ_e, instEQ_e; move16(); -#ifdef OPT_MCT_ENC_48KB_NBE Word16 max_exp, tmp_exp, separateChannelFlag; Word64 tmp_64; Word64 multiChEne_64_fx = 0; Word64 downmixEne_64_fx = 0; move64(); move64(); -#endif numAnalysisChannels = sub( nchan_inp, 1 ); if ( hMcMasa->separateChannelEnabled ) @@ -1965,25 +1963,14 @@ static void ivas_mcmasa_dmx_fx( { FOR( i = 0; i < input_frame; i++ ) { -#ifdef OPT_MCT_ENC_48KB_NBE multiChEne_64_fx = W_mac_32_32( multiChEne_64_fx, data_fx[j][i], data_fx[j][i] ); // exp: 2*data_e -#else - L_tmp1 = BASOP_Util_Add_Mant32Exp( data_fx[j][i], data_e, 0, 0, &scale ); - L_tmp = Mpy_32_32( L_tmp1, L_tmp1 ); // data_e + data_e - multiChEne_fx = BASOP_Util_Add_Mant32Exp( L_tmp, scale + scale, multiChEne_fx, multiChEne_e, &scale ); - multiChEne_e = scale; - move16(); -#endif } } -#ifdef OPT_MCT_ENC_48KB_NBE tmp = shl( data_e, 1 ); -#endif IF( EQ_16( nchan_transport, 2 ) ) { Word16 numSideChannels; /* Channels other than left, right, center */ Word16 leftIndex, rightIndex; -#ifdef OPT_MCT_ENC_48KB_NBE Word16 tmp_16; separateChannelFlag = 1; @@ -1993,28 +1980,14 @@ static void ivas_mcmasa_dmx_fx( separateChannelFlag = 0; move16(); } -#endif numSideChannels = sub( shr( numAnalysisChannels, 1 ), 1 ); FOR( j = 0; j < numSideChannels; j++ ) { -#ifdef OPT_MCT_ENC_48KB_NBE tmp_16 = add( shl( j, 1 ), 2 ); leftIndex = add( tmp_16, separateChannelFlag ); rightIndex = add( add( tmp_16, 1 ), separateChannelFlag ); -#else - IF( hMcMasa->separateChannelEnabled ) - { - leftIndex = add( shl( j, 1 ), 2 ); - rightIndex = add( shl( j, 1 ), 3 ); - } - ELSE - { - leftIndex = add( shl( j, 1 ), 3 ); - rightIndex = add( shl( j, 1 ), 4 ); - } -#endif FOR( i = 0; i < input_frame; i++ ) { data_fx[0][i] = L_add( data_fx[0][i], data_fx[leftIndex][i] ); // data_e @@ -2054,20 +2027,13 @@ static void ivas_mcmasa_dmx_fx( { FOR( i = 0; i < input_frame; i++ ) { -#ifdef OPT_MCT_ENC_48KB_NBE downmixEne_64_fx = W_mac_32_32( downmixEne_64_fx, data_fx[j][i], data_fx[j][i] ); // exp: 2*data_e -#else - L_tmp1 = BASOP_Util_Add_Mant32Exp( data_fx[j][i], data_e, 0, 0, &scale ); - L_tmp = Mpy_32_32( L_tmp1, L_tmp1 ); // data_e + data_e - downmixEne_fx = BASOP_Util_Add_Mant32Exp( L_tmp, scale + scale, downmixEne_fx, downmixEne_e, &downmixEne_e ); -#endif } } alpha_fx = 214748364; // 0.1 in Q31 move32(); -#ifdef OPT_MCT_ENC_48KB_NBE scale = W_norm( multiChEne_64_fx ); multiChEne_fx = W_extract_h( W_shl( multiChEne_64_fx, scale ) ); multiChEne_e = sub( tmp, scale ); @@ -2075,7 +2041,6 @@ static void ivas_mcmasa_dmx_fx( scale = W_norm( downmixEne_64_fx ); downmixEne_fx = W_extract_h( W_shl( downmixEne_64_fx, scale ) ); downmixEne_e = sub( tmp, scale ); -#endif L_tmp = Mpy_32_32( alpha_fx, multiChEne_fx ); L_tmp1 = Mpy_32_32( 1932735284 /* 0.9f in Q31 */, hMcMasa->prevMultiChEne_fx ); hMcMasa->prevMultiChEne_fx = BASOP_Util_Add_Mant32Exp( L_tmp, multiChEne_e, L_tmp1, hMcMasa->prevMultiChEne_e, &hMcMasa->prevMultiChEne_e ); @@ -2100,26 +2065,17 @@ static void ivas_mcmasa_dmx_fx( hMcMasa->prevEQ_e = currEQ_e; move16(); -#ifdef OPT_MCT_ENC_48KB_NBE max_exp = s_max( prevEQ_e, currEQ_e ); prevEQ_fx = L_shl( prevEQ_fx, sub( prevEQ_e, max_exp ) ); // exp:max_exp currEQ_fx = L_shl( currEQ_fx, sub( currEQ_e, max_exp ) ); // exp:max_exp tmp_exp = add( max_exp, 16 ); -#endif FOR( i = 0; i < input_frame; i++ ) { -#ifdef OPT_MCT_ENC_48KB_NBE tmp_64 = W_mac_32_32( W_mult_32_16( currEQ_fx, hMcMasa->interpolator_fx[i] ), prevEQ_fx, L_sub( ONE_IN_Q15, hMcMasa->interpolator_fx[i] ) ); // exp:max_exp +16 scale = W_norm( tmp_64 ); instEQ_fx = W_extract_h( W_shl( tmp_64, scale ) ); instEQ_e = sub( tmp_exp, scale ); -#else - L_tmp = Mpy_32_32( L_deposit_h( hMcMasa->interpolator_fx[i] ), currEQ_fx ); - L_tmp1 = L_sub( 1073741824 /* 1 in Q30 */, L_lshr( L_deposit_h( hMcMasa->interpolator_fx[i] ), 1 ) ); - L_tmp1 = Mpy_32_32( L_tmp1, prevEQ_fx ); - instEQ_fx = BASOP_Util_Add_Mant32Exp( L_tmp, currEQ_e, L_tmp1, add( prevEQ_e, 1 ), &instEQ_e ); -#endif FOR( j = 0; j < nchan_transport; j++ ) { -- GitLab From 22230e4ebc3b239902f90db62edf626b0adc005e Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:45:21 +0200 Subject: [PATCH 08/35] [cleanup] accept OPT_MCH_DEC_V1_BE --- lib_com/options.h | 1 - lib_dec/ivas_dirac_output_synthesis_cov_fx.c | 34 ----------- lib_dec/ivas_svd_dec_fx.c | 12 ---- lib_rend/ivas_dirac_decorr_dec_fx.c | 63 -------------------- 4 files changed, 110 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 3c3e8e5a7..3d616d490 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,7 +77,6 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE #define OPT_BIN_REND_V2_NBE -#define OPT_MCH_DEC_V1_BE #define OPT_MCT_ENC_V2_NBE #define OPT_SBA_DEC_V2_NBE #define OPT_MCT_ENC_V1_NBE diff --git a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c index 0996a9700..819d59d41 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c @@ -897,12 +897,7 @@ Word16 computeMixingMatrices_fx( limit_e = add( limit_e, reg_Sx_e ); -#ifdef OPT_MCH_DEC_V1_BE limit_fx = Madd_32_32( EPSILON_FX, limit_fx, reg_Sx_fx ); -#else /* OPT_MCH_DEC_V1_BE */ - L_tmp = Mpy_32_32( limit_fx, reg_Sx_fx ); - limit_fx = L_add( L_tmp, EPSILON_FX ); -#endif /* OPT_MCH_DEC_V1_BE */ FOR( i = 0; i < lengthCx; ++i ) { @@ -962,12 +957,7 @@ Word16 computeMixingMatrices_fx( move16(); } } -#ifdef OPT_MCH_DEC_V1_BE limit_fx = Madd_32_32( EPSILON_FX, limit_fx, reg_ghat_fx ); // limit_e+ reg_ghat_e -#else /* OPT_MCH_DEC_V1_BE */ - L_tmp = Mpy_32_32( limit_fx, reg_ghat_fx ); // limit_e+ reg_ghat_e - limit_fx = L_add( L_tmp, EPSILON_FX ); -#endif /* OPT_MCH_DEC_V1_BE */ limit_e = add( limit_e, reg_ghat_e ); com_e = sub( Cy_hat_diag_e, limit_e ); @@ -1449,12 +1439,7 @@ Word16 computeMixingMatricesResidual_fx( } } -#ifdef OPT_MCH_DEC_V1_BE limit_fx = Madd_32_32( EPSILON_FX, limit_fx, reg_ghat_fx ); // Q(limit_e+reg_ghat_e) -#else /* OPT_MCH_DEC_V1_BE */ - L_tmp = Mpy_32_32( limit_fx, reg_ghat_fx ); // Q(limit_e+reg_ghat_e) - limit_fx = L_add( L_tmp, EPSILON_FX ); -#endif /* OPT_MCH_DEC_V1_BE */ limit_e = add( limit_e, reg_ghat_e ); /* Computing G_hat */ @@ -1487,12 +1472,7 @@ Word16 computeMixingMatricesResidual_fx( FOR( i = 0; i < num_outputs; i++ ) { -#ifdef OPT_MCH_DEC_V1_BE Kx_fx[i] = Mpy_32_32( Kx_fx[i], G_hat_fx[i] ); // Q(31-(Kx_fx_e+G_hag_e)) -#else /* OPT_MCH_DEC_V1_BE */ - L_tmp = Mpy_32_32( Kx_fx[i], G_hat_fx[i] ); // Q(31-(Kx_fx_e+G_hag_e)) - Kx_fx[i] = L_tmp; -#endif /* OPT_MCH_DEC_V1_BE */ move32(); Kx_fx_e[i] = add( Kx_fx_e[i], G_hat_e[i] ); move16(); @@ -1506,18 +1486,10 @@ Word16 computeMixingMatricesResidual_fx( FOR( j = 0; j < num_outputs; j++ ) { -#ifdef OPT_MCH_DEC_V1_BE mat_mult_buffer1_fx[i + j * num_outputs] = Mpy_32_32( Ky_fx[i + j * num_outputs], fac_fx ); // Q(31-(Ky_fx_e+Kx_fx_e)); move32(); mat_mult_buffer1_buff_e[i + j * num_outputs] = add( Ky_fx_e[i + j * num_outputs], Kx_fx_e[i] ); move16(); -#else /* OPT_MCH_DEC_V1_BE */ - L_tmp = Mpy_32_32( Ky_fx[i + j * num_outputs], fac_fx ); // Q(31-(Ky_fx_e+Kx_fx_e)) - mat_mult_buffer1_fx[i + j * num_outputs] = L_tmp; - move32(); - mat_mult_buffer1_buff_e[i + j * num_outputs] = extract_l( L_add( Ky_fx_e[i + j * num_outputs], Kx_fx_e[i] ) ); - move16(); -#endif /* OPT_MCH_DEC_V1_BE */ } } @@ -1573,14 +1545,8 @@ Word16 computeMixingMatricesResidual_fx( FOR( j = 0; j < num_outputs; j++ ) { -#ifdef OPT_MCH_DEC_V1_BE mixing_matrix_fx[j + i * num_outputs] = Mpy_32_32( mat_mult_buffer1_fx[j + i * num_outputs], fac_fx ); // Q(31-mat_mult_buffer1_e+Kx_reg_inv_e); move32(); -#else /* OPT_MCH_DEC_V1_BE */ - L_tmp = Mpy_32_32( mat_mult_buffer1_fx[j + i * num_outputs], fac_fx ); // Q(31-mat_mult_buffer1_e+Kx_reg_inv_e) - mixing_matrix_fx[j + i * num_outputs] = L_tmp; - move32(); -#endif /* OPT_MCH_DEC_V1_BE */ mixing_matrix_fx_e[j + i * num_outputs] = add( mat_mult_buffer1_buff_e[j + i * num_outputs], Kx_reg_inv_e[i] ); move16(); } diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index 84fad45ba..c6867d550 100644 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -781,9 +781,7 @@ static void ApplyRotation_fx( move16(); } op_e = add( op_e, 1 ); // 64 bit mac -> +1 -#ifdef OPT_MCH_DEC_V1_BE op_e = negate( op_e ); -#endif /* OPT_MCH_DEC_V1_BE */ FOR( ch = 0; ch < nChannels; ch++ ) { @@ -793,21 +791,11 @@ static void ApplyRotation_fx( move32(); Word64 temp = W_mac_32_32( W_mult_32_32( op1, x11 ), op2, x12 ); // Q(singularVector) + op_e -#ifdef OPT_MCH_DEC_V1_BE singularVector[ch][currentIndex2] = W_shl_sat_l( temp, op_e ); // Q(singularVector) -#else /* OPT_MCH_DEC_V1_BE */ - temp = W_shr( temp, op_e ); // Q(singularVector) - singularVector[ch][currentIndex2] = W_sat_l( temp ); // Q(singularVector) -#endif /* OPT_MCH_DEC_V1_BE */ move32(); temp = W_mac_32_32( W_mult_32_32( op1, x12 ), L_negate( op2 ), x11 ); // Q(singularVector) + op_e -#ifdef OPT_MCH_DEC_V1_BE singularVector[ch][currentIndex1] = W_shl_sat_l( temp, op_e ); // Q(singularVector) -#else /* OPT_MCH_DEC_V1_BE */ - temp = W_shr( temp, op_e ); // Q(singularVector) - singularVector[ch][currentIndex1] = W_sat_l( temp ); // Q(singularVector) -#endif /* OPT_MCH_DEC_V1_BE */ move32(); } diff --git a/lib_rend/ivas_dirac_decorr_dec_fx.c b/lib_rend/ivas_dirac_decorr_dec_fx.c index f6c09d55b..bd1b4e35a 100644 --- a/lib_rend/ivas_dirac_decorr_dec_fx.c +++ b/lib_rend/ivas_dirac_decorr_dec_fx.c @@ -485,19 +485,11 @@ void ivas_dirac_dec_decorr_process_fx( set32_fx( aux_buffer_fx, 0, 2 * MAX_OUTPUT_CHANNELS * CLDFB_NO_CHANNELS_MAX ); FOR( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++ ) { -#ifdef OPT_MCH_DEC_V1_BE v_shr( &input_frame_fx[2 * ch_idx * num_freq_bands], negate( q_shift ), &aux_buffer_fx[2 * ch_idx * num_freq_bands], imult1616( 2, num_freq_bands ) ); // Q - q_shift -#else /* OPT_MCH_DEC_V1_BE */ - v_shr( &input_frame_fx[imult1616( 2, imult1616( ch_idx, num_freq_bands ) )], negate( q_shift ), &aux_buffer_fx[imult1616( 2, imult1616( ch_idx, num_freq_bands ) )], imult1616( 2, num_freq_bands ) ); // Q - q_shift -#endif /* OPT_MCH_DEC_V1_BE */ } FOR( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++ ) { -#ifdef OPT_MCH_DEC_V1_BE v_mult_fixed( &aux_buffer_fx[2 * ch_idx * num_freq_bands], &aux_buffer_fx[2 * ch_idx * num_freq_bands], &aux_buffer_fx[2 * ch_idx * max_band_decorr_temp], imult1616( 2, max_band_decorr_temp ) ); // q_aux_buffer -#else /* OPT_MCH_DEC_V1_BE */ - v_mult_fixed( &aux_buffer_fx[imult1616( 2, imult1616( ch_idx, num_freq_bands ) )], &aux_buffer_fx[imult1616( 2, imult1616( ch_idx, num_freq_bands ) )], &aux_buffer_fx[imult1616( 2, imult1616( ch_idx, max_band_decorr_temp ) )], imult1616( 2, max_band_decorr_temp ) ); // q_aux_buffer -#endif /* OPT_MCH_DEC_V1_BE */ } q_aux_buffer = sub( add( add( add( q_input_frame, q_input_frame ), q_shift ), q_shift ), 31 ); @@ -688,11 +680,7 @@ void ivas_dirac_dec_decorr_process_fx( move32(); move32(); } -#ifdef OPT_MCH_DEC_V1_BE decorr_buffer_ptr_fx = decorr_buffer_start_ptr_fx + ( pre_delay - 1 ) * decorr_buffer_step * 2; -#else /* OPT_MCH_DEC_V1_BE */ - decorr_buffer_ptr_fx = decorr_buffer_start_ptr_fx + shl( imult1616( ( sub( pre_delay, 1 ) ), decorr_buffer_step ), 1 ); -#endif /* OPT_MCH_DEC_V1_BE */ /*add MA part to state */ decorr_buffer_ptr_fx[0] = L_add( decorr_buffer_ptr_fx[0], frame_ma_fx[0] ); @@ -739,9 +727,6 @@ void ivas_dirac_dec_decorr_process_fx( Word16 e_reverb_energy_smooth, e_direct_energy_smooth; Word16 offset1; -#ifndef OPT_MCH_DEC_V1_BE - Word16 offset2; -#endif /* OPT_MCH_DEC_V1_BE */ Word16 norm = 63; move16(); e_reverb_energy_smooth = sub( 31, h_freq_domain_decorr_ap_state->q_reverb_energy_smooth ); @@ -750,7 +735,6 @@ void ivas_dirac_dec_decorr_process_fx( // scaling to get max precision for aux_buffer values// q_shift = Q31; move16(); -#ifdef OPT_MCH_DEC_V1_BE FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { q_shift = s_min( q_shift, @@ -760,18 +744,6 @@ void ivas_dirac_dec_decorr_process_fx( { scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], decorX2, q_shift ); } -#else /* OPT_MCH_DEC_V1_BE */ - offset = shl( max_band_decorr, 1 ); - FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) - { - q_shift = s_min( q_shift, - L_norm_arr( &frame_dec_fx[2 * ch_idx * num_freq_bands], offset ) ); - } - FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) - { - scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], offset, q_shift ); - } -#endif /* OPT_MCH_DEC_V1_BE */ q_frame_f = add( q_frame_f, q_shift ); @@ -803,18 +775,11 @@ void ivas_dirac_dec_decorr_process_fx( Word32 *m32_frame_dec_fx = frame_dec_fx; move32(); offset1 = shl( num_freq_bands, 1 ); -#ifndef OPT_MCH_DEC_V1_BE - offset2 = shl( max_band_decorr, 1 ); -#endif /* OPT_MCH_DEC_V1_BE */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { -#ifdef OPT_MCH_DEC_V1_BE FOR( Word16 i = 0; i < decorX2; i++ ) -#else /* OPT_MCH_DEC_V1_BE */ - FOR( Word16 i = 0; i < offset2; i++ ) -#endif /* OPT_MCH_DEC_V1_BE */ { m64_aux[i] = W_mult0_32_32( m32_frame_dec_fx[i], m32_frame_dec_fx[i] ); move64(); @@ -824,35 +789,19 @@ void ivas_dirac_dec_decorr_process_fx( move64(); } } -#ifdef OPT_MCH_DEC_V1_BE m64_aux += decorX2; -#else /* OPT_MCH_DEC_V1_BE */ - m64_aux += offset2; -#endif /* OPT_MCH_DEC_V1_BE */ m32_frame_dec_fx += offset1; move64(); move32(); } norm = W_norm( min64 ); -#ifdef OPT_MCH_DEC_V1_BE norm = sub( norm, 33 ); -#else /* OPT_MCH_DEC_V1_BE */ - norm = sub( norm, 1 /*find_guarded_bits_fx( 2 )*/ ); -#endif /* OPT_MCH_DEC_V1_BE */ FOR( Word16 i = 0; i < 2 * num_channels * max_band_decorr; i++ ) { -#ifdef OPT_MCH_DEC_V1_BE aux_buffer_fx[i] = W_shl_sat_l( aux_64[i], norm ); -#else /* OPT_MCH_DEC_V1_BE */ - aux_buffer_fx[i] = W_extract_h( W_shl( aux_64[i], norm ) ); -#endif /* OPT_MCH_DEC_V1_BE */ move32(); } -#ifdef OPT_MCH_DEC_V1_BE q_aux_buffer = add( shl( q_frame_f, 1 ), norm ); -#else /* OPT_MCH_DEC_V1_BE */ - q_aux_buffer = add( shl( q_frame_f, 1 ), sub( norm, 32 ) ); -#endif /* OPT_MCH_DEC_V1_BE */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) @@ -998,11 +947,7 @@ void ivas_dirac_dec_decorr_process_fx( Word16 sf = MAX_16; FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { -#ifdef OPT_MCH_DEC_V1_BE sf = s_min( sf, getScaleFactor32( &frame_dec_fx[2 * ch_idx * num_freq_bands], decorX2 ) ); -#else /* OPT_MCH_DEC_V1_BE */ - sf = s_min( sf, getScaleFactor32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ) ) ); -#endif /* OPT_MCH_DEC_V1_BE */ } sf = s_min( sub( sf, 1 ), q_shift ); q_if_local = sub( q_shift, sf ); @@ -1011,11 +956,7 @@ void ivas_dirac_dec_decorr_process_fx( // scaling it to sf FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { -#ifdef OPT_MCH_DEC_V1_BE scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], decorX2, q_shift ); -#else /* OPT_MCH_DEC_V1_BE */ - scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ), q_shift ); -#endif /* OPT_MCH_DEC_V1_BE */ } q_frame_f = add( q_frame_f, sf ); } @@ -1024,11 +965,7 @@ void ivas_dirac_dec_decorr_process_fx( // scaling it to input q FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { -#ifdef OPT_MCH_DEC_V1_BE scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], decorX2, q_shift ); -#else /* OPT_MCH_DEC_V1_BE */ - scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ), q_shift ); -#endif /* OPT_MCH_DEC_V1_BE */ } q_frame_f = q_input_frame; q_if_local = 0; -- GitLab From 652506a259df753f3a08c5751810d32604ff9464 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:46:16 +0200 Subject: [PATCH 09/35] [cleanup] accept OPT_MCT_ENC_V2_NBE --- lib_com/options.h | 1 - lib_enc/tcx_utils_enc_fx.c | 37 ------------------------------------- 2 files changed, 38 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 3d616d490..7acb52bef 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,7 +77,6 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE #define OPT_BIN_REND_V2_NBE -#define OPT_MCT_ENC_V2_NBE #define OPT_SBA_DEC_V2_NBE #define OPT_MCT_ENC_V1_NBE #define OPT_MCT_ENC_V1_BE diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index c42a8c755..0b94e74fa 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -1318,37 +1318,23 @@ void tcx_scalar_quantization_ivas_fx( { Word16 i, tmp16, s; Word32 tmp32, offs32; -#ifdef OPT_MCT_ENC_V2_NBE Word32 offs32_1; Word32 offset_Q16 = L_shl( offset, 1 ); // Q16 -#endif /* common exponent for x and gain for comparison */ tmp16 = sub( gain_e, x_e ); -#ifdef OPT_MCT_ENC_V2_NBE tmp32 = L_shl_sat( L_deposit_h( gain ), tmp16 ); // exp:x_e -#else - tmp32 = L_shl( L_deposit_h( gain ), s_max( -31, s_min( tmp16, 0 ) ) ); - tmp16 = negate( s_max( tmp16, 0 ) ); -#endif i = sub( L_frame, 1 ); IF( memQuantZeros_fx != NULL ) { test(); -#ifdef OPT_MCT_ENC_V2_NBE FOR( ; ( ( memQuantZeros_fx[i] != 0 ) && ( L_abs( x[i] ) < tmp32 ) ); i-- ) -#else - WHILE( ( memQuantZeros_fx[i] != 0 ) && ( LT_32( L_abs( L_shl( x[i], tmp16 ) ), tmp32 ) ) ) -#endif { test(); xq[i] = 0; move16(); -#ifndef OPT_MCT_ENC_V2_NBE - i = sub( i, 1 ); -#endif } } @@ -1371,7 +1357,6 @@ void tcx_scalar_quantization_ivas_fx( FOR( ; i >= 0; i-- ) { -#ifdef OPT_MCT_ENC_V2_NBE offs32 = Mpy_32_16_1( x[i], gain ); offs32 = L_shl_sat( offs32, s ); /* convert to 15Q16 */ @@ -1386,28 +1371,6 @@ void tcx_scalar_quantization_ivas_fx( tmp16 = add( tmp16, 1 ); } } -#else - offs32 = Mpy_32_16_1( x[i], gain ); /* multiply */ - offs32 = L_shl_sat( offs32, s ); /* convert to 15Q16 */ - IF( x[i] > 0 ) - { - offs32 = L_add_sat( offs32, L_shl( offset, 1 ) ); - tmp16 = extract_h( offs32 ); - IF( GT_32( L_deposit_h( tmp16 ), offs32 ) ) - { - tmp16 = sub( tmp16, 1 ); - } - } - ELSE - { - offs32 = L_add_sat( offs32, L_shl( negate( offset ), 1 ) ); - tmp16 = extract_h( offs32 ); - IF( LT_32( L_deposit_h( tmp16 ), offs32 ) ) - { - tmp16 = add( tmp16, 1 ); - } - } -#endif xq[i] = tmp16; move16(); } -- GitLab From 1c66fbfeaf5c47378c9a10f67d1b553e6fdf7986 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:47:03 +0200 Subject: [PATCH 10/35] [cleanup] accept OPT_SBA_DEC_V2_NBE --- lib_com/ivas_prot_fx.h | 12 --- lib_com/options.h | 1 - lib_com/prot_fx.h | 4 - lib_dec/dec_tcx_fx.c | 25 ----- lib_dec/ivas_dirac_output_synthesis_cov_fx.c | 13 --- lib_dec/ivas_mct_core_dec_fx.c | 37 -------- lib_dec/ivas_mct_dec_fx.c | 82 ----------------- lib_dec/ivas_mct_dec_mct_fx_fx.c | 29 ------ lib_dec/ivas_mdct_core_dec_fx.c | 97 -------------------- lib_dec/ivas_stereo_mdct_core_dec_fx.c | 79 ---------------- lib_dec/tonalMDCTconcealment_fx.c | 9 -- 11 files changed, 388 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 6486d68c3..2eaf573fd 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1606,11 +1606,7 @@ void ivas_mdct_core_tns_ns_fx( Word32 *x_fx[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */ Word32 Aq_fx[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* o : LP coefficients */ const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ -#ifdef OPT_SBA_DEC_V2_NBE Word16 x_e -#else /* OPT_SBA_DEC_V2_NBE */ - Word16 x_e[CPE_CHANNELS][NB_DIV] -#endif /* OPT_SBA_DEC_V2_NBE */ ); void decoder_tcx_imdct_fx( @@ -1977,17 +1973,9 @@ void ivas_mdct_core_invQ_fx( Word16 fUseTns[CPE_CHANNELS][NB_DIV], /* i : flag TNS enabled */ STnsData tnsData[CPE_CHANNELS][NB_DIV], /* i : TNS parameter */ Word32 *x_0[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ -#ifdef OPT_SBA_DEC_V2_NBE Word16 x_0_e, -#else /* OPT_SBA_DEC_V2_NBE */ - Word16 x_0_e[CPE_CHANNELS][NB_DIV], -#endif /* OPT_SBA_DEC_V2_NBE */ Word32 *x[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ -#ifdef OPT_SBA_DEC_V2_NBE Word16 x_e, -#else /* OPT_SBA_DEC_V2_NBE */ - Word16 x_e[CPE_CHANNELS][NB_DIV], -#endif /* OPT_SBA_DEC_V2_NBE */ Word16 x_len[CPE_CHANNELS][NB_DIV], Word16 Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* i : LP coefficients */ Word16 ms_mask[NB_DIV][MAX_SFB], /* i : M/S mask */ diff --git a/lib_com/options.h b/lib_com/options.h index 7acb52bef..17e9291cd 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,7 +77,6 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE #define OPT_BIN_REND_V2_NBE -#define OPT_SBA_DEC_V2_NBE #define OPT_MCT_ENC_V1_NBE #define OPT_MCT_ENC_V1_BE #define OPT_SBA_REND_V1_BE diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 12459249b..74a1017be 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -6412,11 +6412,7 @@ void TonalMDCTConceal_Apply( void TonalMDCTConceal_Apply_ivas_fx( TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ Word32 *mdctSpectrum, /*IN/OUT*/ -#ifdef OPT_SBA_DEC_V2_NBE Word16 mdctSpectrum_exp, /*IN */ -#else /* OPT_SBA_DEC_V2_NBE */ - Word16 mdctSpectrum_exp[L_FRAME48k], /*IN */ -#endif /* OPT_SBA_DEC_V2_NBE */ const PsychoacousticParameters *psychParamsCurrent ); void TonalMDCTConceal_InsertNoise_ivas_fx( diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 508112d0c..1e1ca2cb8 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -5496,34 +5496,9 @@ void decoder_tcx_noiseshaping_igf_fx( test(); IF( bfi && st->tonal_mdct_plc_active && NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { -#ifndef OPT_SBA_DEC_V2_NBE - Word16 tmp_x_fx_exp[L_FRAME48k], temp; - temp = -MAX_16; - move16(); - - set16_fx( tmp_x_fx_exp, *x_e, L_frameTCX ); - TonalMDCTConceal_Apply_ivas_fx( st->hTonalMDCTConc, x_fx, tmp_x_fx_exp, st->hTcxCfg->psychParamsCurrent ); -#else /* OPT_SBA_DEC_V2_NBE */ TonalMDCTConceal_Apply_ivas_fx( st->hTonalMDCTConc, x_fx, *x_e, st->hTcxCfg->psychParamsCurrent ); -#endif /* OPT_SBA_DEC_V2_NBE */ /* If exponent has been updated after TonalMDCTConceal_Apply, then shift the spectrum to common exponent. */ -#ifndef OPT_SBA_DEC_V2_NBE - FOR( i = 0; i < L_frameTCX; i++ ) - { - temp = s_max( temp, tmp_x_fx_exp[i] ); - } - - { - *x_e = temp; - move16(); - FOR( i = 0; i < L_frameTCX; i++ ) - { - x_fx[i] = L_shr( x_fx[i], sub( temp, tmp_x_fx_exp[i] ) ); - move32(); - } - } -#endif /* OPT_SBA_DEC_V2_NBE */ } test(); diff --git a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c index 819d59d41..6450d514d 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c @@ -591,15 +591,7 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( /* apply residual mixing */ { Word16 shifter; -#ifdef OPT_SBA_DEC_V2_NBE shifter = sub( mixing_matrix_res_smooth_e, 32 ); -#else /* OPT_SBA_DEC_V2_NBE */ -#ifdef OPT_SBA_DEC_V2_BE - shifter = sub( mixing_matrix_res_smooth_e, 31 ); -#else /* OPT_SBA_DEC_V2_BE */ - shifter = 31 - mixing_matrix_res_smooth_e; -#endif /* OPT_SBA_DEC_V2_NBE */ -#endif /* OPT_SBA_DEC_V2_BE */ FOR( ch_idx = 0; ch_idx < nY; ch_idx++ ) { int i; @@ -614,13 +606,8 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( move64(); for ( i = 0; i < nY; i++ ) { -#ifdef OPT_SBA_DEC_V2_NBE temp_real = W_mac_32_32( temp_real, mixing_matrix_res_smooth_fx[idx], diff_f_real_fx[i] ); temp_imag = W_mac_32_32( temp_imag, mixing_matrix_res_smooth_fx[idx], diff_f_imag_fx[i] ); -#else /* OPT_SBA_DEC_V2_NBE */ - temp_real = W_add( temp_real, W_mult0_32_32( mixing_matrix_res_smooth_fx[idx], diff_f_real_fx[i] ) ); - temp_imag = W_add( temp_imag, W_mult0_32_32( mixing_matrix_res_smooth_fx[idx], diff_f_imag_fx[i] ) ); -#endif /* OPT_SBA_DEC_V2_NBE */ idx += nY; } #ifdef OPT_SBA_DEC_V2_BE diff --git a/lib_dec/ivas_mct_core_dec_fx.c b/lib_dec/ivas_mct_core_dec_fx.c index bc2471e24..1222eccf1 100644 --- a/lib_dec/ivas_mct_core_dec_fx.c +++ b/lib_dec/ivas_mct_core_dec_fx.c @@ -256,11 +256,7 @@ void ivas_mct_core_dec( move16(); x_fx[ch][0] = signal_out_fx[ch]; x_fx[ch][1] = signal_out_fx[ch] + ( L_FRAME48k / 2 ); -#ifdef OPT_SBA_DEC_V2_NBE q_x[ch] = Q11; -#else /* OPT_SBA_DEC_V2_NBE */ - q_x[ch] = Q12; -#endif /* OPT_SBA_DEC_V2_NBE */ move16(); } @@ -300,22 +296,14 @@ void ivas_mct_core_dec( /* mono or dual mono IGF decoding */ x_e = sub( 31, q_x[ch] ); decoder_tcx_IGF_mono_fx( st, x_fx[ch][k], &x_e, &x_len, L_frame, left_rect, bfi, k ); -#ifdef OPT_SBA_DEC_V2_NBE q_x[ch] = sub( 31 - 11, x_e ); // Shift to bring x to Q12 -#else /* OPT_SBA_DEC_V2_NBE */ - q_x[ch] = sub( 31 - 12, x_e ); // Shift to bring x to Q12 -#endif /* OPT_SBA_DEC_V2_NBE */ move16(); FOR( i = 0; i < x_len; i++ ) { x_fx[ch][k][i] = L_shr( x_fx[ch][k][i], q_x[ch] ); move32(); } -#ifdef OPT_SBA_DEC_V2_NBE q_x[ch] = Q11; -#else /* OPT_SBA_DEC_V2_NBE */ - q_x[ch] = Q12; -#endif /* OPT_SBA_DEC_V2_NBE */ move16(); } } @@ -333,22 +321,14 @@ void ivas_mct_core_dec( /* mono or dual mono IGF decoding */ x_e = sub( 31, q_x[ch] ); decoder_tcx_IGF_mono_fx( st, x_fx[ch][0], &x_e, &x_len, L_frame, left_rect, bfi, 0 ); -#ifdef OPT_SBA_DEC_V2_NBE q_x[ch] = sub( 31 - 11, x_e ); // Shift to bring x to Q12 -#else /* OPT_SBA_DEC_V2_NBE */ - q_x[ch] = sub( 31 - 12, x_e ); // Shift to bring x to Q12 -#endif /* OPT_SBA_DEC_V2_NBE */ move16(); FOR( i = 0; i < x_len; i++ ) { x_fx[ch][0][i] = L_shr( x_fx[ch][0][i], q_x[ch] ); move32(); } -#ifdef OPT_SBA_DEC_V2_NBE q_x[ch] = Q11; -#else /* OPT_SBA_DEC_V2_NBE */ - q_x[ch] = Q12; -#endif /* OPT_SBA_DEC_V2_NBE */ move16(); } } @@ -382,18 +362,10 @@ void ivas_mct_core_dec( move16(); FOR( i = 0; i < x_len; i++ ) { -#ifdef OPT_SBA_DEC_V2_NBE x_fx[ch][k][i] = L_shr( x_fx[ch][k][i], sub( q_x[ch], Q11 ) ); -#else /* OPT_SBA_DEC_V2_NBE */ - x_fx[ch][k][i] = L_shr( x_fx[ch][k][i], sub( q_x[ch], Q12 ) ); -#endif /* OPT_SBA_DEC_V2_NBE */ move32(); } -#ifdef OPT_SBA_DEC_V2_NBE q_x[ch] = Q11; -#else /* OPT_SBA_DEC_V2_NBE */ - q_x[ch] = Q12; -#endif /* OPT_SBA_DEC_V2_NBE */ move16(); } #endif /* OPT_SBA_DEC_PATH */ @@ -419,21 +391,12 @@ void ivas_mct_core_dec( { FOR( i = 0; i < L_FRAME48k / 2; i++ ) { -#ifdef OPT_SBA_DEC_V2_NBE x_fx[ch][0][i] = L_shr( x_fx[ch][0][i], sub( q_x[ch], Q11 ) ); x_fx[ch][1][i] = L_shr( x_fx[ch][1][i], sub( q_x[ch], Q11 ) ); -#else /* OPT_SBA_DEC_V2_NBE */ - x_fx[ch][0][i] = L_shr( x_fx[ch][0][i], sub( q_x[ch], Q12 ) ); - x_fx[ch][1][i] = L_shr( x_fx[ch][1][i], sub( q_x[ch], Q12 ) ); -#endif /* OPT_SBA_DEC_V2_NBE */ move32(); move32(); } -#ifdef OPT_SBA_DEC_V2_NBE q_x[ch] = Q11; -#else /* OPT_SBA_DEC_V2_NBE */ - q_x[ch] = Q12; -#endif /* OPT_SBA_DEC_V2_NBE */ move16(); } #endif /* OPT_SBA_DEC_PATH */ diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index d15d6c574..32bcb918d 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -79,10 +79,6 @@ ivas_error ivas_mct_dec_fx( Word16 n, i; Word32 *x_fx[CPE_CHANNELS][NB_DIV]; //(Q(31 - x_e) -#ifndef OPT_SBA_DEC_V2_NBE - Word16 x_e[MAX_CICP_CHANNELS][NB_DIV]; - Word16 ch, k; -#endif /* OPT_SBA_DEC_V2_NBE */ Word16 x_len[CPE_CHANNELS][NB_DIV]; set16_fx( x_len[0], 0, NB_DIV ); set16_fx( x_len[1], 0, NB_DIV ); @@ -185,49 +181,17 @@ ivas_error ivas_mct_dec_fx( FOR( n = 0; n < CPE_CHANNELS; n++ ) { x_fx[n][0] = output_fx[n + ( cpe_id * CPE_CHANNELS )]; // Q11 -#ifndef OPT_SBA_DEC_V2_NBE - x_e[n][0] = 20; - move16(); -#endif /* OPT_SBA_DEC_V2_NBE */ move16(); x_fx[n][1] = output_fx[n + ( cpe_id * CPE_CHANNELS )] + ( L_FRAME48k / 2 ); // Q11 -#ifndef OPT_SBA_DEC_V2_NBE - x_e[n][1] = 20; - move16(); -#endif /* OPT_SBA_DEC_V2_NBE */ move16(); set32_fx( x_fx[n][0], 0, L_FRAME48k / 2 ); set32_fx( x_fx[n][1], 0, L_FRAME48k / 2 ); } -#ifndef OPT_SBA_DEC_V2_NBE - ivas_mdct_core_invQ_fx( st_ivas->hCPE[cpe_id], nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], - fUseTns[cpe_id], tnsData[cpe_id], x_fx, x_e, x_fx, x_e, x_len, Aq_fx[cpe_id], NULL, 1 ); -#else /* OPT_SBA_DEC_V2_NBE */ ivas_mdct_core_invQ_fx( st_ivas->hCPE[cpe_id], nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], fUseTns[cpe_id], tnsData[cpe_id], x_fx, 20, x_fx, 20, x_len, Aq_fx[cpe_id], NULL, 1 ); -#endif /* OPT_SBA_DEC_V2_NBE */ -#ifndef OPT_SBA_DEC_V2_NBE - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - Word16 subFrames; - IF( EQ_16( st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->core, TCX_10_CORE ) ) - { - subFrames = NB_DIV; - } - ELSE - { - subFrames = 1; - } - move16(); - FOR( k = 0; k < subFrames; ++k ) - { - Scale_sig32( x_fx[ch][k], shr( L_FRAME48k, sub( subFrames, 1 ) ), sub( x_e[ch][k], 20 ) ); // Scaling back to Q11 - } - } -#endif /* OPT_SBA_DEC_V2_NBE */ st_ivas->BER_detect = s_or( st_ivas->BER_detect, st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect ); move16(); @@ -238,22 +202,8 @@ ivas_error ivas_mct_dec_fx( /* MCT core decoder */ Word16 q_x[MAX_TRANSPORT_CHANNELS]; -#ifndef OPT_SBA_DEC_V2_NBE - set16_fx( q_x, Q12, MAX_TRANSPORT_CHANNELS ); - // Scaling output buffer to q_x - FOR( i = 0; i < hMCT->nchan_out_woLFE; ++i ) - { - Scale_sig32( output_fx[i], L_FRAME48k, sub( q_x[i], Q11 ) ); // Q11 -> Q12 - } -#endif /* OPT_SBA_DEC_V2_NBE */ ivas_mct_core_dec( hMCT, st_ivas->hCPE, nCPE, output_fx, q_x ); // Scaling output buffer back to Q11 -#ifndef OPT_SBA_DEC_V2_NBE - FOR( i = 0; i < hMCT->nchan_out_woLFE; ++i ) - { - Scale_sig32( output_fx[i], L_FRAME48k, sub( Q11, q_x[i] ) ); // Q12 -> Q11 - } -#endif /* OPT_SBA_DEC_V2_NBE */ /* for sba to stereo output disable any further processing for TCs > 2 as it is not needed*/ @@ -281,44 +231,12 @@ ivas_error ivas_mct_dec_fx( Copy_Scale_sig_16_32_DEPREC( Aq_fx[cpe_id][n], Aq_fx_32[cpe_id][n], 102, Q16 - Q12 ); // Q16 x_fx[n][0] = output_fx[n + ( cpe_id * CPE_CHANNELS )]; // Q11 x_fx[n][1] = output_fx[n + ( cpe_id * CPE_CHANNELS )] + ( L_FRAME48k / 2 ); // Q11 -#ifndef OPT_SBA_DEC_V2_NBE - x_e[n][0] = 20; - move16(); -#endif /* OPT_SBA_DEC_V2_NBE */ - move16(); move16(); -#ifndef OPT_SBA_DEC_V2_NBE - x_e[n][1] = 20; move16(); -#endif /* OPT_SBA_DEC_V2_NBE */ } -#ifndef OPT_SBA_DEC_V2_NBE - ivas_mdct_core_tns_ns_fx( hCPE, fUseTns[cpe_id], tnsData[cpe_id], x_fx, Aq_fx_32[cpe_id], 1, x_e ); -#else /* OPT_SBA_DEC_V2_NBE */ ivas_mdct_core_tns_ns_fx( hCPE, fUseTns[cpe_id], tnsData[cpe_id], x_fx, Aq_fx_32[cpe_id], 1, 20 ); -#endif /* OPT_SBA_DEC_V2_NBE */ -#ifndef OPT_SBA_DEC_V2_NBE - FOR( Word16 ind = 0; ind < 2; ind++ ) - { - Word16 nSubFrames; - IF( EQ_16( hCPE->hCoreCoder[ind]->core, TCX_20_CORE ) ) - { - nSubFrames = 1; - } - ELSE - { - nSubFrames = NB_DIV; - } - move16(); - Scale_sig32( x_fx[ind][0], shr( L_FRAME48k, sub( nSubFrames, 1 ) ), sub( x_e[ind][0], 20 ) ); // Q11 - IF( EQ_16( nSubFrames, 2 ) ) - { - Scale_sig32( x_fx[ind][1], shr( L_FRAME48k, 1 ), sub( x_e[ind][1], 20 ) ); // Q11 - } - } -#endif /* OPT_SBA_DEC_V2_NBE */ } diff --git a/lib_dec/ivas_mct_dec_mct_fx_fx.c b/lib_dec/ivas_mct_dec_mct_fx_fx.c index f470ac9cd..050385b96 100644 --- a/lib_dec/ivas_mct_dec_mct_fx_fx.c +++ b/lib_dec/ivas_mct_dec_mct_fx_fx.c @@ -323,13 +323,8 @@ void mctStereoIGF_dec_fx( move16(); // Using input Q-factor as 12 -#ifdef OPT_SBA_DEC_V2_NBE set16_fx( p_x_e[0], 31 - Q11, CPE_CHANNELS ); // Q12 set16_fx( p_x_e[1], 31 - Q11, CPE_CHANNELS ); // Q12 -#else /* OPT_SBA_DEC_V2_NBE */ - set16_fx( p_x_e[0], 31 - Q12, CPE_CHANNELS ); // Q12 - set16_fx( p_x_e[1], 31 - Q12, CPE_CHANNELS ); // Q12 -#endif /* OPT_SBA_DEC_V2_NBE */ FOR( k = 0; k < nSubframes; k++ ) { @@ -358,21 +353,13 @@ void mctStereoIGF_dec_fx( decoder_tcx_IGF_stereo_fx( sts, hMCT->hBlockData[b]->hStereoMdct, hMCT->hBlockData[b]->mask, p_x, p_x_e, p_x_len, L_frame[0], left_rect[0], k, bfi, 1 /* MCT_flag */ ); // Shifting output with variable exponent back to Q12 -#ifdef OPT_SBA_DEC_V2_NBE shr_k = sub( 31 - Q11, p_x_e[0][k] ); -#else /* OPT_SBA_DEC_V2_NBE */ - shr_k = sub( 31 - Q12, p_x_e[0][k] ); -#endif /* OPT_SBA_DEC_V2_NBE */ FOR( Word16 i = 0; i < p_x_len[0][k]; i++ ) { p_x[0][k][i] = L_shr( p_x[0][k][i], shr_k ); move32(); } -#ifdef OPT_SBA_DEC_V2_NBE shr_k = sub( 31 - Q11, p_x_e[1][k] ); -#else /* OPT_SBA_DEC_V2_NBE */ - shr_k = sub( 31 - Q12, p_x_e[1][k] ); -#endif /* OPT_SBA_DEC_V2_NBE */ FOR( Word16 i = 0; i < p_x_len[1][k]; i++ ) { p_x[1][k][i] = L_shr( p_x[1][k][i], shr_k ); @@ -405,11 +392,7 @@ void mctStereoIGF_dec_fx( /* mono or dual mono IGF decoding */ -#ifdef OPT_SBA_DEC_V2_NBE x_e = 31 - Q11; // input q-factor of x[p_ch[ch]][k] is Q12 -#else /* OPT_SBA_DEC_V2_NBE */ - x_e = 31 - Q12; // input q-factor of x[p_ch[ch]][k] is Q12 -#endif /* OPT_SBA_DEC_V2_NBE */ move16(); decoder_tcx_IGF_mono_fx( st, x[p_ch[ch]][k], &x_e, &x_len, L_frame[ch], left_rect[ch], bfi, k ); @@ -417,11 +400,7 @@ void mctStereoIGF_dec_fx( FOR( Word16 i = 0; i < x_len; i++ ) { // Converting from variable exponent to Fixed q-factor (Q12) -#ifdef OPT_SBA_DEC_V2_NBE x[p_ch[ch]][k][i] = L_shr( x[p_ch[ch]][k][i], sub( 31 - Q11, x_e ) ); -#else /* OPT_SBA_DEC_V2_NBE */ - x[p_ch[ch]][k][i] = L_shr( x[p_ch[ch]][k][i], sub( 31 - Q12, x_e ) ); -#endif /* OPT_SBA_DEC_V2_NBE */ move32(); } } @@ -473,11 +452,7 @@ void mctStereoIGF_dec_fx( init_tcx_info_fx( st, L_frame_nSubframe, L_frameTCX_nSubframe, k, bfi, &tcx_offset[0], &tcx_offsetFB[0], &L_frame[0], &L_frameTCX[0], &left_rect[0], &L_spec[0] ); /* mono or dual mono IGF decoding */ -#ifdef OPT_SBA_DEC_V2_NBE x_e = 31 - Q11; // Input Q-factor is Q12. -#else /* OPT_SBA_DEC_V2_NBE */ - x_e = 31 - Q12; // Input Q-factor is Q12. -#endif /* OPT_SBA_DEC_V2_NBE */ move16(); decoder_tcx_IGF_mono_fx( st, x[ch][k], &x_e, &x_len, L_frame[0], left_rect[0], bfi, k ); @@ -485,11 +460,7 @@ void mctStereoIGF_dec_fx( FOR( Word16 i = 0; i < x_len; i++ ) { // Converting from variable exponent to Fixed q-factor (Q12) -#ifdef OPT_SBA_DEC_V2_NBE x[ch][k][i] = L_shr( x[ch][k][i], sub( 31 - Q11, x_e ) ); -#else /* OPT_SBA_DEC_V2_NBE */ - x[ch][k][i] = L_shr( x[ch][k][i], sub( 31 - Q12, x_e ) ); -#endif /* OPT_SBA_DEC_V2_NBE */ move32(); } } diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index 2baa31d22..9e26be4d5 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -630,17 +630,9 @@ void ivas_mdct_core_invQ_fx( Word16 fUseTns[CPE_CHANNELS][NB_DIV], /* i : flag TNS enabled */ STnsData tnsData[CPE_CHANNELS][NB_DIV], /* i : TNS parameter */ Word32 *x_0[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ -#ifdef OPT_SBA_DEC_V2_NBE Word16 x_0_e, -#else /* OPT_SBA_DEC_V2_NBE */ - Word16 x_0_e[CPE_CHANNELS][NB_DIV], -#endif /* OPT_SBA_DEC_V2_NBE */ Word32 *x[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ -#ifdef OPT_SBA_DEC_V2_NBE Word16 x_e, -#else /* OPT_SBA_DEC_V2_NBE */ - Word16 x_e[CPE_CHANNELS][NB_DIV], -#endif /* OPT_SBA_DEC_V2_NBE */ Word16 x_len[CPE_CHANNELS][NB_DIV], Word16 Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* i : LP coefficients Q12*/ Word16 ms_mask[NB_DIV][MAX_SFB], /* i : M/S mask */ @@ -971,11 +963,6 @@ void ivas_mdct_core_invQ_fx( IF( EQ_32( st->mct_chan_mode, MCT_CHAN_MODE_IGNORE ) ) { -#ifndef OPT_SBA_DEC_V2_NBE - set32_fx( x[ch][0], 0, st->hTcxCfg->tcx_coded_lines ); - x_e[ch][0] = 31; - move16(); -#endif /* OPT_SBA_DEC_V2_NBE */ /* usually set in decoder_tcx_invQ(), needed for concealment */ st->hTcxDec->damping = 0; move16(); @@ -1007,10 +994,8 @@ void ivas_mdct_core_invQ_fx( FOR( k = 0; k < nSubframes[ch]; k++ ) { -#ifdef OPT_SBA_DEC_V2_NBE Word16 x_e_local = x_e; Word16 j, diff; -#endif /* OPT_SBA_DEC_V2_NBE */ /* Stability Factor */ IF( !bfi ) { @@ -1045,7 +1030,6 @@ void ivas_mdct_core_invQ_fx( nf_seed = 0; move16(); -#ifdef OPT_SBA_DEC_V2_NBE decoder_tcx_invQ_fx( st, prm[ch], Aq[ch], Aind[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], x[ch][k], &x_e_local, NULL, NULL, xn_buf, &fUseTns[ch][k], &tnsData[ch][k], &gain_tcx, &gain_tcx_e, &prm_sqQ, &nf_seed, bfi, k ); diff = sub( x_e_local, x_0_e ); @@ -1061,22 +1045,10 @@ void ivas_mdct_core_invQ_fx( { Copy32( x[ch][k], x_0[ch][k], L_frameTCX[ch] ); } -#else /* OPT_SBA_DEC_V2_NBE */ - decoder_tcx_invQ_fx( st, prm[ch], Aq[ch], Aind[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], x[ch][k], &x_e[ch][k], NULL, NULL, xn_buf, &fUseTns[ch][k], &tnsData[ch][k], &gain_tcx, &gain_tcx_e, &prm_sqQ, &nf_seed, bfi, k ); -#endif /* OPT_SBA_DEC_V2_NBE */ shift = Find_Max_Norm32( x[ch][k], L_frameTCX[ch] ); move16(); Scale_sig32( x[ch][k], L_frameTCX[ch], shift ); -#ifdef OPT_SBA_DEC_V2_NBE x_e_local = sub( x_e_local, shift ); -#else /* OPT_SBA_DEC_V2_NBE */ - x_e[ch][k] = sub( x_e[ch][k], shift ); - move16(); - - Copy32( x[ch][k], x_0[ch][k], L_frameTCX[ch] ); - x_0_e[ch][k] = x_e[ch][k]; - move16(); -#endif /* OPT_SBA_DEC_V2_NBE */ // PLC to be done test(); @@ -1085,29 +1057,17 @@ void ivas_mdct_core_invQ_fx( TonalMdctConceal_create_concealment_noise_ivas_fx( concealment_noise_fx[ch], &concealment_noise_e[ch], hCPE, L_frameTCX[ch], L_frame[ch], ch, k, st->core, st->hTcxDec->cummulative_damping_tcx, noise_gen_mode_bfi ); } -#ifdef OPT_SBA_DEC_V2_NBE decoder_tcx_noisefilling_fx( st, concealment_noise_fx[ch], concealment_noise_e[ch], Aq[ch], L_frameTCX_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], x[ch][k], &x_e_local, NULL, NULL, &tmp_concealment_method, gain_tcx, gain_tcx_e, prm_sqQ, nf_seed, bfi, MCT_flag, k ); -#else /* OPT_SBA_DEC_V2_NBE */ - decoder_tcx_noisefilling_fx( st, concealment_noise_fx[ch], concealment_noise_e[ch], Aq[ch], L_frameTCX_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], x[ch][k], &x_e[ch][k], NULL, NULL, &tmp_concealment_method, gain_tcx, gain_tcx_e, prm_sqQ, nf_seed, bfi, MCT_flag, k ); -#endif /* OPT_SBA_DEC_V2_NBE */ shift = Find_Max_Norm32( x[ch][k], L_frameTCX[ch] ); move16(); Scale_sig32( x[ch][k], L_frameTCX[ch], shift ); -#ifdef OPT_SBA_DEC_V2_NBE x_e_local = sub( x_e_local, shift ); -#else /* OPT_SBA_DEC_V2_NBE */ - x_e[ch][k] = sub( x_e[ch][k], shift ); -#endif /* OPT_SBA_DEC_V2_NBE */ move16(); -#ifdef OPT_SBA_DEC_V2_NBE decoder_tcx_noiseshaping_igf_fx( st, L_spec[ch], L_frame[ch], L_frameTCX[ch], left_rect[ch], x[ch][k], &x_e_local, &x_len[ch][k], NULL, NULL, &tmp_concealment_method, bfi ); Scale_sig32( x[ch][k], L_frameTCX[ch], sub( x_e_local, x_e ) ); -#else /* OPT_SBA_DEC_V2_NBE */ - decoder_tcx_noiseshaping_igf_fx( st, L_spec[ch], L_frame[ch], L_frameTCX[ch], left_rect[ch], x[ch][k], &x_e[ch][k], &x_len[ch][k], NULL, NULL, &tmp_concealment_method, bfi ); -#endif /* OPT_SBA_DEC_V2_NBE */ } } } @@ -1652,11 +1612,7 @@ void ivas_mdct_core_tns_ns_fx( Word32 *x_fx[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS Q(31 - x_e)*/ Word32 Aq_fx[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* o : LP coefficients Q16*/ const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ -#ifdef OPT_SBA_DEC_V2_NBE Word16 x_e ) -#else /* OPT_SBA_DEC_V2_NBE */ - Word16 x_e[CPE_CHANNELS][NB_DIV] ) -#endif /* OPT_SBA_DEC_V2_NBE */ { Word16 ch, k, bfi; Decoder_State **sts, *st; @@ -1730,11 +1686,7 @@ void ivas_mdct_core_tns_ns_fx( &tcx_offsetFB[ch], &L_frame[ch], &L_frameTCX[ch], &left_rect[ch], &L_spec[ch] ); Word16 q_x; -#ifdef OPT_SBA_DEC_V2_NBE q_x = sub( 31, x_e ); -#else /* OPT_SBA_DEC_V2_NBE */ - q_x = sub( 31, x_e[ch][k] ); -#endif /* OPT_SBA_DEC_V2_NBE */ IF( bfi == 0 ) { sns_interpolate_scalefactors_fx( sns_int_scf_fx, &Aq_fx[ch][k * M], DEC ); // Q16 @@ -1753,11 +1705,7 @@ void ivas_mdct_core_tns_ns_fx( scf_e[ind] = sub( 15, q_shift ); move16(); } -#ifdef OPT_SBA_DEC_V2_NBE TonalMDCTConceal_SaveFreqSignal_ivas_fx( st->hTonalMDCTConc, x_fx[ch][k], x_e, L_frameTCX[ch], L_frame[ch], &scf_fx[0], scf_e, 0, get_igf_startline( st, L_frame[ch], L_frameTCX[ch] ) ); -#else /* OPT_SBA_DEC_V2_NBE */ - TonalMDCTConceal_SaveFreqSignal_ivas_fx( st->hTonalMDCTConc, x_fx[ch][k], x_e[ch][k], L_frameTCX[ch], L_frame[ch], &scf_fx[0], scf_e, 0, get_igf_startline( st, L_frame[ch], L_frameTCX[ch] ) ); -#endif /* OPT_SBA_DEC_V2_NBE */ } } ELSE @@ -1819,10 +1767,6 @@ void ivas_mdct_core_tns_ns_fx( norm_x = getScaleFactor32( &x_fx[ch][k][0], length ); Scale_sig32( &x_fx[ch][k][0], length, norm_x ); q_x = add( q_x, norm_x ); -#ifndef OPT_SBA_DEC_V2_NBE - x_e[ch][k] = sub( 31, q_x ); - move16(); -#endif /* OPT_SBA_DEC_V2_NBE */ Word16 q_sns_int_scf; Word16 q_2; @@ -1849,10 +1793,6 @@ void ivas_mdct_core_tns_ns_fx( Scale_sig32( &x_fx[ch][k][0] + length, sub( length2, length ), sub( add( q_x, 1 ), q_2 ) ); q_x = add( q_x, 1 ); } -#ifndef OPT_SBA_DEC_V2_NBE - x_e[ch][k] = sub( 31, q_x ); - move16(); -#endif /* OPT_SBA_DEC_V2_NBE */ v_multc_fixed( x_fx[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sns_int_scf_fx[FDNS_NPTS - 1], x_fx[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sub( L_spec[ch], st->hTcxCfg->psychParamsCurrent->nBins ) ); @@ -1860,10 +1800,6 @@ void ivas_mdct_core_tns_ns_fx( Scale_sig32( &x_fx[ch][k][0], st->hTcxCfg->psychParamsCurrent->nBins, sub( q_2, q_x ) ); q_x = q_2; move16(); -#ifndef OPT_SBA_DEC_V2_NBE - x_e[ch][k] = sub( 31, q_x ); - move16(); -#endif /* OPT_SBA_DEC_V2_NBE */ q_x = sub( q_x, 5 ); length = L_frameTCX[ch]; @@ -1880,52 +1816,19 @@ void ivas_mdct_core_tns_ns_fx( } Scale_sig32( &x_fx[ch][k][0], length, -5 ); decoder_tcx_tns_fx( st, L_frame_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], &x_fx[ch][k][0], fUseTns[ch][k], &tnsData[ch][k], bfi, k, 0, &length ); -#ifndef OPT_SBA_DEC_V2_NBE - norm_x = getScaleFactor32( &x_fx[ch][k][0], length ); - Scale_sig32( &x_fx[ch][k][0], length, norm_x ); - q_x = add( q_x, norm_x ); - x_e[ch][k] = sub( 31, q_x ); - move16(); -#else /* OPT_SBA_DEC_V2_NBE */ Scale_sig32( &x_fx[ch][k][0], length, sub( sub( 31, q_x ), x_e ) ); -#endif /* OPT_SBA_DEC_V2_NBE */ } IF( ( bfi != 0 ) && ( st->tonal_mdct_plc_active != 0 ) ) { -#ifndef OPT_SBA_DEC_V2_NBE - Word16 tmp_x_fx_exp[L_FRAME48k], temp = -MAX_16; - move16(); -#endif /* OPT_SBA_DEC_V2_NBE */ Word16 i; FOR( i = 0; i < FDNS_NPTS; i++ ) { st->hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e = s_max( st->hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e, st->hTonalMDCTConc->secondLastBlockData.scaleFactors_exp[i] ); } -#ifndef OPT_SBA_DEC_V2_NBE - set16_fx( tmp_x_fx_exp, x_e[ch][0], L_FRAME48k ); - TonalMDCTConceal_Apply_ivas_fx( st->hTonalMDCTConc, x_fx[ch][0], tmp_x_fx_exp, st->hTcxCfg->psychParamsCurrent ); -#else /* OPT_SBA_DEC_V2_NBE */ TonalMDCTConceal_Apply_ivas_fx( st->hTonalMDCTConc, x_fx[ch][0], x_e, st->hTcxCfg->psychParamsCurrent ); -#endif /* OPT_SBA_DEC_V2_NBE */ - -#ifndef OPT_SBA_DEC_V2_NBE - FOR( i = 0; i < L_FRAME48k; i++ ) - { - temp = s_max( temp, tmp_x_fx_exp[i] ); - } - { - x_e[ch][0] = temp; - move16(); - FOR( i = 0; i < L_FRAME48k; i++ ) - { - x_fx[ch][0][i] = L_shr( x_fx[ch][0][i], sub( temp, tmp_x_fx_exp[i] ) ); - move32(); - } - } -#endif /* OPT_SBA_DEC_V2_NBE */ } test(); diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index b52d04951..6a661ea50 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -178,9 +178,6 @@ void stereo_mdct_core_dec_fx( /*needed to allocate N_MAX to prevent stereo switching crash */ Word32 x_0_buf_fx[CPE_CHANNELS][N_MAX]; Word32 *x_0_fx[CPE_CHANNELS][NB_DIV]; -#ifndef OPT_SBA_DEC_V2_NBE - Word16 x_0_e[CPE_CHANNELS][NB_DIV]; -#endif /* OPT_SBA_DEC_V2_NBE */ /* Concealment */ Word16 bfi; @@ -291,50 +288,14 @@ void stereo_mdct_core_dec_fx( { FOR( j = 0; j < NB_DIV; ++j ) { -#ifndef OPT_SBA_DEC_V2_NBE - x_e[i][j] = 31; -#else /* OPT_SBA_DEC_V2_NBE */ x_e[i][j] = 20; -#endif /* OPT_SBA_DEC_V2_NBE */ move16(); x_len[i][j] = 0; move16(); -#ifndef OPT_SBA_DEC_V2_NBE - x_0_e[i][j] = 31; - move16(); -#endif /* OPT_SBA_DEC_V2_NBE */ } } -#ifdef OPT_SBA_DEC_V2_NBE ivas_mdct_core_invQ_fx( hCPE, nTnsBitsTCX10, p_param, param_lpc, param, fUseTns, tnsData, x_0_fx, 20, x_fx, 20, x_len, Aq_fx, ms_mask, 0 ); -#else /* OPT_SBA_DEC_V2_NBE */ - ivas_mdct_core_invQ_fx( hCPE, nTnsBitsTCX10, p_param, param_lpc, param, fUseTns, tnsData, x_0_fx, x_0_e, x_fx, x_e, x_len, Aq_fx, ms_mask, 0 ); - - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - Word16 subFrames; - // Word16 subFrames = ( hCPE->hCoreCoder[ch]->core == TCX_10_CORE ) ? NB_DIV : 1; - IF( ( hCPE->hCoreCoder[ch]->core == TCX_10_CORE ) ) - { - subFrames = NB_DIV; /* Q0 */ - } - ELSE - { - subFrames = 1; /* Q0 */ - } - move16(); - FOR( k = 0; k < subFrames; ++k ) - { - Scale_sig32( x_fx[ch][k], x_len[ch][k], sub( x_e[ch][k], 20 ) ); /* exp(20) */ - x_e[ch][k] = 20; - move16(); - Scale_sig32( x_0_fx[ch][k], x_len[ch][k], sub( x_0_e[ch][k], 20 ) ); /* exp(20) */ - x_0_e[ch][k] = 20; - move16(); - } - } -#endif /* OPT_SBA_DEC_V2_NBE */ FOR( ch = 0; ch < nChannels; ch++ ) { @@ -483,17 +444,6 @@ void stereo_mdct_core_dec_fx( move16(); #endif /* OPT_SBA_DEC_PATH */ -#ifndef OPT_SBA_DEC_V2_NBE - - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - if ( NE_16( hCPE->hCoreCoder[ch]->core, TCX_20_CORE ) ) - { - x_e[ch][1] = x_e[ch][0]; - move16(); - } - } -#endif /* OPT_SBA_DEC_V2_NBE */ #ifdef OPT_SBA_DEC_PATH stereo_decoder_tcx_fx( hCPE->hStereoMdct, ms_mask, x_0_fx[1], x_fx[0], x_fx[1], &hCPE->hStereoMdct->mdct_stereo_mode[0], sts[0]->core, sts[1]->core, sts[0]->igf, L_frameTCX[0], L_frameTCX[1], 0, sts[0]->last_core, sts[1]->last_core, 0 ); #else /* OPT_SBA_DEC_PATH */ @@ -501,36 +451,7 @@ void stereo_mdct_core_dec_fx( #endif /* OPT_SBA_DEC_PATH */ } -#ifdef OPT_SBA_DEC_V2_NBE ivas_mdct_core_tns_ns_fx( hCPE, fUseTns, tnsData, x_fx, Aq_fx_32, 0, 20 ); -#else /* OPT_SBA_DEC_V2_NBE */ - - ivas_mdct_core_tns_ns_fx( hCPE, fUseTns, tnsData, x_fx, Aq_fx_32, 0, x_e ); - - FOR( Word16 ind = 0; ind < 2; ind++ ) - { - Word16 nSubFrames; - // Word16 nSubFrames = EQ_16( hCPE->hCoreCoder[ind]->core, TCX_20_CORE ) ? 1 : NB_DIV; - IF( EQ_16( hCPE->hCoreCoder[ind]->core, TCX_20_CORE ) ) - { - nSubFrames = 1; - } - ELSE - { - nSubFrames = NB_DIV; - } - move16(); - Scale_sig32( x_fx[ind][0], shr( L_FRAME_MAX, sub( nSubFrames, 1 ) ), sub( x_e[ind][0], 20 ) ); /* exp(20) */ - x_e[ind][0] = 20; - move16(); - IF( EQ_16( nSubFrames, 2 ) ) - { - Scale_sig32( x_fx[ind][1], shr( L_FRAME_MAX, 1 ), sub( x_e[ind][1], 20 ) ); /* exp(20) */ - x_e[ind][1] = 20; - move16(); - } - } -#endif /* OPT_SBA_DEC_V2_NBE */ test(); test(); IF( EQ_16( st_ivas->renderer_type, RENDERER_MC_PARAMMC ) && ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) ) ) diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 9582463eb..1f6122f86 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -2589,11 +2589,7 @@ void TonalMDCTConceal_Apply( void TonalMDCTConceal_Apply_ivas_fx( TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ Word32 *mdctSpectrum, // Q31-*mdctSpectrum_exp /*IN/OUT*/ -#ifdef OPT_SBA_DEC_V2_NBE Word16 mdctSpectrum_exp, /*IN */ -#else /* OPT_SBA_DEC_V2_NBE */ - Word16 mdctSpectrum_exp[L_FRAME_MAX], /*IN */ -#endif /* OPT_SBA_DEC_V2_NBE */ const PsychoacousticParameters *psychParamsCurrent ) { @@ -2759,12 +2755,7 @@ void TonalMDCTConceal_Apply_ivas_fx( /* getCosWord16 returns 1Q14*/ mdctSpectrum[l] = Mpy_32_16_1( powerSpectrum[l], getCosWord16( extract_l( currentPhase ) ) ); move32(); -#ifdef OPT_SBA_DEC_V2_NBE mdctSpectrum[l] = L_shr( mdctSpectrum[l], sub( mdctSpectrum_exp, add( powerSpectrum_exp, 1 ) ) ); -#else /* OPT_SBA_DEC_V2_NBE */ - mdctSpectrum_exp[l] = add( powerSpectrum_exp, 1 ); // getCosWord16 returns Q14 (exp is 1)d - move16(); -#endif /* OPT_SBA_DEC_V2_NBE */ } } } -- GitLab From 3121c8ac1c5ce31e10177f5e0a96bc8c971ee87a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:48:12 +0200 Subject: [PATCH 11/35] [cleanup] accept OPT_MCT_ENC_V1_BE, OPT_MCT_ENC_V1_NBE --- lib_com/ivas_fb_mixer_fx.c | 26 -------- lib_com/ivas_tools_fx.c | 8 --- lib_com/options.h | 2 - lib_com/tns_base.c | 9 --- lib_enc/ivas_mcmasa_enc_fx.c | 122 ----------------------------------- 5 files changed, 167 deletions(-) diff --git a/lib_com/ivas_fb_mixer_fx.c b/lib_com/ivas_fb_mixer_fx.c index c40f65ad6..c29856bbd 100644 --- a/lib_com/ivas_fb_mixer_fx.c +++ b/lib_com/ivas_fb_mixer_fx.c @@ -614,7 +614,6 @@ void ivas_fb_mixer_get_windowed_fr_fx( Word16 n_new_samples; Word32 fr_in_block_fx[L_FRAME48k * 2]; const Word16 *win_ptr_fx; -#ifdef OPT_MCT_ENC_V1_BE Word16 two_mdft_len = shl( mdft_len, 1 ); Word16 tmp = sub( shl( mdft_len, 1 ), length ); Word16 gb_neg = negate( gb ); @@ -622,11 +621,6 @@ void ivas_fb_mixer_get_windowed_fr_fx( n_old_samples = s_min( ( sub( hFbMixer->fb_cfg->prior_input_length, hFbMixer->fb_cfg->windowed_fr_offset ) ), two_mdft_len ); offset = sub( tmp, hFbMixer->ana_window_offset ); rev_offset = sub( two_mdft_len, hFbMixer->ana_window_offset ); -#else - n_old_samples = s_min( ( sub( hFbMixer->fb_cfg->prior_input_length, hFbMixer->fb_cfg->windowed_fr_offset ) ), ( shl( mdft_len, 1 ) ) ); - offset = sub( sub( shl( mdft_len, 1 ), length ), hFbMixer->ana_window_offset ); - rev_offset = sub( shl( mdft_len, 1 ), hFbMixer->ana_window_offset ); -#endif set32_fx( fr_in_block_fx, 0, offset ); n_new_samples = s_max( 0, sub( shl( length, 1 ), n_old_samples ) ); FOR( ch_idx = 0; ch_idx < nchan_fb_in; ch_idx++ ) @@ -636,41 +630,21 @@ void ivas_fb_mixer_get_windowed_fr_fx( win_ptr_fx = hFbMixer->pAna_window_fx; /*Q15*/ -#ifdef OPT_MCT_ENC_V1_BE FOR( j = offset; j < tmp; j++ ) -#else - FOR( j = offset; j < sub( shl( mdft_len, 1 ), length ); j++ ) -#endif { fr_in_block_fx[j] = Mpy_32_16_1( fr_in_block_fx[j], ( *( win_ptr_fx++ ) ) ); // Qx + 15 - 15 = Qx move32(); } -#ifdef OPT_MCT_ENC_V1_BE FOR( j = rev_offset; j < two_mdft_len; j++ ) -#else - FOR( j = rev_offset; j < shl( mdft_len, 1 ); j++ ) -#endif { fr_in_block_fx[j] = Mpy_32_16_1( fr_in_block_fx[j], ( *( --win_ptr_fx ) ) ); // Qx + 15 - 15 = Qx move32(); } -#ifdef OPT_MCT_ENC_V1_BE scale_sig32( fr_in_block_fx, two_mdft_len, gb_neg ); -#else - FOR( Word16 i = 0; i < shl( mdft_len, 1 ); i++ ) - { - fr_in_block_fx[i] = L_shr( fr_in_block_fx[i], gb ); // Qx - gb - move32(); - } -#endif -#ifdef OPT_MCT_ENC_V1_BE ivas_mdft_fx( fr_in_block_fx, frame_f_real_fx[ch_idx], frame_f_imag_fx[ch_idx], two_mdft_len, mdft_len ); -#else - ivas_mdft_fx( fr_in_block_fx, frame_f_real_fx[ch_idx], frame_f_imag_fx[ch_idx], shl( mdft_len, 1 ), mdft_len ); -#endif } return; diff --git a/lib_com/ivas_tools_fx.c b/lib_com/ivas_tools_fx.c index a1b484f6d..fad7c0549 100644 --- a/lib_com/ivas_tools_fx.c +++ b/lib_com/ivas_tools_fx.c @@ -1965,11 +1965,7 @@ void v_multc_acc_32_16( FOR( i = 0; i < N; i++ ) { -#ifdef OPT_MCT_ENC_V1_BE y[i] = Madd_32_16( y[i], x[i], c ); -#else - y[i] = L_add( y[i], Mpy_32_16_1( x[i], c ) ); -#endif move32(); } @@ -1986,11 +1982,7 @@ void v_multc_acc_32_32( FOR( i = 0; i < N; i++ ) { -#ifdef OPT_MCT_ENC_V1_BE y[i] = Madd_32_32( y[i], x[i], c ); /*Qx*/ -#else - y[i] = L_add( y[i], Mpy_32_32( x[i], c ) ); /*Qx*/ -#endif move32(); } diff --git a/lib_com/options.h b/lib_com/options.h index 17e9291cd..4b66b3b27 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,8 +77,6 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE #define OPT_BIN_REND_V2_NBE -#define OPT_MCT_ENC_V1_NBE -#define OPT_MCT_ENC_V1_BE #define OPT_SBA_REND_V1_BE #define OPT_HEAD_ROT_REND_V1_BE #define OPT_SBA_DEC_V2_BE diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index 376e2813d..57d9b5b6d 100644 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -1207,13 +1207,8 @@ static Word32 FIRLattice( move32(); FOR( i = 0; i < order - 1; i++ ) { -#ifdef OPT_MCT_ENC_V1_BE tmp = Madd_32_16( state[i], x, parCoeff[i] ); /*Q0*/ x = Madd_32_16( x, state[i], parCoeff[i] ); /* exponent: 31+0 */ -#else - tmp = L_add( state[i], Mpy_32_16_1( x, parCoeff[i] ) ); /*Q0*/ - x = L_add( x, Mpy_32_16_1( state[i], parCoeff[i] ) ); /* exponent: 31+0 */ -#endif state[i] = tmpSave; /*Q0*/ move32(); tmpSave = tmp; /*Q0*/ @@ -1221,11 +1216,7 @@ static Word32 FIRLattice( } /* last stage: only need half operations */ -#ifdef OPT_MCT_ENC_V1_BE x = Madd_32_16( x, state[order - 1], parCoeff[order - 1] ); /*Q0*/ -#else - x = L_add( x, Mpy_32_16_1( state[order - 1], parCoeff[order - 1] ) ); /*Q0*/ -#endif state[order - 1] = tmpSave; /*Q0*/ move32(); diff --git a/lib_enc/ivas_mcmasa_enc_fx.c b/lib_enc/ivas_mcmasa_enc_fx.c index c9b64866e..1a208d0cc 100644 --- a/lib_enc/ivas_mcmasa_enc_fx.c +++ b/lib_enc/ivas_mcmasa_enc_fx.c @@ -2099,7 +2099,6 @@ static void compute_cov_mtx_fx( ) { Word16 i, j; -#ifdef OPT_MCT_ENC_V1_NBE Word64 temp64_1, temp64_2; Word16 tmp_16, max_exp; Word16 temp_exp = shl( inp_exp, 1 ); @@ -2133,44 +2132,9 @@ static void compute_cov_mtx_fx( move32(); } } -#else - Word32 a, b, c, d; - Word32 temp; - Word16 norm_a, norm_b, norm_c, norm_d; - Word16 shift; - FOR( i = 0; i < N; i++ ) - { - a = sr[i][freq]; - move32(); - b = si[i][freq]; - move32(); - norm_a = norm_l( a ); - norm_b = norm_l( b ); - a = L_shl( a, norm_a ); /*inp_exp-norm_a*/ - b = L_shl( b, norm_b ); /*inp_exp-norm_b*/ - FOR( j = i; j < N; j++ ) - { - c = sr[j][freq]; - move32(); - d = si[j][freq]; - move32(); - norm_c = norm_l( c ); - norm_d = norm_l( d ); - c = L_shl( c, norm_c ); /*inp_exp-norm_c*/ - d = L_shl( d, norm_d ); /*inp_exp-norm_d*/ - temp = BASOP_Util_Add_Mant32Exp( Mult_32_32( a, c ), sub( shl( inp_exp, 1 ), add( norm_a, norm_c ) ), Mult_32_32( b, d ), sub( shl( inp_exp, 1 ), add( norm_b, norm_d ) ), &shift ); /*exp=inp_exp-norm_ab+inp_exp-norm_cd*/ - COVls->xr_fx[i][j] = BASOP_Util_Add_Mant32Exp( COVls->xr_fx[i][j], COVls->xr_e[i][j], temp, shift, &COVls->xr_e[i][j] ); - move32(); - temp = BASOP_Util_Add_Mant32Exp( Mult_32_32( b, c ), sub( shl( inp_exp, 1 ), add( norm_b, norm_c ) ), L_negate( Mult_32_32( a, d ) ), sub( shl( inp_exp, 1 ), add( norm_a, norm_d ) ), &shift ); - COVls->xi_fx[i][j] = BASOP_Util_Add_Mant32Exp( COVls->xi_fx[i][j], COVls->xi_e[i][j], temp, shift, &COVls->xi_e[i][j] ); - move32(); - } - } -#endif return; } -#ifdef OPT_MCT_ENC_V1_BE static void computeIntensityVector_enc_fx( const Word16 *band_grouping, Word32 Cldfb_RealBuffer[FOA_CHANNELS][DIRAC_NO_FB_BANDS_MAX], /*inp_q*/ @@ -2248,92 +2212,6 @@ static void computeIntensityVector_enc_fx( return; } -#else -static void computeIntensityVector_enc_fx( - const Word16 *band_grouping, - Word32 Cldfb_RealBuffer[FOA_CHANNELS][DIRAC_NO_FB_BANDS_MAX], /*inp_q*/ - Word32 Cldfb_ImagBuffer[FOA_CHANNELS][DIRAC_NO_FB_BANDS_MAX], /*inp_q*/ - const Word16 enc_param_start_band, /* i : first band to process */ - const Word16 num_frequency_bands, - Word32 intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS], /*exp: exp_intensity_real*/ - Word16 q_intensity_real[MASA_FREQUENCY_BANDS], - Word16 inp_q ) -{ - Word16 i, j; - Word32 real, img; - Word16 brange[2]; - Word16 shift_intensity_real, num_bins, guard_bits, norm; - - Word64 intensity_real64[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; - - FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) - { - set64_fx( intensity_real64[i], 0, MASA_FREQUENCY_BANDS ); - } - - shift_intensity_real = sub( shl( inp_q, 1 ), 32 ); - - FOR( i = enc_param_start_band; i < enc_param_start_band + num_frequency_bands; i++ ) - { - brange[0] = band_grouping[i]; - move16(); - brange[1] = band_grouping[i + 1]; - move16(); - - num_bins = sub( brange[1], brange[0] ); - guard_bits = find_guarded_bits_fx( num_bins ); - - intensity_real[0][i] = 0; - move32(); - intensity_real[1][i] = 0; - move32(); - intensity_real[2][i] = 0; - move32(); - - FOR( j = brange[0]; j < brange[1]; j++ ) - { - real = Cldfb_RealBuffer[0][j]; - move32(); - img = Cldfb_ImagBuffer[0][j]; - move32(); - /* Intensity is XYZ order, audio is WYZX order. */ - intensity_real64[0][i] = W_add( intensity_real64[0][i], W_shr( W_add( W_mult0_32_32( Cldfb_RealBuffer[3][j], real ), W_mult0_32_32( Cldfb_ImagBuffer[3][j], img ) ), guard_bits ) ); // output Q= 2* input_q - guard_bits - move32(); - intensity_real64[1][i] = W_add( intensity_real64[1][i], W_shr( W_add( W_mult0_32_32( Cldfb_RealBuffer[1][j], real ), W_mult0_32_32( Cldfb_ImagBuffer[1][j], img ) ), guard_bits ) ); // output Q= 2* input_q - guard_bits - move32(); - intensity_real64[2][i] = W_add( intensity_real64[2][i], W_shr( W_add( W_mult0_32_32( Cldfb_RealBuffer[2][j], real ), W_mult0_32_32( Cldfb_ImagBuffer[2][j], img ) ), guard_bits ) ); // output Q= 2* input_q - guard_bits - move32(); - } - - norm = 63; - move16(); - IF( intensity_real64[0][i] != 0 ) - { - norm = s_min( norm, W_norm( intensity_real64[0][i] ) ); - } - IF( intensity_real64[1][i] != 0 ) - { - norm = s_min( norm, W_norm( intensity_real64[1][i] ) ); - } - IF( intensity_real64[2][i] != 0 ) - { - norm = s_min( norm, W_norm( intensity_real64[2][i] ) ); - } - - intensity_real[0][i] = W_extract_h( W_shl( intensity_real64[0][i], norm ) ); /*2 * inp_q - guard_bits + norm - 32*/ - move32(); - intensity_real[1][i] = W_extract_h( W_shl( intensity_real64[1][i], norm ) ); /*2 * inp_q - guard_bits + norm - 32*/ - move32(); - intensity_real[2][i] = W_extract_h( W_shl( intensity_real64[2][i], norm ) ); /*2 * inp_q - guard_bits + norm - 32*/ - move32(); - - q_intensity_real[i] = add( shift_intensity_real, sub( norm, guard_bits ) ); - move16(); - } - - return; -} -#endif static void computeVerticalDiffuseness_fx( Word32 **buffer_intensity, /* i : Intensity vectors */ -- GitLab From 66f192b5142046b9972c080332236ecfd28e46eb Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:49:16 +0200 Subject: [PATCH 12/35] [cleanup] accept OPT_SBA_REND_V1_BE --- lib_com/options.h | 1 - .../ivas_dirac_dec_binaural_functions_fx.c | 159 ------------------ lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 54 ------ lib_rend/ivas_dirac_rend_fx.c | 17 -- lib_rend/ivas_efap_fx.c | 4 - lib_rend/ivas_vbap_fx.c | 42 ----- 6 files changed, 277 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 4b66b3b27..f4913b409 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,7 +77,6 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE #define OPT_BIN_REND_V2_NBE -#define OPT_SBA_REND_V1_BE #define OPT_HEAD_ROT_REND_V1_BE #define OPT_SBA_DEC_V2_BE #define OPT_SBA_ENC_V2_BE diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 65d8976ac..80a114052 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -3659,7 +3659,6 @@ static void eig2x2_fx( move16(); move16(); -#ifdef OPT_SBA_REND_V1_BE /* Eigenvectors */ FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { @@ -3821,164 +3820,6 @@ static void eig2x2_fx( move16(); } } -#else /* OPT_SBA_REND_V1_BE */ - /* Eigenvectors */ - FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - IF( LT_16( *q_D, q_e ) ) - { - tmp1 = L_sub( D_fx[ch], L_shr( e1, sub( q_e, *q_D ) ) ); - tmp2 = L_sub( D_fx[ch], L_shr( e2, sub( q_e, *q_D ) ) ); - q_tmp1 = *q_D; - move16(); - } - ELSE - { - tmp1 = L_sub( L_shr( D_fx[ch], sub( *q_D, q_e ) ), e1 ); - tmp2 = L_sub( L_shr( D_fx[ch], sub( *q_D, q_e ) ), e2 ); - q_tmp1 = q_e; - move16(); - } - - IF( GT_32( L_abs( tmp2 ), L_abs( tmp1 ) ) ) - { - s_fx = tmp2; - move32(); - exp = sub( norm_l( s_fx ), 1 ); - tmp2 = Mpy_32_32( s_fx, s_fx ); - q_tmp2 = sub( add( q_tmp1, q_tmp1 ), 31 ); - - tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &q_tmp2 ); - q_tmp2 = sub( 31, q_tmp2 ); - - tmp3 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), epsilon_mant, epsilon_exp, &exp_tmp3 ); - - tmp2 = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q30, tmp3, &exp ); - exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); - normVal_fx = Sqrt32( tmp2, &exp ); // q_tmp2 - q_tmp2 = sub( 31, exp ); - - IF( LT_16( q_tmp1, q_c ) ) - { - c_re = L_shr( c_re, sub( q_c, q_tmp1 ) ); - c_im = L_shr( c_im, sub( q_c, q_tmp1 ) ); - q_c = q_tmp1; - move16(); - } - ELSE - { - s_fx = L_shr( s_fx, sub( q_tmp1, q_c ) ); - q_tmp1 = q_c; - move16(); - } - - Ure_fx[0][ch] = Mpy_32_32( s_fx, normVal_fx ); - move32(); - Ure_fx[1][ch] = Mpy_32_32( c_re, normVal_fx ); - move32(); - Uim_fx[1][ch] = Mpy_32_32( c_im, normVal_fx ); - move32(); - q_U_1 = sub( add( q_tmp1, q_tmp2 ), 31 ); - - IF( q_U_2 != 0 ) - { - IF( LT_16( q_U_1, q_U_2 ) ) - { - Ure_fx[1][ch - 1] = L_shr( Ure_fx[1][ch - 1], sub( q_U_2, q_U_1 ) ); - Ure_fx[0][ch - 1] = L_shr( Ure_fx[0][ch - 1], sub( q_U_2, q_U_1 ) ); - Uim_fx[0][ch - 1] = L_shr( Uim_fx[0][ch - 1], sub( q_U_2, q_U_1 ) ); - q_U_2 = q_U_1; - move32(); - move32(); - move32(); - move16(); - } - ELSE IF( GT_16( q_U_1, q_U_2 ) ) - { - Ure_fx[1][ch] = L_shr( Ure_fx[1][ch], sub( q_U_1, q_U_2 ) ); - Ure_fx[0][ch] = L_shr( Ure_fx[0][ch], sub( q_U_1, q_U_2 ) ); - Uim_fx[1][ch] = L_shr( Uim_fx[1][ch], sub( q_U_1, q_U_2 ) ); - q_U_1 = q_U_2; - move32(); - move32(); - move32(); - move16(); - } - } - q_U_2 = q_U_1; - move16(); - } - ELSE - { - s_fx = tmp1; - move32(); - - exp = sub( norm_l( s_fx ), 1 ); - tmp2 = Mpy_32_32( s_fx, s_fx ); - q_tmp2 = sub( add( q_tmp1, q_tmp1 ), 31 ); - - tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &q_tmp2 ); - q_tmp2 = sub( 31, q_tmp2 ); - - tmp3 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), epsilon_mant, epsilon_exp, &exp_tmp3 ); - - tmp2 = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q30, tmp3, &exp ); - exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); - normVal_fx = Sqrt32( tmp2, &exp ); // q_tmp2 - q_tmp2 = sub( 31, exp ); - - IF( LT_16( q_tmp1, q_c ) ) - { - c_re = L_shr( c_re, sub( q_c, q_tmp1 ) ); - c_im = L_shr( c_im, sub( q_c, q_tmp1 ) ); - q_c = q_tmp1; - move16(); - } - ELSE - { - s_fx = L_shr( s_fx, sub( q_tmp1, q_c ) ); - q_tmp1 = q_c; - move16(); - } - - Ure_fx[1][ch] = Mpy_32_32( s_fx, normVal_fx ); - move32(); - Ure_fx[0][ch] = Mpy_32_32( c_re, normVal_fx ); - move32(); - Uim_fx[0][ch] = Mpy_32_32( -c_im, normVal_fx ); - move32(); - q_U_2 = sub( add( q_tmp1, q_tmp2 ), 31 ); - - IF( q_U_1 != 0 ) - { - IF( LT_16( q_U_1, q_U_2 ) ) - { - Ure_fx[1][ch] = L_shr( Ure_fx[1][ch], sub( q_U_2, q_U_1 ) ); - Ure_fx[0][ch] = L_shr( Ure_fx[0][ch], sub( q_U_2, q_U_1 ) ); - Uim_fx[0][ch] = L_shr( Uim_fx[0][ch], sub( q_U_2, q_U_1 ) ); - q_U_2 = q_U_1; - move32(); - move32(); - move32(); - move16(); - } - ELSE IF( GT_16( q_U_1, q_U_2 ) ) - { - Ure_fx[1][ch - 1] = L_shr( Ure_fx[1][ch - 1], sub( q_U_1, q_U_2 ) ); - Ure_fx[0][ch - 1] = L_shr( Ure_fx[0][ch - 1], sub( q_U_1, q_U_2 ) ); - Uim_fx[1][ch - 1] = L_shr( Uim_fx[1][ch - 1], sub( q_U_1, q_U_2 ) ); - q_U_1 = q_U_2; - move32(); - move32(); - move32(); - move16(); - } - } - q_U_1 = q_U_2; - move16(); - } - } -#endif /* OPT_SBA_REND_V1_BE */ if ( q_U_1 != 0 ) { diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 1f2555dc6..05c27811f 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -2561,10 +2561,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( move16(); move16(); -#ifdef OPT_SBA_REND_V1_BE Word32 cmp = W_shl_sat_l( DIRAC_GAIN_LIMIT_Q26, sub( h_dirac_output_synthesis_state->gains_dir_prev_q, 26 ) ); Word32 cmp2 = W_extract_h( W_shl( W_mult_32_32( DIRAC_GAIN_LIMIT_Q26, L_shl( 1, h_dirac_output_synthesis_state->gains_diff_prev_q ) ), Q5 ) ); -#endif /* OPT_SBA_REND_V1_BE */ FOR( k = 0; k < nchan_out_woLFE; k++ ) { @@ -2605,19 +2603,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( *( p_gains_dir ) = 0; move32(); } -#ifdef OPT_SBA_REND_V1_BE ELSE IF( GT_32( *( p_gains_dir ), cmp ) ) { *( p_gains_dir ) = cmp; /*26 + h_dirac_output_synthesis_state->gains_dir_prev_q + 1 + 5 - 32 -> h_dirac_output_synthesis_state->gains_dir_prev_q*/ move32(); } -#else /* OPT_SBA_REND_V1_BE */ - ELSE IF( GT_32( *( p_gains_dir ), W_extract_h( W_shl( W_mult_32_32( DIRAC_GAIN_LIMIT_Q26, L_shl( 1, h_dirac_output_synthesis_state->gains_dir_prev_q ) ), Q5 ) ) ) ) - { - *( p_gains_dir ) = W_extract_h( W_shl( W_mult_32_32( DIRAC_GAIN_LIMIT_Q26, L_shl( 1, h_dirac_output_synthesis_state->gains_dir_prev_q ) ), Q5 ) ); /*26 + h_dirac_output_synthesis_state->gains_dir_prev_q + 1 + 5 - 32 -> h_dirac_output_synthesis_state->gains_dir_prev_q*/ - move32(); - } -#endif /* OPT_SBA_REND_V1_BE */ IF( *( p_cy_cross_dir_smooth_prev++ ) < 0 ) { @@ -2650,19 +2640,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( *( p_gains_diff ) = 0; move32(); } -#ifdef OPT_SBA_REND_V1_BE ELSE IF( GT_32( *( p_gains_diff ), cmp2 ) ) /*h_dirac_output_synthesis_state->gains_diff_prev_q*/ { *( p_gains_diff ) = cmp2; /*h_dirac_output_synthesis_state->gains_diff_prev_q*/ move32(); } -#else /* OPT_SBA_REND_V1_BE */ - ELSE IF( GT_32( *( p_gains_diff ), W_extract_h( W_shl( W_mult_32_32( DIRAC_GAIN_LIMIT_Q26, L_shl( 1, h_dirac_output_synthesis_state->gains_diff_prev_q ) ), Q5 ) ) ) ) /*h_dirac_output_synthesis_state->gains_diff_prev_q*/ - { - *( p_gains_diff ) = W_extract_h( W_shl( W_mult_32_32( DIRAC_GAIN_LIMIT_Q26, L_shl( 1, h_dirac_output_synthesis_state->gains_diff_prev_q ) ), Q5 ) ); /*h_dirac_output_synthesis_state->gains_diff_prev_q*/ - move32(); - } -#endif /* OPT_SBA_REND_V1_BE */ p_gains_diff++; } @@ -2673,25 +2655,15 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( g1 = alpha[l]; // Q31 move32(); g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 -#ifdef OPT_SBA_REND_V1_BE W_temp = W_mac_32_32( W_mult_32_32( g1, ( *( p_cy_auto_dir_smooth++ ) ) ), g2, ( *( p_cy_auto_dir_smooth_prev ) ) ); /*32+q_cy_auto_dir_smooth_prev_local*/ -#else /* OPT_SBA_REND_V1_BE */ - W_temp = W_add( W_mult_32_32( g1, ( *( p_cy_auto_dir_smooth++ ) ) ), - W_mult_32_32( g2, ( *( p_cy_auto_dir_smooth_prev ) ) ) ); /*32+q_cy_auto_dir_smooth_prev_local*/ -#endif /* OPT_SBA_REND_V1_BE */ q_tmp = W_norm( W_temp ); L_tmp = W_extract_h( W_shl( W_temp, q_tmp ) ); // q_cy_auto_dir_smooth_prev_local + q_tmp *( p_cy_auto_dir_smooth_prev++ ) = L_shr_r( L_tmp, q_tmp ); // q_cy_auto_dir_smooth_prev_local move32(); -#ifdef OPT_SBA_REND_V1_BE *( p_cy_cross_dir_smooth_prev ) = Madd_32_32( Mpy_32_32( g1, ( *( p_cy_cross_dir_smooth ) ) ), g2, ( *( p_cy_cross_dir_smooth_prev ) ) ); // (Q31, q_cy_cross_dir_smooth_prev) -> q_cy_cross_dir_smooth_prev -#else /* OPT_SBA_REND_V1_BE */ - *( p_cy_cross_dir_smooth_prev ) = L_add( Mpy_32_32( g1, ( *( p_cy_cross_dir_smooth ) ) ), - Mpy_32_32( g2, ( *( p_cy_cross_dir_smooth_prev ) ) ) ); // (Q31, q_cy_cross_dir_smooth_prev) -> q_cy_cross_dir_smooth_prev -#endif /* OPT_SBA_REND_V1_BE */ move32(); test(); if ( *( p_cy_cross_dir_smooth_prev ) == 0 && ( *( p_cy_cross_dir_smooth ) != 0 ) ) @@ -2717,19 +2689,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( *( p_gains_dir ) = 0; move32(); } -#ifdef OPT_SBA_REND_V1_BE ELSE IF( GT_32( *( p_gains_dir ), cmp ) ) /*gains_dir_prev_q*/ { *( p_gains_dir ) = cmp; /*gains_dir_prev_q*/ move32(); } -#else /* OPT_SBA_REND_V1_BE */ - ELSE IF( GT_32( *( p_gains_dir ), W_extract_h( W_shl( W_mult_32_32( DIRAC_GAIN_LIMIT_Q26, L_shl( 1, h_dirac_output_synthesis_state->gains_dir_prev_q ) ), Q5 ) ) ) ) /*gains_dir_prev_q*/ - { - *( p_gains_dir ) = W_extract_h( W_shl( W_mult_32_32( DIRAC_GAIN_LIMIT_Q26, L_shl( 1, h_dirac_output_synthesis_state->gains_dir_prev_q ) ), Q5 ) ); /*gains_dir_prev_q*/ - move32(); - } -#endif /* OPT_SBA_REND_V1_BE */ IF( *( p_cy_cross_dir_smooth_prev++ ) < 0 ) { @@ -2810,11 +2774,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( shl( i_mult( proto_direct_index[k], num_freq_bands ), Q1 ); FOR( l = 0; l < num_freq_bands; l++ ) { -#ifdef OPT_SBA_REND_V1_BE g = Madd_32_32( Mpy_32_32( g1, *( p_gain_1++ ) ), g2, *( p_gain_2++ ) ); // (Q31, gains_dir_prev_q) -> gains_dir_prev_q -#else /* OPT_SBA_REND_V1_BE */ - g = L_add( Mpy_32_32( g1, *( p_gain_1++ ) ), Mpy_32_32( g2, *( p_gain_2++ ) ) ); // (Q31, gains_dir_prev_q) -> gains_dir_prev_q -#endif /* OPT_SBA_REND_V1_BE */ Cldfb_RealBuffer64_fx[k][buf_idx][l] = W_mult0_32_32( g, ( *( p_power_smooth++ ) ) ); // (gains_dir_prev_q, q_proto_direct_buffer) -> gains_dir_prev_q + q_proto_direct_buffer move64(); @@ -2836,12 +2796,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( { FOR( l = 0; l < h_dirac_output_synthesis_params->max_band_decorr; l++ ) { -#ifdef OPT_SBA_REND_V1_BE g = Madd_32_32( Mpy_32_32( g1, *( p_gain_1++ ) ), g2, *( p_gain_2++ ) ); // (Q31, gains_diff_prev_q) -> gains_diff_prev_q -#else /* OPT_SBA_REND_V1_BE */ - g = L_add( Mpy_32_32( g1, *( p_gain_1++ ) ), Mpy_32_32( g2, *( p_gain_2++ ) ) ); // (Q31, gains_diff_prev_q) -> gains_diff_prev_q - -#endif /* OPT_SBA_REND_V1_BE */ Cldfb_RealBuffer64_fx[k][buf_idx][l] = W_add( Cldfb_RealBuffer64_fx[k][buf_idx][l], W_shr( W_mult0_32_32( g, ( *( p_power_smooth_diff++ ) ) ), negate( q_align ) ) ); // (gains_diff_prev_q, q_proto_direct_buffer) -> gains_diff_prev_q + q_proto_direct_buffer move64(); @@ -2890,9 +2845,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( } } q_align = W_norm( W_temp ); -#ifdef OPT_SBA_REND_V1_BE Word16 shift = sub( q_align, 32 ); -#endif /* OPT_SBA_REND_V1_BE */ FOR( buf_idx = 0; buf_idx < nbslots; ++buf_idx ) { @@ -2900,17 +2853,10 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( { FOR( l = 0; l < num_freq_bands; l++ ) { -#ifdef OPT_SBA_REND_V1_BE RealBuffer[k][buf_idx][l] = W_shl_sat_l( Cldfb_RealBuffer64_fx[k][buf_idx][l], shift ); /*( ( ( h_dirac_output_synthesis_state->proto_direct_buffer_f_q+h_dirac_output_synthesis_state->gains_dir_prev_q )+ q_align )- 32 )*/ move32(); ImagBuffer[k][buf_idx][l] = W_shl_sat_l( Cldfb_ImagBuffer64_fx[k][buf_idx][l], shift ); /*( ( ( h_dirac_output_synthesis_state->proto_direct_buffer_f_q+h_dirac_output_synthesis_state->gains_dir_prev_q )+ q_align )- 32 )*/ move32(); -#else /* OPT_SBA_REND_V1_BE */ - RealBuffer[k][buf_idx][l] = W_extract_h( W_shl( Cldfb_RealBuffer64_fx[k][buf_idx][l], q_align ) ); /*( ( ( h_dirac_output_synthesis_state->proto_direct_buffer_f_q+h_dirac_output_synthesis_state->gains_dir_prev_q )+ q_align )- 32 )*/ - move32(); - ImagBuffer[k][buf_idx][l] = W_extract_h( W_shl( Cldfb_ImagBuffer64_fx[k][buf_idx][l], q_align ) ); /*( ( ( h_dirac_output_synthesis_state->proto_direct_buffer_f_q+h_dirac_output_synthesis_state->gains_dir_prev_q )+ q_align )- 32 )*/ - move32(); -#endif /* OPT_SBA_REND_V1_BE */ } } } diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 994074913..e67287c42 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -2755,26 +2755,9 @@ void protoSignalComputation4_fx( sq_tmp_fx = Madd_32_32( Mpy_32_32( proto_frame_f_fx[idx], proto_frame_f_fx[idx] ), proto_frame_f_fx[idx + 1], proto_frame_f_fx[idx + 1] ); // 2*(proto_frame_f_q)-31 sq_tmp_q = sub( add( *proto_frame_f_q, *proto_frame_f_q ), 31 ); -#ifdef OPT_SBA_REND_V1_BE proto_power_smooth_fx_q = s_min( *proto_power_smooth_q, sq_tmp_q ); proto_power_smooth_fx[l + ( k * num_freq_bands )] = L_add( L_shr( proto_power_smooth_fx[l + ( k * num_freq_bands )], sub( *proto_power_smooth_q, proto_power_smooth_fx_q ) ), L_shr( sq_tmp_fx, sub( sq_tmp_q, proto_power_smooth_fx_q ) ) ); // proto_power_smooth_fx_q -#else /* OPT_SBA_REND_V1_BE */ - IF( LT_16( *proto_power_smooth_q, sq_tmp_q ) ) - { - proto_power_smooth_fx[l + ( k * num_freq_bands )] = L_add( proto_power_smooth_fx[l + ( k * num_freq_bands )], L_shr( sq_tmp_fx, sub( sq_tmp_q, *proto_power_smooth_q ) ) ); // proto_power_smooth_q - move32(); - proto_power_smooth_fx_q = *proto_power_smooth_q; - move16(); - } - ELSE - { - proto_power_smooth_fx[l + ( k * num_freq_bands )] = L_add( L_shr( proto_power_smooth_fx[l + ( k * num_freq_bands )], sub( *proto_power_smooth_q, sq_tmp_q ) ), sq_tmp_fx ); // sq_tmp_q - move32(); - proto_power_smooth_fx_q = sq_tmp_q; - move16(); - } -#endif /* OPT_SBA_REND_V1_BE */ p_proto_buffer_fx[idx] = proto_frame_f_fx[idx]; // proto_frame_f_q move32(); p_proto_buffer_fx[idx + 1] = proto_frame_f_fx[idx + 1]; // proto_frame_f_q diff --git a/lib_rend/ivas_efap_fx.c b/lib_rend/ivas_efap_fx.c index 3a2092294..8afef5e39 100644 --- a/lib_rend/ivas_efap_fx.c +++ b/lib_rend/ivas_efap_fx.c @@ -2492,11 +2492,7 @@ static Word16 in_tri_fx( v_sub_fixed_no_hdrm( C, A, tmpDot2, 2 ); // tmpDot2 q22 /* Verification of the non-colinearity : Q22 * Q22 = Q13 */ -#ifdef OPT_SBA_REND_V1_BE invFactor = Msub_32_32( Mpy_32_32( tmpDot1[0], tmpDot2[1] ), tmpDot1[1], tmpDot2[0] ); /*q22+q22-q31->q13*/ -#else /* OPT_SBA_REND_V1_BE */ - invFactor = L_sub( Mpy_32_32( tmpDot1[0], tmpDot2[1] ), Mpy_32_32( tmpDot1[1], tmpDot2[0] ) ); /*q22+q22-q31->q13*/ -#endif /* OPT_SBA_REND_V1_BE */ IF( invFactor == 0 ) { diff --git a/lib_rend/ivas_vbap_fx.c b/lib_rend/ivas_vbap_fx.c index cfcbc6760..6ebaf3b4d 100644 --- a/lib_rend/ivas_vbap_fx.c +++ b/lib_rend/ivas_vbap_fx.c @@ -578,11 +578,7 @@ void vbap_determine_gains_fx( move32(); FOR( ch = 0; ch < 3; ch++ ) { -#ifdef OPT_SBA_REND_V1_BE gain_ene_fx = Madd_32_32( gain_ene_fx, gain_triplet_fx[ch], gain_triplet_fx[ch] ); /* Q(2 * VBAP_VS_TRIPLET.q_inverse_matrix - 31) */ -#else /* OPT_SBA_REND_V1_BE */ - gain_ene_fx = L_add( gain_ene_fx, Mpy_32_32( gain_triplet_fx[ch], gain_triplet_fx[ch] ) ); /* Q(2 * VBAP_VS_TRIPLET.q_inverse_matrix - 31) */ -#endif /* OPT_SBA_REND_V1_BE */ } norm_value_fx = Isqrt( L_shr( gain_ene_fx, 1 ) ); /* Q(31 - (2 * VBAP_VS_TRIPLET.q_inverse_matrix - 31 - 1) / 2 ) = Q(47 - VBAP_VS_TRIPLET.q_inverse_matrix) */ @@ -685,7 +681,6 @@ static UWord8 vector_matrix_multiply_3x3_fx( Word32 *result, /* o : output vector Q(q_matrix) */ Word16 q_matrix ) { -#ifdef OPT_SBA_REND_V1_BE Word32 pointzero_one = Mpy_32_16_1( L_lshl( 1, q_matrix ), -327 /* -0.01 in Q15 */ ); result[0] = Madd_32_16( Madd_32_16( Mpy_32_16_1( matrix[0][0], src_vector[0] ), matrix[1][0], src_vector[1] ), matrix[2][0], src_vector[2] ); /* Q(q_matrix) */ move32(); @@ -710,43 +705,6 @@ static UWord8 vector_matrix_multiply_3x3_fx( { return 0; } -#else /* OPT_SBA_REND_V1_BE */ - result[0] = Mpy_32_16_1( matrix[0][0], src_vector[0] ); /* Q(q_matrix) */ - result[0] = L_add( result[0], Mpy_32_16_1( matrix[1][0], src_vector[1] ) ); /* Q(q_matrix) */ - result[0] = L_add( result[0], Mpy_32_16_1( matrix[2][0], src_vector[2] ) ); /* Q(q_matrix) */ - move32(); - move32(); - move32(); - - IF( LT_32( result[0], Mpy_32_16_1( L_lshl( 1, q_matrix ), -327 /* -0.01 in Q15 */ ) ) ) - { - return 0; - } - - result[1] = Mpy_32_16_1( matrix[0][1], src_vector[0] ); /* Q(q_matrix) */ - result[1] = L_add( result[1], Mpy_32_16_1( matrix[1][1], src_vector[1] ) ); /* Q(q_matrix) */ - result[1] = L_add( result[1], Mpy_32_16_1( matrix[2][1], src_vector[2] ) ); /* Q(q_matrix) */ - move32(); - move32(); - move32(); - - IF( LT_32( result[1], Mpy_32_16_1( L_shl( 1, q_matrix ), -327 /* -0.01 in Q15 */ ) ) ) - { - return 0; - } - - result[2] = Mpy_32_16_1( matrix[0][2], src_vector[0] ); /* Q(q_matrix) */ - result[2] = L_add( result[2], Mpy_32_16_1( matrix[1][2], src_vector[1] ) ); /* Q(q_matrix) */ - result[2] = L_add( result[2], Mpy_32_16_1( matrix[2][2], src_vector[2] ) ); /* Q(q_matrix) */ - move32(); - move32(); - move32(); - - IF( LT_32( result[2], Mpy_32_16_1( L_shl( 1, q_matrix ), -327 /* -0.01 in Q15 */ ) ) ) - { - return 0; - } -#endif /* OPT_SBA_REND_V1_BE */ return 1; } -- GitLab From d56119b2fd0ab2c96463caf7820c6e7b56bc1cb5 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:50:16 +0200 Subject: [PATCH 13/35] [cleanup] accept OPT_HEAD_ROT_REND_V1_BE --- lib_com/options.h | 1 - lib_rend/ivas_rotation_fx.c | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index f4913b409..ac7a8f71a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,7 +77,6 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE #define OPT_BIN_REND_V2_NBE -#define OPT_HEAD_ROT_REND_V1_BE #define OPT_SBA_DEC_V2_BE #define OPT_SBA_ENC_V2_BE #define OPT_SBA_ENC_V2_NBE diff --git a/lib_rend/ivas_rotation_fx.c b/lib_rend/ivas_rotation_fx.c index 5d2f393bb..22786c76c 100644 --- a/lib_rend/ivas_rotation_fx.c +++ b/lib_rend/ivas_rotation_fx.c @@ -1010,9 +1010,6 @@ void rotateFrame_shd_cldfb( Word16 l = 0, m1 = 0, m2 = 0; Word32 realRot[2 * HEADROT_ORDER + 1], imagRot[2 * HEADROT_ORDER + 1]; Word16 SHrotmat[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; -#ifndef OPT_HEAD_ROT_REND_V1_BE - Word32 temp1, temp2; -#endif /* OPT_HEAD_ROT_REND_V1_BE */ move16(); move16(); move16(); @@ -1061,19 +1058,10 @@ void rotateFrame_shd_cldfb( move32(); FOR( m = m1; m < m2; m++ ) { -#ifdef OPT_HEAD_ROT_REND_V1_BE realRot[n - m1] = Madd_32_16_r( realRot[n - m1], Cldfb_RealBuffer[m][i][iBand], SHrotmat[n][m] ); // Q(x + 14 - 15) move32(); imagRot[n - m1] = Madd_32_16_r( imagRot[n - m1], Cldfb_ImagBuffer[m][i][iBand], SHrotmat[n][m] ); // Q(x + 14 - 15) move32(); -#else /* OPT_HEAD_ROT_REND_V1_BE */ - temp1 = Mpy_32_16_r( Cldfb_RealBuffer[m][i][iBand], SHrotmat[n][m] ); // Q(x + 14 - 15) - temp2 = Mpy_32_16_r( Cldfb_ImagBuffer[m][i][iBand], SHrotmat[n][m] ); // Q(x + 14 - 15) - realRot[n - m1] = L_add( temp1, realRot[n - m1] ); // Q(x + 14 - 15) - move32(); - imagRot[n - m1] = L_add( temp2, imagRot[n - m1] ); // Q(x + 14 - 15) - move32(); -#endif /* OPT_HEAD_ROT_REND_V1_BE */ } } /* write back the result */ -- GitLab From 53fee1dd65697a76e776ee3fa29dd45c840903e3 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:51:07 +0200 Subject: [PATCH 14/35] [cleanup] accept OPT_SBA_DEC_V2_BE --- lib_com/options.h | 1 - lib_dec/dec_tcx_fx.c | 18 --------- lib_dec/ivas_binRenderer_internal_fx.c | 15 ------- lib_dec/ivas_dirac_output_synthesis_cov_fx.c | 5 --- lib_dec/ivas_spar_decoder_fx.c | 42 -------------------- lib_dec/ivas_spar_md_dec_fx.c | 15 ------- 6 files changed, 96 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index ac7a8f71a..4764d45bc 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,7 +77,6 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE #define OPT_BIN_REND_V2_NBE -#define OPT_SBA_DEC_V2_BE #define OPT_SBA_ENC_V2_BE #define OPT_SBA_ENC_V2_NBE #define OPT_SBA_ENC_V1_BE diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 1e1ca2cb8..850aed602 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3044,16 +3044,10 @@ void IMDCT_ivas_fx( Word32 fac; // fac = shl_sat( mult_r( extract_h( L_shr_sat( hTcxDec->conceal_eof_gain32, sub( 1, hTcxDec->conceal_eof_gain_e ) ) ), st->last_concealed_gain_syn_deemph ), 1 ); fac = Mpy_32_16_1( hTcxDec->conceal_eof_gain32, st->last_concealed_gain_syn_deemph ); // q = 31 - hTcxDec->conceal_eof_gain_e - last_concealed_gain_syn_deemph_e -#ifdef OPT_SBA_DEC_V2_BE Word16 eff_e = add( hTcxDec->conceal_eof_gain_e, st->last_concealed_gain_syn_deemph_e ); -#endif /* OPT_SBA_DEC_V2_BE */ FOR( Word16 ind = 0; ind < overlap; ind++ ) { -#ifdef OPT_SBA_DEC_V2_BE old_syn_overl_fx[ind] = extract_h( L_shl_sat( Mpy_32_16_1( fac, old_syn_overl_fx[ind] ), eff_e ) ); // Q(-2) -#else /* OPT_SBA_DEC_V2_BE */ - old_syn_overl_fx[ind] = extract_h( L_shl_sat( Mpy_32_16_1( fac, old_syn_overl_fx[ind] ), add( hTcxDec->conceal_eof_gain_e, st->last_concealed_gain_syn_deemph_e ) ) ); // Q(-2) -#endif /* OPT_SBA_DEC_V2_BE */ move16(); } } @@ -5455,16 +5449,10 @@ void decoder_tcx_noiseshaping_igf_fx( { /* If the exponent on the spec side (i>L_frame) is lesser, then shift all the values in the spec side by the difference to make both sides have the same exponent. */ -#ifdef OPT_SBA_DEC_V2_BE Word16 diff_e = sub( frame_side_x_e, spec_side_x_e ); -#endif /* OPT_SBA_DEC_V2_BE */ FOR( i = L_frame; i < L_spec; i++ ) { -#ifdef OPT_SBA_DEC_V2_BE x_fx[i] = L_shr( x_fx[i], diff_e ); -#else /* OPT_SBA_DEC_V2_BE */ - x_fx[i] = L_shr( x_fx[i], sub( frame_side_x_e, spec_side_x_e ) ); -#endif /* OPT_SBA_DEC_V2_BE */ move32(); } } @@ -5472,16 +5460,10 @@ void decoder_tcx_noiseshaping_igf_fx( { /* If the exponent on the spec side (i>L_frame) is greater, then shift all the values in the frame side (iconv_band ); FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) @@ -1981,7 +1967,6 @@ void ivas_binRenderer_fx( set32_fx( &Cldfb_ImagBuffer_Binaural_fx[pos_idx][1][k][hBinRenderer->conv_band], 0, len ); } } -#endif /* OPT_SBA_DEC_V2_BE */ pop_wmops(); return; diff --git a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c index 6450d514d..14c662543 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c @@ -610,13 +610,8 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( temp_imag = W_mac_32_32( temp_imag, mixing_matrix_res_smooth_fx[idx], diff_f_imag_fx[i] ); idx += nY; } -#ifdef OPT_SBA_DEC_V2_BE Cldfb_RealBuffer_fx[ch_idx][slot_idx_sfr][band] = W_shl_sat_l( temp_real, shifter ); Cldfb_ImagBuffer_fx[ch_idx][slot_idx_sfr][band] = W_shl_sat_l( temp_imag, shifter ); -#else /* OPT_SBA_DEC_V2_BE */ - Cldfb_RealBuffer_fx[ch_idx][slot_idx_sfr][band] = W_extract_l( W_shr( temp_real, shifter ) ); - Cldfb_ImagBuffer_fx[ch_idx][slot_idx_sfr][band] = W_extract_l( W_shr( temp_imag, shifter ) ); -#endif /* OPT_SBA_DEC_V2_BE */ } } } diff --git a/lib_dec/ivas_spar_decoder_fx.c b/lib_dec/ivas_spar_decoder_fx.c index 4a95f4d35..29defd7f2 100644 --- a/lib_dec/ivas_spar_decoder_fx.c +++ b/lib_dec/ivas_spar_decoder_fx.c @@ -1159,7 +1159,6 @@ void ivas_spar_get_parameters_fx( move16(); Word16 add_weight_fx = sub( MAX_WORD16, weight_fx ); Word16 add_weight_20ms_fx = sub( MAX_WORD16, weight_20ms_fx ); -#ifdef OPT_SBA_DEC_V2_BE Word16 out_flag[IVAS_MAX_FB_MIXER_OUT_CH]; Word32 band_bool = LT_16( split_band, IVAS_MAX_NUM_BANDS ); @@ -1221,47 +1220,6 @@ void ivas_spar_get_parameters_fx( } } } -#else /* OPT_SBA_DEC_V2_BE */ - FOR( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) - { - FOR( out_ch = 0; out_ch < num_ch_out; out_ch++ ) - { - test(); - IF( LT_16( split_band, IVAS_MAX_NUM_BANDS ) - /* 20ms cross-fade for Transport channels in all frequency bands */ - && ( 0 == ivas_is_res_channel( out_ch, hSpar->hMdDec->spar_md_cfg.nchan_transport ) ) /* sub-frame processing for missing channels in all frequency bands*/ - ) - { - FOR( in_ch = 0; in_ch < num_ch_in; in_ch++ ) - { - IF( GT_16( hSpar->i_subframe, 3 ) ) - { - par_mat_fx[out_ch][in_ch][spar_band] = Madd_32_16( Mpy_32_16_1( hSpar->hMdDec->mixer_mat_prev_fx[ts1][out_ch][in_ch][spar_band], weight_fx ), - hSpar->hMdDec->mixer_mat_prev_fx[ts0][out_ch][in_ch][spar_band], add_weight_fx ); - move32(); - } - ELSE - { - par_mat_fx[out_ch][in_ch][spar_band] = hSpar->hMdDec->mixer_mat_fx[out_ch][in_ch][spar_band]; /*hSpar->hMdDec->Q_mixer_mat*/ - move32(); - } - } - } - ELSE - { - FOR( in_ch = 0; in_ch < num_ch_in; in_ch++ ) - { - /* 20ms Transport channel reconstruction with matching encoder/decoder processing */ - Word16 prev_idx = SPAR_DIRAC_SPLIT_START_BAND < IVAS_MAX_NUM_BANDS ? 1 : 0; /* if SPAR_DIRAC_SPLIT_START_BAND == IVAS_MAX_NUM_BANDS, then the sub-frame mixer_mat delay line is not active */ - move16(); - par_mat_fx[out_ch][in_ch][spar_band] = Madd_32_16( Mpy_32_16_1( hSpar->hMdDec->mixer_mat_prev_fx[prev_idx][out_ch][in_ch][spar_band], add_weight_20ms_fx ), - hSpar->hMdDec->mixer_mat_fx[out_ch][in_ch][spar_band], weight_20ms_fx ); /*hSpar->hMdDec->Q_mixer_mat*/ - move32(); - } - } - } - } -#endif /* OPT_SBA_DEC_V2_BE */ return; } diff --git a/lib_dec/ivas_spar_md_dec_fx.c b/lib_dec/ivas_spar_md_dec_fx.c index fdb29e842..523810feb 100644 --- a/lib_dec/ivas_spar_md_dec_fx.c +++ b/lib_dec/ivas_spar_md_dec_fx.c @@ -1321,23 +1321,12 @@ static void ivas_get_spar_matrices_fx( tmp_C2_re_fx[0][j] = Mpy_32_32( active_w_dm_fac_fx, L_negate( hMdDec->spar_md.band_coeffs[( b + ( i_ts * IVAS_MAX_NUM_BANDS ) )].pred_re_fx[j - 1] ) ); // Q31 *Q22=Q22 move32(); } -#ifdef OPT_SBA_DEC_V2_BE re_fx1 = Madd_32_32( ONE_IN_Q13, tmp_C2_re_fx[0][1], tmp_C1_re_fx[1][0] ); // Q13+Q13 re_fx1 = Madd_32_32( re_fx1, tmp_C2_re_fx[0][2], tmp_C1_re_fx[2][0] ); // Q13+Q13 tmp_dm_re_fx[0][0] = L_shl( Madd_32_32( re_fx1, tmp_C2_re_fx[0][3], tmp_C1_re_fx[3][0] ), Q9 ); // (Q13+Q13) << Q9 = Q22; // -#else /* OPT_SBA_DEC_V2_BE */ - re_fx = Mpy_32_32( tmp_C2_re_fx[0][1], tmp_C1_re_fx[1][0] ); // Q22 *Q22 =Q13 - re_fx1 = L_add( ONE_IN_Q13, re_fx ); // Q13+Q13 - - re_fx = Mpy_32_32( tmp_C2_re_fx[0][2], tmp_C1_re_fx[2][0] ); // Q22 *Q22 =Q13 - re_fx1 = L_add( re_fx1, re_fx ); // Q13+Q13 - - re_fx = Mpy_32_32( tmp_C2_re_fx[0][3], tmp_C1_re_fx[3][0] ); // Q22 *Q22 =Q13 - tmp_dm_re_fx[0][0] = L_shl( L_add( re_fx1, re_fx ), Q9 ); // (Q13+Q13) << Q9 = Q22; -#endif /* OPT_SBA_DEC_V2_BE */ move32(); IF( EQ_16( dyn_active_w_flag, 1 ) ) @@ -1413,11 +1402,7 @@ static void ivas_get_spar_matrices_fx( { FOR( k = dmx_ch; k < numch_out; k++ ) { -#ifndef OPT_SBA_DEC_V2_BE - IF( EQ_16( sub( j, dmx_ch ), sub( k, dmx_ch ) ) ) -#else /* OPT_SBA_DEC_V2_BE */ IF( EQ_16( j, k ) ) -#endif /* OPT_SBA_DEC_V2_BE */ { tmpP_re_fx[j][k] = hMdDec->spar_md.band_coeffs[add( b, i_mult( i_ts, IVAS_MAX_NUM_BANDS ) )].P_re_fx[sub( k, dmx_ch )]; // Q22 move32(); -- GitLab From 4d402204af8053dd0b60ff0f740968804d18b570 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:52:55 +0200 Subject: [PATCH 15/35] [cleanup] accept OPT_SBA_ENC_V2_BE, OPT_SBA_ENC_V2_NBE, OPT_SBA_ENC_V1_BE --- lib_com/interpol_fx.c | 6 -- lib_com/ivas_dirac_com_fx.c | 162 +--------------------------- lib_com/ivas_fb_mixer_fx.c | 42 -------- lib_com/ivas_spar_com_fx.c | 171 ------------------------------ lib_com/options.h | 3 - lib_enc/ACcontextMapping_enc_fx.c | 143 ------------------------- lib_enc/ivas_enc_cov_handler_fx.c | 54 ---------- 7 files changed, 1 insertion(+), 580 deletions(-) diff --git a/lib_com/interpol_fx.c b/lib_com/interpol_fx.c index 030d41735..abcc6092f 100644 --- a/lib_com/interpol_fx.c +++ b/lib_com/interpol_fx.c @@ -70,14 +70,8 @@ Word32 Interpol_lc_fx( /* o : interpolated value c2 += up_samp; /* move16() not needed, since the coefficient can be rearrange in bit exact way */ c1 += up_samp; } -#ifdef OPT_SBA_ENC_V2_BE L_sum = W_shl_sat_l( L_sum64, 1 ); /*Q15*/ } -#else - L_sum = W_sat_l( L_sum64 ); /*Q14*/ - } - L_sum = L_shl_sat( L_sum, 1 ); /*Q15*/ -#endif return L_sum; } diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 59735c9c5..4b586b7bf 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -1114,7 +1114,6 @@ void calculate_hodirac_sector_parameters_fx( Word16 i_sec, i_bin, i_band; Word32 p_real_fx, p_imag_fx, normI_fx, energy_fx, tmp_diff_fx; Word16 energy_exp, normI_exp, tmp_diff_exp; -#ifdef OPT_SBA_ENC_V2_NBE Word16 tmp_exp_1 = sub( 33, shl( Qfac, 1 ) ); // 31 - (2 *Qfac - 2 ) Word16 tmp_exp_2 = sub( 35, shl( Qfac, 1 ) ); // 31 - (2 *Qfac - 4 ) Word32 tmp32_1, tmp32_2; @@ -1124,7 +1123,6 @@ void calculate_hodirac_sector_parameters_fx( move64(); move64(); move16(); -#endif Word32 sec_I_vec_x_fx[NUM_ANA_SECTORS]; Word32 sec_I_vec_y_fx[NUM_ANA_SECTORS]; @@ -1198,7 +1196,6 @@ void calculate_hodirac_sector_parameters_fx( move32(); energy_exp = 0; move16(); -#ifdef OPT_SBA_ENC_V2_NBE Word64 sec_I_vec_x_64_fx = 0; Word64 sec_I_vec_y_64_fx = 0; Word64 sec_I_vec_z_64_fx = 0; @@ -1207,7 +1204,6 @@ void calculate_hodirac_sector_parameters_fx( move64(); move64(); move64(); -#endif IF( i_sec == 0 ) { FOR( i_bin = band_grouping[i_band]; i_bin < band_grouping[i_band + 1]; i_bin++ ) @@ -1216,7 +1212,6 @@ void calculate_hodirac_sector_parameters_fx( move32(); Word32 sec_w_imag_fx, sec_x_imag_fx, sec_y_imag_fx, sec_z_imag_fx; Word32 sec_w_real_fx, sec_x_real_fx, sec_y_real_fx, sec_z_real_fx; -#ifdef OPT_SBA_ENC_V2_NBE sec_w_imag_fx = Madd_32_32( Mpy_32_32( HODIRAC_FAC1, *( p_ImagBuffer_0_fx ) ), HODIRAC_FAC1, *( p_ImagBuffer_1_fx ) ); // Qfac - 2 sec_x_imag_fx = Madd_32_32( Mpy_32_32( HODIRAC_FAC1, *( p_ImagBuffer_3_fx++ ) ), HODIRAC_FAC2, *( p_ImagBuffer_4_fx++ ) ); // Qfac - 2 sec_y_imag_fx = Msub_32_32( ( Msub_32_32( ( Madd_32_32( Mpy_32_32( HODIRAC_FAC3, *( p_ImagBuffer_0_fx++ ) ), HODIRAC_FAC1, *( p_ImagBuffer_1_fx++ ) ) ), HODIRAC_FAC3, *( p_ImagBuffer_6_fx++ ) ) ), HODIRAC_FAC2, *( p_ImagBuffer_8_fx++ ) ); // Qfac - 2 @@ -1227,50 +1222,10 @@ void calculate_hodirac_sector_parameters_fx( sec_y_real_fx = Msub_32_32( ( Msub_32_32( Madd_32_32( Mpy_32_32( HODIRAC_FAC3, *( p_RealBuffer_0_fx++ ) ), HODIRAC_FAC1, *( p_RealBuffer_1_fx++ ) ), HODIRAC_FAC3, *( p_RealBuffer_6_fx++ ) ) ), HODIRAC_FAC2, *( p_RealBuffer_8_fx++ ) ); // Qfac - 2 sec_z_real_fx = Madd_32_32( Mpy_32_32( HODIRAC_FAC1, *( p_RealBuffer_2_fx++ ) ), HODIRAC_FAC2, *( p_RealBuffer_5_fx++ ) ); // Qfac - 2 -#else - sec_w_imag_fx = L_add( Mpy_32_32( HODIRAC_FAC1, *( p_ImagBuffer_0_fx ) ), Mpy_32_32( HODIRAC_FAC1, *( p_ImagBuffer_1_fx ) ) ); // Qfac - 2 - sec_x_imag_fx = L_add( Mpy_32_32( HODIRAC_FAC1, *( p_ImagBuffer_3_fx++ ) ), Mpy_32_32( HODIRAC_FAC2, *( p_ImagBuffer_4_fx++ ) ) ); // Qfac - 2 - sec_y_imag_fx = L_sub( L_sub( L_add( Mpy_32_32( HODIRAC_FAC3, *( p_ImagBuffer_0_fx++ ) ), Mpy_32_32( HODIRAC_FAC1, *( p_ImagBuffer_1_fx++ ) ) ), Mpy_32_32( HODIRAC_FAC3, *( p_ImagBuffer_6_fx++ ) ) ), Mpy_32_32( HODIRAC_FAC2, *( p_ImagBuffer_8_fx++ ) ) ); // Qfac - 2 - sec_z_imag_fx = L_add( Mpy_32_32( HODIRAC_FAC1, *( p_ImagBuffer_2_fx++ ) ), Mpy_32_32( HODIRAC_FAC2, *( p_ImagBuffer_5_fx++ ) ) ); // Qfac - 2 - - sec_w_real_fx = L_add( Mpy_32_32( HODIRAC_FAC1, *( p_RealBuffer_0_fx ) ), Mpy_32_32( HODIRAC_FAC1, *( p_RealBuffer_1_fx ) ) ); // Qfac - 2 - sec_x_real_fx = L_add( Mpy_32_32( HODIRAC_FAC1, *( p_RealBuffer_3_fx++ ) ), Mpy_32_32( HODIRAC_FAC2, *( p_RealBuffer_4_fx++ ) ) ); // Qfac - 2 - sec_y_real_fx = L_sub( L_sub( L_add( Mpy_32_32( HODIRAC_FAC3, *( p_RealBuffer_0_fx++ ) ), Mpy_32_32( HODIRAC_FAC1, *( p_RealBuffer_1_fx++ ) ) ), Mpy_32_32( HODIRAC_FAC3, *( p_RealBuffer_6_fx++ ) ) ), Mpy_32_32( HODIRAC_FAC2, *( p_RealBuffer_8_fx++ ) ) ); // Qfac - 2 - sec_z_real_fx = L_add( Mpy_32_32( HODIRAC_FAC1, *( p_RealBuffer_2_fx++ ) ), Mpy_32_32( HODIRAC_FAC2, *( p_RealBuffer_5_fx++ ) ) ); // Qfac - 2 -#endif - -#ifndef OPT_SBA_ENC_V2_NBE - Word16 p_q; - Word32 tmp_x, tmp_y, tmp_z; - Word16 n, n1, n2; -#endif + p_real_fx = Mpy_32_32( sec_w_real_fx, w_fx ); // ( Qfac - 2 ) + 30 - 31 = Qfac - 3 p_imag_fx = Mpy_32_32( sec_w_imag_fx, w_fx ); // ( Qfac - 2 ) + 30 - 31 = Qfac - 3 -#ifndef OPT_SBA_ENC_V2_NBE - n1 = norm_l( p_real_fx ); - n2 = norm_l( p_imag_fx ); - - n = s_min( n1, n2 ); - p_real_fx = L_shl( p_real_fx, n ); - p_imag_fx = L_shl( p_imag_fx, n ); - - p_q = add( sub( Qfac, 3 ), n ); - - Word16 tmp_exp, sec_sum_exp; - tmp_exp = sub( 66, add( p_q, Qfac ) ); // 31 - ( p_q + Qfac - 35 ) - - tmp_x = L_add( L_shr( Mpy_32_32( p_real_fx, sec_x_real_fx ), 2 ), L_shr( Mpy_32_32( p_imag_fx, sec_x_imag_fx ), 2 ) ); // p_q + ( Qfac - 2 ) - 31 - 2 = p_q + Qfac - 35 - tmp_y = L_add( L_shr( Mpy_32_32( p_real_fx, sec_y_real_fx ), 2 ), L_shr( Mpy_32_32( p_imag_fx, sec_y_imag_fx ), 2 ) ); // p_q + ( Qfac - 2 ) - 31 - 2 = p_q + Qfac - 35 - tmp_z = L_add( L_shr( Mpy_32_32( p_real_fx, sec_z_real_fx ), 2 ), L_shr( Mpy_32_32( p_imag_fx, sec_z_imag_fx ), 2 ) ); // p_q + ( Qfac - 2 ) - 31 - 2 = p_q + Qfac - 35 - - *p_sec_I_vec_x_fx = BASOP_Util_Add_Mant32Exp( *p_sec_I_vec_x_fx, *p_sec_I_vec_x_exp, tmp_x, tmp_exp, p_sec_I_vec_x_exp ); - move32(); - *p_sec_I_vec_y_fx = BASOP_Util_Add_Mant32Exp( *p_sec_I_vec_y_fx, *p_sec_I_vec_y_exp, tmp_y, tmp_exp, p_sec_I_vec_y_exp ); - move32(); - *p_sec_I_vec_z_fx = BASOP_Util_Add_Mant32Exp( *p_sec_I_vec_z_fx, *p_sec_I_vec_z_exp, tmp_z, tmp_exp, p_sec_I_vec_z_exp ); - move32(); -#else temp_x64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_x_real_fx ), p_imag_fx, sec_x_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 temp_y64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_y_real_fx ), p_imag_fx, sec_y_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 temp_z64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_z_real_fx ), p_imag_fx, sec_z_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 @@ -1279,16 +1234,7 @@ void calculate_hodirac_sector_parameters_fx( sec_I_vec_z_64_fx = W_add( sec_I_vec_z_64_fx, temp_z64 ); Word64 tmp1; -#endif Word64 tmp2, tmp3, tmp4, sec_sum64; -#ifndef OPT_SBA_ENC_V2_NBE - Word32 tmp1; - Word32 tmp5, sec_sum; - tmp_exp = sub( 62, add( p_q, p_q ) ); - - tmp1 = BASOP_Util_Add_Mant32Exp( Mpy_32_32( p_real_fx, p_real_fx ), tmp_exp, Mpy_32_32( p_imag_fx, p_imag_fx ), tmp_exp, &tmp_exp ); -#endif -#ifdef OPT_SBA_ENC_V2_NBE tmp1 = W_mac_32_32( W_mult_32_32( p_real_fx, p_real_fx ), p_imag_fx, p_imag_fx ); // 2 * (Qfac - 3) + 1 tmp1 = W_shl( tmp1, 2 ); // 2 * (Qfac - 2) + 1 tmp2 = W_mac_32_32( W_mult_32_32( sec_x_real_fx, sec_x_real_fx ), sec_x_imag_fx, sec_x_imag_fx ); // 2 * (Qfac - 2) + 1 @@ -1298,25 +1244,7 @@ void calculate_hodirac_sector_parameters_fx( // instead dividing changed Q// energy_64_fx = W_add( energy_64_fx, sec_sum64 ); // 2 * (Qfac - 2) + 1 + 1 -#else - tmp2 = W_add( W_mult0_32_32( sec_x_real_fx, sec_x_real_fx ), W_mult0_32_32( sec_x_imag_fx, sec_x_imag_fx ) ); // 2 * (Qfac - 2) - tmp3 = W_add( W_mult0_32_32( sec_y_real_fx, sec_y_real_fx ), W_mult0_32_32( sec_y_imag_fx, sec_y_imag_fx ) ); // 2 * (Qfac - 2) - tmp4 = W_add( W_mult0_32_32( sec_z_real_fx, sec_z_real_fx ), W_mult0_32_32( sec_z_imag_fx, sec_z_imag_fx ) ); // 2 * (Qfac - 2) - sec_sum64 = W_add( W_add( tmp2, tmp3 ), tmp4 ); // 2 * (Qfac - 2) - n = W_norm( sec_sum64 ); - sec_sum64 = W_shl( sec_sum64, n ); // 2 * (Qfac - 2) + n - sec_sum = W_extract_h( sec_sum64 ); // 2 * (Qfac - 2) + n - 32 = 2 * Qfac + n - 36 - sec_sum_exp = sub( 67, add( shl( Qfac, 1 ), n ) ); - - // divide by 2: - tmp1 = L_shr( tmp1, 1 ); - sec_sum = L_shr( sec_sum, 1 ); - - tmp5 = BASOP_Util_Add_Mant32Exp( tmp1, tmp_exp, sec_sum, sec_sum_exp, &tmp_exp ); - energy_fx = BASOP_Util_Add_Mant32Exp( energy_fx, energy_exp, tmp5, tmp_exp, &energy_exp ); -#endif } -#ifdef OPT_SBA_ENC_V2_NBE tmp_scale = sub( W_norm( energy_64_fx ), 32 ); energy_fx = W_shl_sat_l( energy_64_fx, tmp_scale ); energy_exp = sub( tmp_exp_1, tmp_scale ); @@ -1358,7 +1286,6 @@ void calculate_hodirac_sector_parameters_fx( *p_sec_I_vec_z_exp = 0; move16(); } -#endif } ELSE { @@ -1369,7 +1296,6 @@ void calculate_hodirac_sector_parameters_fx( Word32 sec_w_imag_fx, sec_x_imag_fx, sec_y_imag_fx, sec_z_imag_fx; Word32 sec_w_real_fx, sec_x_real_fx, sec_y_real_fx, sec_z_real_fx; -#ifdef OPT_SBA_ENC_V2_NBE sec_w_imag_fx = Msub_32_32( Mpy_32_32( HODIRAC_FAC1, *( p_ImagBuffer_0_fx ) ), HODIRAC_FAC1, *( p_ImagBuffer_1_fx ) ); // Qfac - 2 sec_x_imag_fx = Msub_32_32( Mpy_32_32( HODIRAC_FAC1, *( p_ImagBuffer_3_fx++ ) ), HODIRAC_FAC2, *( p_ImagBuffer_4_fx++ ) ); // Qfac - 2 sec_y_imag_fx = Madd_32_32( ( Madd_32_32( ( Madd_32_32( Mpy_32_32( -HODIRAC_FAC3, *( p_ImagBuffer_0_fx++ ) ), HODIRAC_FAC1, *( p_ImagBuffer_1_fx++ ) ) ), HODIRAC_FAC3, *( p_ImagBuffer_6_fx++ ) ) ), HODIRAC_FAC2, *( p_ImagBuffer_8_fx++ ) ); // Qfac - 2 @@ -1380,49 +1306,10 @@ void calculate_hodirac_sector_parameters_fx( sec_y_real_fx = Madd_32_32( ( Madd_32_32( ( Madd_32_32( Mpy_32_32( -HODIRAC_FAC3, *( p_RealBuffer_0_fx++ ) ), HODIRAC_FAC1, *( p_RealBuffer_1_fx++ ) ) ), HODIRAC_FAC3, *( p_RealBuffer_6_fx++ ) ) ), HODIRAC_FAC2, *( p_RealBuffer_8_fx++ ) ); // Qfac - 2 sec_z_real_fx = Msub_32_32( Mpy_32_32( HODIRAC_FAC1, *( p_RealBuffer_2_fx++ ) ), HODIRAC_FAC2, *( p_RealBuffer_5_fx++ ) ); // Qfac - 2 -#else - sec_w_imag_fx = L_sub( Mpy_32_32( HODIRAC_FAC1, *( p_ImagBuffer_0_fx ) ), Mpy_32_32( HODIRAC_FAC1, *( p_ImagBuffer_1_fx ) ) ); // Qfac - 2 - sec_x_imag_fx = L_sub( Mpy_32_32( HODIRAC_FAC1, *( p_ImagBuffer_3_fx++ ) ), Mpy_32_32( HODIRAC_FAC2, *( p_ImagBuffer_4_fx++ ) ) ); // Qfac - 2 - sec_y_imag_fx = L_add( L_add( L_add( Mpy_32_32( -HODIRAC_FAC3, *( p_ImagBuffer_0_fx++ ) ), Mpy_32_32( HODIRAC_FAC1, *( p_ImagBuffer_1_fx++ ) ) ), Mpy_32_32( HODIRAC_FAC3, *( p_ImagBuffer_6_fx++ ) ) ), Mpy_32_32( HODIRAC_FAC2, *( p_ImagBuffer_8_fx++ ) ) ); // Qfac - 2 - sec_z_imag_fx = L_sub( Mpy_32_32( HODIRAC_FAC1, *( p_ImagBuffer_2_fx++ ) ), Mpy_32_32( HODIRAC_FAC2, *( p_ImagBuffer_5_fx++ ) ) ); // Qfac - 2 - - sec_w_real_fx = L_sub( Mpy_32_32( HODIRAC_FAC1, *( p_RealBuffer_0_fx ) ), Mpy_32_32( HODIRAC_FAC1, *( p_RealBuffer_1_fx ) ) ); // Qfac - 2 - sec_x_real_fx = L_sub( Mpy_32_32( HODIRAC_FAC1, *( p_RealBuffer_3_fx++ ) ), Mpy_32_32( HODIRAC_FAC2, *( p_RealBuffer_4_fx++ ) ) ); // Qfac - 2 - sec_y_real_fx = L_add( L_add( L_add( Mpy_32_32( -HODIRAC_FAC3, *( p_RealBuffer_0_fx++ ) ), Mpy_32_32( HODIRAC_FAC1, *( p_RealBuffer_1_fx++ ) ) ), Mpy_32_32( HODIRAC_FAC3, *( p_RealBuffer_6_fx++ ) ) ), Mpy_32_32( HODIRAC_FAC2, *( p_RealBuffer_8_fx++ ) ) ); // Qfac - 2 - sec_z_real_fx = L_sub( Mpy_32_32( HODIRAC_FAC1, *( p_RealBuffer_2_fx++ ) ), Mpy_32_32( HODIRAC_FAC2, *( p_RealBuffer_5_fx++ ) ) ); // Qfac - 2 -#endif -#ifndef OPT_SBA_ENC_V2_NBE - Word16 p_q; - Word32 tmp_x, tmp_y, tmp_z; - Word16 n, n1, n2; -#endif p_real_fx = Mpy_32_32( sec_w_real_fx, w_fx ); // ( Qfac - 2 ) + 30 - 31 = Qfac - 3 p_imag_fx = Mpy_32_32( sec_w_imag_fx, w_fx ); // ( Qfac - 2 ) + 30 - 31 = Qfac - 3 -#ifndef OPT_SBA_ENC_V2_NBE - n1 = norm_l( p_real_fx ); - n2 = norm_l( p_imag_fx ); - - n = s_min( n1, n2 ); - p_real_fx = L_shl( p_real_fx, n ); - p_imag_fx = L_shl( p_imag_fx, n ); - - p_q = add( sub( Qfac, 3 ), n ); - - Word16 tmp_exp, sec_sum_exp; - tmp_exp = sub( 66, add( p_q, Qfac ) ); // 31 - ( p_q + Qfac - 35 ) - - tmp_x = L_add( L_shr( Mpy_32_32( p_real_fx, sec_x_real_fx ), 2 ), L_shr( Mpy_32_32( p_imag_fx, sec_x_imag_fx ), 2 ) ); // p_q + ( Qfac - 2 ) - 31 - 2 = p_q + Qfac - 35 - tmp_y = L_add( L_shr( Mpy_32_32( p_real_fx, sec_y_real_fx ), 2 ), L_shr( Mpy_32_32( p_imag_fx, sec_y_imag_fx ), 2 ) ); // p_q + ( Qfac - 2 ) - 31 - 2 = p_q + Qfac - 35 - tmp_z = L_add( L_shr( Mpy_32_32( p_real_fx, sec_z_real_fx ), 2 ), L_shr( Mpy_32_32( p_imag_fx, sec_z_imag_fx ), 2 ) ); // p_q + ( Qfac - 2 ) - 31 - 2 = p_q + Qfac - 35 - *p_sec_I_vec_x_fx = BASOP_Util_Add_Mant32Exp( *p_sec_I_vec_x_fx, *p_sec_I_vec_x_exp, tmp_x, tmp_exp, p_sec_I_vec_x_exp ); - move32(); - *p_sec_I_vec_y_fx = BASOP_Util_Add_Mant32Exp( *p_sec_I_vec_y_fx, *p_sec_I_vec_y_exp, tmp_y, tmp_exp, p_sec_I_vec_y_exp ); - move32(); - *p_sec_I_vec_z_fx = BASOP_Util_Add_Mant32Exp( *p_sec_I_vec_z_fx, *p_sec_I_vec_z_exp, tmp_z, tmp_exp, p_sec_I_vec_z_exp ); - move32(); -#else temp_x64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_x_real_fx ), p_imag_fx, sec_x_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 temp_y64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_y_real_fx ), p_imag_fx, sec_y_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 temp_z64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_z_real_fx ), p_imag_fx, sec_z_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 @@ -1431,16 +1318,7 @@ void calculate_hodirac_sector_parameters_fx( sec_I_vec_z_64_fx = W_add( sec_I_vec_z_64_fx, temp_z64 ); Word64 tmp1; -#endif Word64 tmp2, tmp3, tmp4, sec_sum64; -#ifndef OPT_SBA_ENC_V2_NBE - Word32 tmp1; - Word32 tmp5, sec_sum; - tmp_exp = sub( 62, add( p_q, p_q ) ); - - tmp1 = BASOP_Util_Add_Mant32Exp( Mpy_32_32( p_real_fx, p_real_fx ), tmp_exp, Mpy_32_32( p_imag_fx, p_imag_fx ), tmp_exp, &tmp_exp ); -#endif -#ifdef OPT_SBA_ENC_V2_NBE tmp1 = W_mac_32_32( W_mult_32_32( p_real_fx, p_real_fx ), p_imag_fx, p_imag_fx ); // 2 * (Qfac - 3) + 1 tmp1 = W_shl( tmp1, 2 ); // 2 * (Qfac - 2) + 1 tmp2 = W_mac_32_32( W_mult_32_32( sec_x_real_fx, sec_x_real_fx ), sec_x_imag_fx, sec_x_imag_fx ); // 2 * (Qfac - 2) + 1 @@ -1450,23 +1328,7 @@ void calculate_hodirac_sector_parameters_fx( // instead dividing changed Q// energy_64_fx = W_add( energy_64_fx, sec_sum64 ); // 2 * (Qfac - 2) + 1 + 1 -#else - tmp2 = W_add( W_mult0_32_32( sec_x_real_fx, sec_x_real_fx ), W_mult0_32_32( sec_x_imag_fx, sec_x_imag_fx ) ); // 2 * (Qfac - 2) - tmp3 = W_add( W_mult0_32_32( sec_y_real_fx, sec_y_real_fx ), W_mult0_32_32( sec_y_imag_fx, sec_y_imag_fx ) ); // 2 * (Qfac - 2) - tmp4 = W_add( W_mult0_32_32( sec_z_real_fx, sec_z_real_fx ), W_mult0_32_32( sec_z_imag_fx, sec_z_imag_fx ) ); // 2 * (Qfac - 2) - sec_sum64 = W_add( W_add( tmp2, tmp3 ), tmp4 ); // 2 * (Qfac - 2) - n = W_norm( sec_sum64 ); - sec_sum64 = W_shl( sec_sum64, n ); // 2 * (Qfac - 2) + n - sec_sum = W_extract_h( sec_sum64 ); // 2 * (Qfac - 2) + n - 32 = 2 * Qfac + n - 36 - sec_sum_exp = sub( 67, add( shl( Qfac, 1 ), n ) ); - // divide by 2: - tmp1 = L_shr( tmp1, 1 ); - sec_sum = L_shr( sec_sum, 1 ); - tmp5 = BASOP_Util_Add_Mant32Exp( tmp1, tmp_exp, sec_sum, sec_sum_exp, &tmp_exp ); - energy_fx = BASOP_Util_Add_Mant32Exp( energy_fx, energy_exp, tmp5, tmp_exp, &energy_exp ); -#endif } -#ifdef OPT_SBA_ENC_V2_NBE tmp_scale = sub( W_norm( energy_64_fx ), 32 ); energy_fx = W_shl_sat_l( energy_64_fx, tmp_scale ); energy_exp = sub( tmp_exp_1, tmp_scale ); @@ -1508,7 +1370,6 @@ void calculate_hodirac_sector_parameters_fx( *p_sec_I_vec_z_exp = 0; move16(); } -#endif } IF( hDirAC->firstrun_sector_params ) @@ -1533,7 +1394,6 @@ void calculate_hodirac_sector_parameters_fx( ELSE { Word32 w_fx = L_sub( ONE_IN_Q30, beta_fx ); // Q30 -#ifdef OPT_SBA_ENC_V2_NBE Word32 tmp_1, tmp_2, tmp_3, tmp_sec_1, tmp_sec_2, tmp_sec_3; Word16 e_x, e_y, e_z; move16(); @@ -1588,15 +1448,6 @@ void calculate_hodirac_sector_parameters_fx( } *p_energy_smth_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( w_fx, energy_fx ), add( energy_exp, 1 ), Mpy_32_32( beta_fx, *p_energy_smth_fx ), add( *p_energy_smth_exp, 1 ), p_energy_smth_exp ); -#else - *p_sec_I_vec_smth_x_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( w_fx, *p_sec_I_vec_x_fx ), add( *p_sec_I_vec_x_exp, 1 ), Mpy_32_32( beta_fx, *p_sec_I_vec_smth_x_fx ), add( *p_sec_I_vec_smth_x_exp, 1 ), p_sec_I_vec_smth_x_exp ); - move32(); - *p_sec_I_vec_smth_y_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( w_fx, *p_sec_I_vec_y_fx ), add( *p_sec_I_vec_y_exp, 1 ), Mpy_32_32( beta_fx, *p_sec_I_vec_smth_y_fx ), add( *p_sec_I_vec_smth_y_exp, 1 ), p_sec_I_vec_smth_y_exp ); - move32(); - *p_sec_I_vec_smth_z_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( w_fx, *p_sec_I_vec_z_fx ), add( *p_sec_I_vec_z_exp, 1 ), Mpy_32_32( beta_fx, *p_sec_I_vec_smth_z_fx ), add( *p_sec_I_vec_smth_z_exp, 1 ), p_sec_I_vec_smth_z_exp ); - move32(); - *p_energy_smth_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( w_fx, energy_fx ), add( energy_exp, 1 ), Mpy_32_32( beta_fx, *p_energy_smth_fx ), add( *p_energy_smth_exp, 1 ), p_energy_smth_exp ); -#endif move32(); } @@ -1674,7 +1525,6 @@ void calculate_hodirac_sector_parameters_fx( } ELSE { -#ifdef OPT_SBA_ENC_V2_NBE tmp32_1 = L_sub( ONE_IN_Q29, tmp_diff_fx ); tmp32_2 = L_sub( tmp_diff_fx, ONE_IN_Q29 / 2 ); @@ -1685,16 +1535,6 @@ void calculate_hodirac_sector_parameters_fx( // *p_ele = 2.f * (1.f - tmp_diff) * *p_ele + (2.f * tmp_diff - 1.f) * *p_ele_prev *p_ele_fx = L_shl( Madd_32_32( Mpy_32_32( tmp32_1, *p_ele_fx ), tmp32_2, *p_ele_prev_fx ), 3 ); // Q29 + Q23 - 31 + 2 = Q23 move32(); -#else - *p_azi_fx = L_shl( L_add( Mpy_32_32( L_sub( ONE_IN_Q29, tmp_diff_fx ), *p_azi_fx ), Mpy_32_32( L_sub( tmp_diff_fx, ONE_IN_Q29 / 2 ), *p_azi_prev_fx ) ), 1 ); // Q29 + Q23 - 31 = Q21 - move32(); - *p_ele_fx = L_shl( L_add( Mpy_32_32( L_sub( ONE_IN_Q29, tmp_diff_fx ), *p_ele_fx ), Mpy_32_32( L_sub( tmp_diff_fx, ONE_IN_Q29 / 2 ), *p_ele_prev_fx ) ), 1 ); // Q29 + Q23 - 31 = Q21 - move32(); - *p_azi_fx = L_shl( *p_azi_fx, 2 ); // Q21 -> Q23; - move32(); - *p_ele_fx = L_shl( *p_ele_fx, 2 ); // Q21 -> Q23; - move32(); -#endif } } ELSE diff --git a/lib_com/ivas_fb_mixer_fx.c b/lib_com/ivas_fb_mixer_fx.c index c29856bbd..b55e069d7 100644 --- a/lib_com/ivas_fb_mixer_fx.c +++ b/lib_com/ivas_fb_mixer_fx.c @@ -757,13 +757,11 @@ void ivas_fb_mixer_process_fx( pMdft_out_fx[0] = Mdft_out_0_fx; pMdft_out_fx[1] = Mdft_out_1_fx; -#ifdef OPT_SBA_ENC_V1_BE Word16 total_guard = find_guarded_bits_fx( num_bands ); Word16 total_guard_2 = find_guarded_bits_fx( shl( frame_len, 1 ) ); Word16 tmp_q = sub( sub( *q_mixer_mat_fx, total_guard ), 32 ); // Q30 + hFbMixer->q_prior_mixer_fx - 31 - total_guard - 31 Word16 len = shl( frame_len, 1 ); Word16 res_q, q_check; -#endif FOR( ch = ( hFbMixer->fb_cfg->active_w_mixing == 0 ); ch < hFbMixer->fb_cfg->num_out_chans; ch++ ) { /* Run a loop of 2 to calculate current frame's filterbank output and prev frame's output */ @@ -778,12 +776,10 @@ void ivas_fb_mixer_process_fx( IF( in_out_mixer_map[ch][j] != 0 ) { -#ifdef OPT_SBA_ENC_V1_BE res_q = add( tmp_q, hFbMixer->q_ppFilterbank_inFR[j] ); q_check = s_min( q_pOut_fr_fx, res_q ); scale_sig32( pOut_fr_re_fx, frame_len, sub( q_check, q_pOut_fr_fx ) ); scale_sig32( pOut_fr_im_fx, frame_len, sub( q_check, q_pOut_fr_fx ) ); -#endif Word32 filterbank_mixer_bins_re_fx[L_FRAME48k]; Word32 filterbank_mixer_bins_im_fx[L_FRAME48k]; Word32 *pFb_inFR_re_fx = hFbMixer->ppFilterbank_inFR_re_fx[j]; // Q(hFbMixer->q_ppFilterbank_inFR_re_fx) @@ -792,10 +788,6 @@ void ivas_fb_mixer_process_fx( set_zero_fx( filterbank_mixer_bins_re_fx, frame_len ); set_zero_fx( filterbank_mixer_bins_im_fx, frame_len ); -#ifndef OPT_SBA_ENC_V1_BE - Word16 total_guard = find_guarded_bits_fx( num_bands ); - move16(); -#endif FOR( i = 0; i < num_bands; i++ ) { Word16 start_offset = pFb->fb_consts.pFilterbank_bins_start_offset[i]; @@ -821,69 +813,35 @@ void ivas_fb_mixer_process_fx( hFbMixer->prior_mixer_fx[ch][j][i] = mixer_mat_fx[ch][j][i]; // Q(q_mixer_mat_fx) move32(); } -#ifndef OPT_SBA_ENC_V1_BE - Word16 res_q = 0; - move16(); -#endif FOR( k = 0; k < frame_len; k++ ) { Word32 temp_out_re_fx, temp_out_im_fx; ivas_cmult_fix( filterbank_mixer_bins_re_fx[k], filterbank_mixer_bins_im_fx[k], pFb_inFR_re_fx[k], pFb_inFR_im_fx[k], &temp_out_re_fx, &temp_out_im_fx ); -#ifndef OPT_SBA_ENC_V1_BE - res_q = sub( add( sub( sub( add( 30, *q_mixer_mat_fx ), 31 ), total_guard ), hFbMixer->q_ppFilterbank_inFR[j] ), 31 ); - - Word16 q_check = s_min( q_pOut_fr_fx, res_q ); - IF( NE_16( q_check, q_pOut_fr_fx ) ) - { - pOut_fr_re_fx[k] = L_shr( pOut_fr_re_fx[k], sub( q_pOut_fr_fx, q_check ) ); // q_pOut_fr_fx -> q_check - move32(); - pOut_fr_im_fx[k] = L_shr( pOut_fr_im_fx[k], sub( q_pOut_fr_fx, q_check ) ); // q_pOut_fr_fx -> q_check - move32(); - } -#endif IF( NE_16( q_check, res_q ) ) { temp_out_re_fx = L_shr( temp_out_re_fx, sub( res_q, q_check ) ); // res_q -> q_check temp_out_im_fx = L_shr( temp_out_im_fx, sub( res_q, q_check ) ); // res_q -> q_check } -#ifndef OPT_SBA_ENC_V1_BE - res_q = q_check; - move16(); -#endif pOut_fr_re_fx[k] = L_add_sat( pOut_fr_re_fx[k], temp_out_re_fx ); // res_q move32(); pOut_fr_im_fx[k] = L_add_sat( pOut_fr_im_fx[k], temp_out_im_fx ); // res_q move32(); } -#ifdef OPT_SBA_ENC_V1_BE q_pOut_fr_fx = q_check; -#else - q_pOut_fr_fx = res_q; - move16(); -#endif } } -#ifndef OPT_SBA_ENC_V1_BE - Word16 scale = sub( s_min( L_norm_arr( pOut_fr_re_fx, frame_len ), L_norm_arr( pOut_fr_im_fx, frame_len ) ), find_guarded_bits_fx( shl( frame_len, 1 ) ) ); -#else Word16 scale = sub( s_min( L_norm_arr( pOut_fr_re_fx, frame_len ), L_norm_arr( pOut_fr_im_fx, frame_len ) ), total_guard_2 ); -#endif scale_sig32( pOut_fr_re_fx, frame_len, scale ); scale_sig32( pOut_fr_im_fx, frame_len, scale ); ivas_imdft_fx( pOut_fr_re_fx, pOut_fr_im_fx, pMdft_out_fx[hist], frame_len ); q_pMdft_out_fx[hist] = add( q_pOut_fr_fx, scale ); move16(); } -#ifdef OPT_SBA_ENC_V1_BE scale_sig32( pMdft_out_fx[0], len, sub( s_min( q_pMdft_out_fx[0], q_pMdft_out_fx[1] ), q_pMdft_out_fx[0] ) ); scale_sig32( pMdft_out_fx[1], len, sub( s_min( q_pMdft_out_fx[0], q_pMdft_out_fx[1] ), q_pMdft_out_fx[1] ) ); -#else - scale_sig32( pMdft_out_fx[0], shl( frame_len, 1 ), sub( s_min( q_pMdft_out_fx[0], q_pMdft_out_fx[1] ), q_pMdft_out_fx[0] ) ); - scale_sig32( pMdft_out_fx[1], shl( frame_len, 1 ), sub( s_min( q_pMdft_out_fx[0], q_pMdft_out_fx[1] ), q_pMdft_out_fx[1] ) ); -#endif ivas_fb_mixer_cross_fading_fx( hFbMixer, ppOut_pcm_fx, pMdft_out_fx[0], pMdft_out_fx[1], ch, frame_len, frame_len ); q_ppOut_pcm_fx[ch] = s_min( q_pMdft_out_fx[0], q_pMdft_out_fx[1] ); move16(); diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 361215e22..ffbe68925 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -1995,86 +1995,42 @@ static void ivas_calc_post_pred_per_band_enc_fx( Word16 *q_postpred_cov_re ) { Word16 i, j, k; -#ifndef OPT_SBA_ENC_V1_BE - Word32 dmx_mat_conj[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; - Word16 q_postpred_cov_re_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; - Word16 min_val; -#else Word16 max_val; Word16 temp; Word32 temp_add; Word16 e_postpred_cov_re_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; -#endif Word32 temp_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word16 temp_mat_e[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word32 tmp_re; Word16 tmp_q; Word16 tmp_e; -#ifndef OPT_SBA_ENC_V1_BE - FOR( i = 0; i < num_ch; i++ ) - { - FOR( j = 0; j < num_ch; j++ ) - { - dmx_mat_conj[i][j] = mixer_mat[j][i][band_idx]; /*q_mixer_mat*/ - move32(); - } - } - - FOR( i = 0; i < num_ch; i++ ) - { - set32_fx( temp_mat[i], 0, num_ch ); - set32_fx( postpred_cov_re[i], 0, num_ch ); - } -#endif - -#ifdef OPT_SBA_ENC_V1_BE max_val = MIN16B; move16(); temp = sub( 62, q_mixer_mat ); -#else - min_val = MAX16B; - move16(); -#endif /* num_ch x num_ch mult */ FOR( i = 0; i < num_ch; i++ ) { FOR( j = 0; j < num_ch; j++ ) { -#ifndef OPT_SBA_ENC_V1_BE - temp_mat[i][j] = 0; -#else temp_add = 0; -#endif move32(); temp_mat_e[i][j] = 0; move16(); FOR( k = 0; k < num_ch; k++ ) { -#ifndef OPT_SBA_ENC_V1_BE - tmp_re = Mpy_32_32( cov_real[i][k][band_idx], dmx_mat_conj[k][j] ); - tmp_e = sub( 62, add( q_cov_real[i][k][band_idx], q_mixer_mat ) ); - IF( tmp_re ) - { - temp_mat[i][j] = BASOP_Util_Add_Mant32Exp( temp_mat[i][j], temp_mat_e[i][j], tmp_re, tmp_e, &temp_mat_e[i][j] ); - move32(); - } -#else tmp_re = Mpy_32_32( cov_real[i][k][band_idx], mixer_mat[j][k][band_idx] ); tmp_e = sub( temp, q_cov_real[i][k][band_idx] ); IF( tmp_re ) { temp_add = BASOP_Util_Add_Mant32Exp( temp_add, temp_mat_e[i][j], tmp_re, tmp_e, &temp_mat_e[i][j] ); } -#endif } -#ifdef OPT_SBA_ENC_V1_BE temp_mat[i][j] = temp_add; move32(); -#endif } } @@ -2084,49 +2040,25 @@ static void ivas_calc_post_pred_per_band_enc_fx( { FOR( j = i; j < num_ch; j++ ) { -#ifdef OPT_SBA_ENC_V1_BE temp_add = 0; move32(); e_postpred_cov_re_buf[i][j] = sub( 31, *q_postpred_cov_re ); -#else - q_postpred_cov_re_buf[i][j] = *q_postpred_cov_re; -#endif move16(); FOR( k = 0; k < num_ch; k++ ) { tmp_re = Mpy_32_32( mixer_mat[i][k][band_idx], temp_mat[k][j] ); -#ifdef OPT_SBA_ENC_V1_BE tmp_q = add( tmp_e, temp_mat_e[k][j] ); -#else - tmp_q = sub( q_mixer_mat, temp_mat_e[k][j] ); -#endif IF( tmp_re ) { -#ifndef OPT_SBA_ENC_V1_BE - tmp_e = sub( 31, q_postpred_cov_re_buf[i][j] ); - postpred_cov_re[i][j] = BASOP_Util_Add_Mant32Exp( postpred_cov_re[i][j], tmp_e, tmp_re, sub( Q31, tmp_q ), &tmp_e ); - move32(); - q_postpred_cov_re_buf[i][j] = sub( 31, tmp_e ); - move16(); -#else temp_add = BASOP_Util_Add_Mant32Exp( temp_add, e_postpred_cov_re_buf[i][j], tmp_re, tmp_q, &e_postpred_cov_re_buf[i][j] ); -#endif } } -#ifndef OPT_SBA_ENC_V1_BE - IF( postpred_cov_re[i][j] ) - { - min_val = s_min( min_val, q_postpred_cov_re_buf[i][j] ); -#else if ( temp_add ) { max_val = s_max( max_val, e_postpred_cov_re_buf[i][j] ); -#endif } -#ifdef OPT_SBA_ENC_V1_BE postpred_cov_re[i][j] = temp_add; move32(); -#endif } } @@ -2137,11 +2069,7 @@ static void ivas_calc_post_pred_per_band_enc_fx( { IF( postpred_cov_re[i][j] ) { -#ifdef OPT_SBA_ENC_V1_BE postpred_cov_re[i][j] = L_shr( postpred_cov_re[i][j], sub( max_val, e_postpred_cov_re_buf[i][j] ) ); -#else - postpred_cov_re[i][j] = L_shl( postpred_cov_re[i][j], sub( min_val, q_postpred_cov_re_buf[i][j] ) ); -#endif move32(); } } @@ -2156,21 +2084,12 @@ static void ivas_calc_post_pred_per_band_enc_fx( move32(); } } -#ifdef OPT_SBA_ENC_V1_BE if ( EQ_16( max_val, MIN16B ) ) { max_val = 0; move16(); } *q_postpred_cov_re = sub( Q31, max_val ); -#else - if ( EQ_16( min_val, MAX16B ) ) - { - min_val = Q31; - move16(); - } - *q_postpred_cov_re = min_val; -#endif move16(); return; @@ -2361,30 +2280,18 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( Word32 re1, re2; W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], cov_dd_re[0][0] ); /*q_cov_dd_re+ pSparMd->band_coeffs[b_ts_idx].q_C_re_fx*/ -#ifdef OPT_SBA_ENC_V2_BE q_tmp1 = sub( W_norm( W_tmp ), 32 ); re1 = W_shl_sat_l( W_tmp, q_tmp1 ); /*q_cov_dd_re+ q_C_re+q_tmp1*/ q_tmp1 = add( add( q_C_re, q_tmp1 ), q_cov_dd_re ); -#else - q_tmp1 = W_norm( W_tmp ); - re1 = W_extract_h( W_shl( W_tmp, q_tmp1 ) ); /*q_cov_dd_re+ q_C_re+q_tmp1-32*/ - q_tmp1 = sub( add( add( q_C_re, q_tmp1 ), q_cov_dd_re ), 32 ); -#endif if ( W_tmp == 0 ) { q_tmp1 = 31; move16(); } W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[1][0], cov_dd_re[0][0] ); /*q_cov_dd_re+ q_C_re*/ -#ifdef OPT_SBA_ENC_V2_BE q_tmp = sub( W_norm( W_tmp ), 32 ); re2 = W_shl_sat_l( W_tmp, q_tmp ); /*q_cov_dd_re+ q_C_re+q_tmp*/ q_tmp = add( add( q_C_re, q_tmp ), q_cov_dd_re ); -#else - q_tmp = W_norm( W_tmp ); - re2 = W_extract_h( W_shl( W_tmp, q_tmp ) ); /*q_cov_dd_re+ q_C_re+q_tmp-32*/ - q_tmp = sub( add( add( q_C_re, q_tmp ), q_cov_dd_re ), 32 ); -#endif if ( W_tmp == 0 ) { q_tmp = 31; @@ -2392,20 +2299,11 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( } W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], re1 ); // q_tmp1+q_C_re -#ifdef OPT_SBA_ENC_V2_BE q_factor = sub( W_norm( W_tmp ), 32 ); recon_uu_re[0][0] = W_shl_sat_l( W_tmp, q_factor ); // q_tmp1+q_C_re+q_recon_uu_re[0][0] move32(); q_recon_uu_re[0][0] = add( add( q_C_re, q_factor ), q_tmp1 ); move16(); -#else - q_recon_uu_re[0][0] = W_norm( W_tmp ); - move16(); - recon_uu_re[0][0] = W_extract_h( W_shl( W_tmp, q_recon_uu_re[0][0] ) ); // q_tmp1+q_C_re+q_recon_uu_re[0][0]-32 - move32(); - q_recon_uu_re[0][0] = sub( add( add( q_C_re, q_recon_uu_re[0][0] ), q_tmp1 ), 32 ); - move16(); -#endif if ( W_tmp == 0 ) { q_recon_uu_re[0][0] = 31; @@ -2413,20 +2311,11 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( } W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[1][0], re1 ); // q_C_re+q_tmp1 -#ifdef OPT_SBA_ENC_V2_BE q_factor = sub( W_norm( W_tmp ), 32 ); recon_uu_re[0][1] = W_shl_sat_l( W_tmp, q_factor ); // q_C_re+q_tmp1+q_recon_uu_re[0][1] move32(); q_recon_uu_re[0][1] = add( add( q_C_re, q_factor ), q_tmp1 ); move16(); -#else - q_recon_uu_re[0][1] = W_norm( W_tmp ); - move16(); - recon_uu_re[0][1] = W_extract_h( W_shl( W_tmp, q_recon_uu_re[0][1] ) ); // q_C_re+q_tmp1+q_recon_uu_re[0][1]-32 - move32(); - q_recon_uu_re[0][1] = sub( add( add( q_C_re, q_recon_uu_re[0][1] ), q_tmp1 ), 32 ); - move16(); -#endif if ( W_tmp == 0 ) { q_recon_uu_re[0][1] = 31; @@ -2434,20 +2323,11 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( } W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], re2 ); // q_C_re+q_tmp -#ifdef OPT_SBA_ENC_V2_BE q_factor = sub( W_norm( W_tmp ), 32 ); recon_uu_re[1][0] = W_shl_sat_l( W_tmp, q_factor ); // q_C_re+q_tmp+q_recon_uu_re[1][0] move32(); q_recon_uu_re[1][0] = add( add( q_C_re, q_factor ), q_tmp ); move16(); -#else - q_recon_uu_re[1][0] = W_norm( W_tmp ); - move16(); - recon_uu_re[1][0] = W_extract_h( W_shl( W_tmp, q_recon_uu_re[1][0] ) ); // q_C_re+q_tmp+q_recon_uu_re[1][0]-32 - move32(); - q_recon_uu_re[1][0] = sub( add( add( q_C_re, q_recon_uu_re[1][0] ), q_tmp ), 32 ); - move16(); -#endif if ( W_tmp == 0 ) { q_recon_uu_re[1][0] = 31; @@ -2455,20 +2335,11 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( } W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[1][0], re2 ); // q_C_re+q_tmp -#ifdef OPT_SBA_ENC_V2_BE q_factor = sub( W_norm( W_tmp ), 32 ); recon_uu_re[1][1] = W_shl_sat_l( W_tmp, q_factor ); // q_C_re+q_tmp+q_recon_uu_re[1][1] move32(); q_recon_uu_re[1][1] = add( add( q_C_re, q_factor ), q_tmp ); move16(); -#else - q_recon_uu_re[1][1] = W_norm( W_tmp ); - move16(); - recon_uu_re[1][1] = W_extract_h( W_shl( W_tmp, q_recon_uu_re[1][1] ) ); // q_C_re+q_tmp+q_recon_uu_re[1][1]-32 - move32(); - q_recon_uu_re[1][1] = sub( add( add( q_C_re, q_recon_uu_re[1][1] ), q_tmp ), 32 ); - move16(); -#endif if ( W_tmp == 0 ) { q_recon_uu_re[1][1] = 31; @@ -2485,18 +2356,12 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( } } q_tmp = sub( s_min( q_tmp, q_cov_uu_re ), 1 ); -#ifdef OPT_SBA_ENC_V2_BE q_factor = sub( q_cov_uu_re, q_tmp ); -#endif FOR( i = 0; i < 2; i++ ) { FOR( j = 0; j < 2; j++ ) { -#ifdef OPT_SBA_ENC_V2_BE cov_uu_re[i][j] = L_sub( L_shr( cov_uu_re[i][j], q_factor ), L_shr( recon_uu_re[i][j], sub( q_recon_uu_re[i][j], q_tmp ) ) ); // q_tmp -#else - cov_uu_re[i][j] = L_sub( L_shr( cov_uu_re[i][j], sub( q_cov_uu_re, q_tmp ) ), L_shr( recon_uu_re[i][j], sub( q_recon_uu_re[i][j], q_tmp ) ) ); // q_tmp -#endif move32(); } } @@ -2516,15 +2381,9 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( { Word32 re; W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][k], cov_dd_re[k][j] ); // q_C_re+q_cov_dd_re -#ifdef OPT_SBA_ENC_V2_BE q_tmp = sub( W_norm( W_tmp ), 33 ); re = W_shl_sat_l( W_tmp, q_tmp ); // q_C_re+q_cov_dd_re+q_tmp q_tmp = add( add( q_C_re, q_tmp ), q_cov_dd_re ); -#else - q_tmp = sub( W_norm( W_tmp ), 1 ); - re = W_extract_h( W_shl( W_tmp, q_tmp ) ); // q_C_re+q_cov_dd_re+q_tmp-32 - q_tmp = sub( add( add( q_C_re, q_tmp ), q_cov_dd_re ), 32 ); -#endif if ( W_tmp == 0 ) { q_tmp = 31; @@ -2548,15 +2407,9 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( } W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], re1[0] ); // q_C_re+q_re1[0] -#ifdef OPT_SBA_ENC_V2_BE q_tmp = sub( W_norm( W_tmp ), 33 ); re2 = W_shl_sat_l( W_tmp, q_tmp ); // q_C_re+q_re1[0]+q_tmp q_tmp = add( add( q_C_re, q_tmp ), q_re1[0] ); -#else - q_tmp = sub( W_norm( W_tmp ), 1 ); - re2 = W_extract_h( W_shl( W_tmp, q_tmp ) ); // q_C_re+q_re1[0]+q_tmp-32 - q_tmp = sub( add( add( q_C_re, q_tmp ), q_re1[0] ), 32 ); -#endif if ( W_tmp == 0 ) { q_tmp = 31; @@ -2566,15 +2419,9 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( move32(); W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][1], re1[1] ); // q_C_re+q_re1[1] -#ifdef OPT_SBA_ENC_V2_BE q_tmp1 = sub( W_norm( W_tmp ), 33 ); re2 = W_shl_sat_l( W_tmp, q_tmp1 ); // q_C_re+q_re1[1]+q_tmp1 q_tmp1 = add( add( q_C_re, q_tmp1 ), q_re1[1] ); -#else - q_tmp1 = sub( W_norm( W_tmp ), 1 ); - re2 = W_extract_h( W_shl( W_tmp, q_tmp1 ) ); // q_C_re+q_re1[1]+q_tmp1-32 - q_tmp1 = sub( add( add( q_C_re, q_tmp1 ), q_re1[1] ), 32 ); -#endif if ( W_tmp == 0 ) { q_tmp1 = 31; @@ -2653,15 +2500,9 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( FOR( k = 0; k < num_dmx - 1; k++ ) { W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[i][k], cov_dd_re[k][m] ); // q_C_re+q_cov_dd_re -#ifdef OPT_SBA_ENC_V2_BE q_tmp = sub( W_norm( W_tmp ), 34 ); re = W_shl_sat_l( W_tmp, q_tmp ); // q_C_re+q_cov_dd_re+q_tmp q_tmp = add( add( q_C_re, q_tmp ), q_cov_dd_re ); -#else - q_tmp = sub( W_norm( W_tmp ), 2 ); - re = W_extract_h( W_shl( W_tmp, q_tmp ) ); // q_C_re+q_cov_dd_re+q_tmp-32 - q_tmp = sub( add( add( q_C_re, q_tmp ), q_cov_dd_re ), 32 ); -#endif if ( W_tmp == 0 ) { q_tmp = 31; @@ -2701,15 +2542,9 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( FOR( m = 0; m < num_dmx - 1; m++ ) { W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[j][m], re1[m] ); // q_C_re+q_re1[m] -#ifdef OPT_SBA_ENC_V2_BE q_tmp = sub( W_norm( W_tmp ), 34 ); re = W_shl_sat_l( W_tmp, q_tmp ); // q_C_re+q_re1[m]+q_tmp q_tmp = add( add( q_C_re, q_tmp ), q_re1[m] ); -#else - q_tmp = sub( W_norm( W_tmp ), 2 ); - re = W_extract_h( W_shl( W_tmp, q_tmp ) ); // q_C_re+q_re1[m]+q_tmp-32 - q_tmp = sub( add( add( q_C_re, q_tmp ), q_re1[m] ), 32 ); -#endif if ( W_tmp == 0 ) { q_tmp = 31; @@ -2794,15 +2629,9 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( move16(); IF( trace != 0 ) { -#ifdef OPT_SBA_ENC_V2_BE q_factor = sub( W_norm( trace ), 32 ); tmp = Mpy_32_32( p_norm_scaling, W_shl_sat_l( trace, q_factor ) ); // q_cov_uu_re+q_factor q_factor = add( q_cov_uu_re, q_factor ); -#else - q_factor = W_norm( trace ); - tmp = Mpy_32_32( p_norm_scaling, W_extract_h( W_shl( trace, q_factor ) ) ); // q_cov_uu_re+q_factor-32 - q_factor = sub( add( q_cov_uu_re, q_factor ), 32 ); -#endif IF( GT_16( q_factor, q_postpred_cov_re ) ) { tmp = L_shr( tmp, sub( q_factor, q_postpred_cov_re ) ); // q_postpred_cov_re diff --git a/lib_com/options.h b/lib_com/options.h index 4764d45bc..98bf33a6b 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,9 +77,6 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE #define OPT_BIN_REND_V2_NBE -#define OPT_SBA_ENC_V2_BE -#define OPT_SBA_ENC_V2_NBE -#define OPT_SBA_ENC_V1_BE #define OPT_SBA_DEC_PATH /* Optimization made in SBA decoding path */ #define OPT_IVAS_FILTER_ROM /* Optimization made in IVAS filter table */ /* Both following 2 macros (IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST*) are independent from each other, they refer to different code blocks */ diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index a7944410b..f96d5d130 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -1249,10 +1249,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( k = 1; move16(); -#ifdef OPT_SBA_ENC_V2_BE Word16 round_bit_estimate_fx; Word32 target_Q15 = L_shl( target, Q15 ); // Q15 -#endif WHILE( LT_16( k, nt / 2 ) ) { @@ -1356,7 +1354,6 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( /* check while condition */ /* MSBs coding */ -#ifdef OPT_SBA_ENC_V2_BE FOR( ; s_max( a1, b1 ) >= A_THRES; ) { pki = lookup[lev1]; /* ESC symbol */ @@ -1368,32 +1365,12 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( lev1 = s_min( add( lev1, ( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ) ), 2 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); } -#else - WHILE( GE_16( s_max( a1, b1 ), A_THRES ) ) - { - pki = lookup[lev1]; /* ESC symbol */ - - bit_estimate_fx = W_add( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); - bit_estimate_fx = W_add( bit_estimate_fx, MAKE_VARIABLE_QX( 2, Q23 ) ); - a1 = shr( a1, 1 ); - b1 = shr( b1, 1 ); - - lev1 = s_min( add( lev1, ( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ) ), 2 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); - - /* check while condition */ - } -#endif pki = lookup[lev1]; symbol = add( a1, i_mult( A_THRES, b1 ) ); /* Q0 */ bit_estimate_fx = W_add( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] ); -#ifdef OPT_SBA_ENC_V2_BE IF( GT_32( W_shl_sat_l( bit_estimate_fx, -Q8 ), target_Q15 ) ) // Q15 -#else - /* Should we truncate? */ - IF( GT_32( W_extract_l( W_shr( bit_estimate_fx, Q8 ) ), L_shl( target, Q15 ) ) ) -#endif { stop2 = 1; move16(); @@ -1415,22 +1392,11 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( { lev1 = shr( lev1, NBITS_CONTEXT + NBITS_RATEQ ); -#ifdef OPT_SBA_ENC_V2_BE t = add( 13, lev1 ); IF( lev1 <= 0 ) { t = add( 1, i_mult( add( a1, b1 ), add( lev1, 2 ) ) ); } -#else - IF( lev1 <= 0 ) - { - t = add( 1, i_mult( add( a1, b1 ), add( lev1, 2 ) ) ); - } - ELSE - { - t = add( 13, lev1 ); - } -#endif *ctx = L_add( imult3216( L_and( *ctx, 0xf ), 16 ), t ); move32(); @@ -1455,18 +1421,10 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } } /*end of the 2-tuples loop*/ -#ifdef OPT_SBA_ENC_V2_BE total_output_bits = round_fx( W_shl_sat_l( bit_estimate_fx, -Q7 ) ); /* Q23 -> Q16 -> Q0 */ -#else - total_output_bits = round_fx( W_extract_l( W_shr( bit_estimate_fx, Q7 ) ) ); /* Q23 -> Q16 -> Q0 */ -#endif IF( *stop ) { -#ifdef OPT_SBA_ENC_V2_BE total_output_bits = round_fx( W_shl_sat_l( nbits2_fx, -Q7 ) ); /* Q23 -> Q16 -> Q0 */ -#else - total_output_bits = round_fx( W_extract_l( W_shr( nbits2_fx, Q7 ) ) ); /* Q23 -> Q16 -> Q0 */ -#endif } if ( stop2 ) @@ -1491,11 +1449,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( hm_cfg->numPeakIndices = numPeakIndicesOrig; /* Q0 */ move16(); -#ifdef OPT_SBA_ENC_V2_BE return round_fx( L_add( W_shl_sat_l( nbits2_fx, -Q7 ), ONE_IN_Q14 ) ); /* Q0 */ -#else - return round_fx( L_add( W_extract_l( W_shr( nbits2_fx, Q7 ) ), ONE_IN_Q14 ) ); /* Q0 */ -#endif } ELSE /* if (!hm_cfg) */ { @@ -1569,7 +1523,6 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( /* check while condition */ /* MSBs coding */ -#ifdef OPT_SBA_ENC_V2_BE FOR( ; s_max( a1, b1 ) >= A_THRES; ) { pki = lookup[( esc_nb << ( NBITS_CONTEXT + NBITS_RATEQ ) )]; /* Q0 */ @@ -1583,35 +1536,13 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( lev1 = add( lev1, 1 ); esc_nb = s_min( lev1, 3 ); } -#else - WHILE( GE_16( s_max( a1, b1 ), A_THRES ) ) - { - pki = lookup[( esc_nb << ( NBITS_CONTEXT + NBITS_RATEQ ) )]; /* Q0 */ - move16(); - - bit_estimate_fx = W_add( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); - bit_estimate_fx = W_add( bit_estimate_fx, MAKE_NUMBER_QX( 2, Q23 ) ); - - a1 = shr( a1, 1 ); - b1 = shr( b1, 1 ); - - lev1 = add( lev1, 1 ); - esc_nb = s_min( lev1, 3 ); - - /* check while condition */ - } -#endif pki = lookup[( esc_nb << ( NBITS_CONTEXT + NBITS_RATEQ ) )]; /* Q0 */ symbol = add( a1, i_mult( A_THRES, b1 ) ); /* Q0 */ bit_estimate_fx = W_add( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] ); /* Should we truncate? */ -#ifdef OPT_SBA_ENC_V2_BE IF( GT_32( W_shl_sat_l( bit_estimate_fx, -Q8 ), target_Q15 ) ) // Q15 -#else - IF( GT_32( W_extract_l( W_shr( bit_estimate_fx, Q8 ) ), L_shl( target, Q15 ) ) ) -#endif { overflow_flag = 1; move16(); @@ -1627,53 +1558,29 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } } -#ifdef OPT_SBA_ENC_V2_BE /* Update context for next 2-tuple */ cp = add( 1, i_mult( add( a1, b1 ), add( esc_nb, 1 ) ) ); /* Q0 */ if ( GE_16( esc_nb, 2 ) ) { cp = add( 12, esc_nb ); /* Q0 */ } -#else - /* Update context for next 2-tuple */ - IF( LT_16( esc_nb, 2 ) ) - { - cp = add( 1, i_mult( add( a1, b1 ), add( esc_nb, 1 ) ) ); /* Q0 */ - } - ELSE - { - cp = add( 12, esc_nb ); /* Q0 */ - } -#endif /*shift old bits and replace last 4 bits*/ s = (UWord16) L_add( L_shl( s, 4 ), cp ); t = s_and( s, 0xFF ); } /*end of the 2-tuples loop*/ -#ifdef OPT_SBA_ENC_V2_BE tot_bits2 = round_fx( W_shl_sat_l( nbits2_fx, -Q7 ) ); /* Q23 -> Q16 -> Q0 */ round_bit_estimate_fx = round_fx( W_shl_sat_l( bit_estimate_fx, -Q7 ) ); /* Q23 -> Q16 -> Q0 */ -#else - tot_bits2 = round_fx( W_extract_l( W_shr( nbits2_fx, Q7 ) ) ); /* Q23 -> Q16 -> Q0 */ -#endif if ( LT_16( lastnz2, lastnz ) ) /* Overflow occured because unable to code all tuples */ { overflow_flag = 1; move16(); } -#ifdef OPT_SBA_ENC_V2_BE if ( EQ_16( mode, -1 ) ) { tot_bits2 = round_bit_estimate_fx; move16(); } -#else - IF( EQ_16( mode, -1 ) ) - { - tot_bits2 = round_fx( W_shl_sat_l( bit_estimate_fx, -Q7 ) ); /* Q23 -> Q16 -> Q0 */ - } -#endif -#ifdef OPT_SBA_ENC_V2_BE if ( overflow_flag == 0 ) /* No overflow */ { *stop = 0; @@ -1692,26 +1599,6 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); } } -#else - IF( overflow_flag == 0 ) /* No overflow */ - { - *stop = 0; - move16(); - } - ELSE /* Overflow */ - { - IF( *stop ) - { - *stop = tot_bits2; /* Q0 */ - move16(); - } - ELSE - { - *stop = round_fx( W_extract_l( W_shr( bit_estimate_fx, Q7 ) ) ); /* Q23 -> Q16 -> Q0 */ - move16(); - } - } -#endif *lastnz_out = lastnz; /* Q0 */ move16(); @@ -1843,7 +1730,6 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( /* Get context */ t = add( hContextMem->ctx, hContextMem->rateFlag ); /* Q0 */ -#ifdef OPT_SBA_ENC_V2_BE tmp = ( 1 << NBITS_CONTEXT ); move16(); if ( GE_16( hContextMem->nt_half, idx ) ) @@ -1851,16 +1737,6 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( tmp = 0; move16(); } -#else - IF( GE_16( hContextMem->nt_half, idx ) ) - { - tmp = 0; - } - ELSE - { - tmp = ( 1 << NBITS_CONTEXT ); - } -#endif t = add( t, tmp ); /* Q0 */ @@ -1881,11 +1757,7 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( /* check while condition */ /* MSBs coding */ -#ifdef OPT_SBA_ENC_V2_BE FOR( ; s_max( a1, b1 ) >= A_THRES; ) -#else - WHILE( GE_16( s_max( a1, b1 ), A_THRES ) ) -#endif { pki = lookup[lev1]; /* Q0 */ @@ -1916,31 +1788,16 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( /* Update context */ lev1 = shr( lev1, NBITS_CONTEXT + NBITS_RATEQ ); -#ifdef OPT_SBA_ENC_V2_BE t = add( 1, i_mult( add( a1, b1 ), add( lev1, 2 ) ) ); /* Q0 */ if ( lev1 > 0 ) { t = add( 13, lev1 ); /* Q0 */ } -#else - IF( lev1 <= 0 ) - { - t = add( 1, i_mult( add( a1, b1 ), add( lev1, 2 ) ) ); /* Q0 */ - } - ELSE - { - t = add( 13, lev1 ); /* Q0 */ - } -#endif hContextMem->ctx = add( i_mult( s_and( hContextMem->ctx, 0xf ), 16 ), t ); /* Q0 */ move16(); } /*end of the 2-tuples loop*/ -#ifdef OPT_SBA_ENC_V2_BE total_output_bits = round_fx( W_shl_sat_l( hContextMem->bit_estimate_fx, -Q7 ) ); /* Q0 */ -#else - total_output_bits = round_fx( W_extract_l( W_shr( hContextMem->bit_estimate_fx, Q7 ) ) ); /* Q0 */ -#endif // total_output_bits = (Word16) ( hContextMem->bit_estimate + 0.5f ); diff --git a/lib_enc/ivas_enc_cov_handler_fx.c b/lib_enc/ivas_enc_cov_handler_fx.c index 8b4509f49..c03632d10 100644 --- a/lib_enc/ivas_enc_cov_handler_fx.c +++ b/lib_enc/ivas_enc_cov_handler_fx.c @@ -518,9 +518,7 @@ static void ivas_band_cov_fx( Word16 q_shift, q_shift_tmp; Word16 m, start_bin, active_bins; Word16 num_blocks; -#ifdef OPT_SBA_ENC_V1_BE Word16 shift_conv, q_shift_cov[IVAS_MAX_NUM_BANDS][IVAS_MAX_NUM_BANDS]; -#endif num_blocks = idiv1616( num_bins, stride ); /* Q0 */ FOR( i = 0; i < num_chans; i++ ) @@ -532,45 +530,24 @@ static void ivas_band_cov_fx( move16(); move16(); -#ifdef OPT_SBA_ENC_V1_BE q_shift = 31; move16(); -#endif FOR( k = 0; k < num_bins; k++ ) { pV_re_64bit[k] = W_add( W_mult0_32_32( ppIn_FR_real[i1][k], ppIn_FR_real[j1][k] ), W_mult0_32_32( ppIn_FR_imag[i1][k], ppIn_FR_imag[j1][k] ) ); //(q_In_FR[i1], q_In_FR[j1]) -> (q_In_FR[i1] + q_In_FR[j1]) move64(); -#ifdef OPT_SBA_ENC_V1_BE q_shift_tmp = W_norm( pV_re_64bit[k] ); if ( pV_re_64bit[k] != 0 ) { q_shift = s_min( q_shift, q_shift_tmp ); } -#endif } -#ifndef OPT_SBA_ENC_V1_BE - q_shift = 31; - move16(); - FOR( k = 0; k < num_bins; k++ ) - { - q_shift_tmp = W_norm( pV_re_64bit[k] ); - if ( pV_re_64bit[k] != 0 ) - { - q_shift = s_min( q_shift, q_shift_tmp ); - } - } -#endif q_shift_tmp = sub( q_shift, 32 ); FOR( k = 0; k < num_bins; k++ ) { -#ifdef OPT_SBA_ENC_V1_BE pV_re[k] = W_shl_sat_l( pV_re_64bit[k], q_shift_tmp ); //(q_In_FR[i1] + q_In_FR[j1]) + (q_shift - 32) move32(); -#else - pV_re[k] = W_extract_l( W_shl_nosat( pV_re_64bit[k], q_shift_tmp ) ); //(q_In_FR[i1] + q_In_FR[j1]) + (q_shift - 32) - move32(); -#endif /* perform rounding towards lower value for negative results */ if ( pV_re[k] < 0 ) { @@ -578,10 +555,8 @@ static void ivas_band_cov_fx( } } -#ifdef OPT_SBA_ENC_V1_BE q_shift_cov[i][j] = Q31; move16(); -#endif FOR( k = start_band; k < end_band; k++ ) { Word64 temp; @@ -603,11 +578,7 @@ static void ivas_band_cov_fx( /* optional: add temporal weight here */ FOR( m = 0; m < active_bins; m++ ) { -#ifdef OPT_SBA_ENC_V1_BE temp = W_mac_32_32( temp, cov_ptr[m], p_bin_to_band[m] ); // ((q_In_FR[i1] + q_In_FR[j1]) + (q_shift - 32), Q22) + 1-> (q_In_FR[i1] + q_In_FR[j1] + (q_shift - 9) -#else - temp = W_add( temp, W_mult0_32_32( cov_ptr[m], p_bin_to_band[m] ) ); // ((q_In_FR[i1] + q_In_FR[j1]) + (q_shift - 32), Q22) -> (q_In_FR[i1] + q_In_FR[j1] + (q_shift - 10) -#endif } cov_ptr += stride; move16(); @@ -616,19 +587,13 @@ static void ivas_band_cov_fx( cov_real_64bit[i][j][k] = temp * (Word64) ( num_blocks ); // (q_In_FR[i1] + q_In_FR[j1] + (q_shift - 10) - guard_bits move64(); move64(); // conservative estimation of a 64 bit multiplication -#ifdef OPT_SBA_ENC_V1_BE shift_conv = W_norm( cov_real_64bit[i][j][k] ); if ( cov_real_64bit[i][j][k] != 0 ) { q_shift_cov[i][j] = s_min( q_shift_cov[i][j], shift_conv ); } -#endif } -#ifdef OPT_SBA_ENC_V1_BE q_cov_real[i][j] = add( add( q_In_FR, q_In_FR ), sub( q_shift, Q9 ) ); -#else - q_cov_real[i][j] = add( add( q_In_FR, q_In_FR ), sub( q_shift, Q10 ) ); -#endif move16(); } } @@ -637,31 +602,12 @@ static void ivas_band_cov_fx( { FOR( j = i; j < num_chans; j++ ) { -#ifndef OPT_SBA_ENC_V1_BE - q_shift = 31; - move16(); - FOR( k = start_band; k < end_band; k++ ) - { - q_shift_tmp = W_norm( cov_real_64bit[i][j][k] ); - if ( cov_real_64bit[i][j][k] != 0 ) - { - q_shift = s_min( q_shift, q_shift_tmp ); - } - } - q_shift_tmp = sub( q_shift, 32 ); -#else q_shift_tmp = sub( q_shift_cov[i][j], 32 ); -#endif FOR( k = start_band; k < end_band; k++ ) { -#ifdef OPT_SBA_ENC_V1_BE cov_real[i][j][k] = W_shl_sat_l( cov_real_64bit[i][j][k], q_shift_tmp ); /* q_cov_real[i][j] + q_shift - 32 */ move32(); -#else - cov_real[i][j][k] = W_extract_l( W_shl_nosat( cov_real_64bit[i][j][k], q_shift_tmp ) ); /* q_cov_real[i][j] + q_shift - 32 */ - move32(); -#endif } q_cov_real[i][j] = add( q_cov_real[i][j], q_shift_tmp ); move16(); -- GitLab From d91956777f302bfe7b42376be7754d30f98aa21c Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:54:01 +0200 Subject: [PATCH 16/35] [cleanup] accept OPT_SBA_DEC_PATH --- lib_com/ivas_prot_fx.h | 9 - lib_com/options.h | 1 - lib_dec/ivas_dirac_dec_fx.c | 31 -- lib_dec/ivas_mct_core_dec_fx.c | 65 ---- lib_dec/ivas_mct_dec_mct_fx_fx.c | 22 -- lib_dec/ivas_mdct_core_dec_fx.c | 4 - lib_dec/ivas_stereo_mdct_core_dec_fx.c | 9 - lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 37 --- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 284 ------------------ 9 files changed, 462 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 2eaf573fd..34928d7ab 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1125,10 +1125,6 @@ void apply_MCT_dec_fx( MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ Decoder_State **sts, /* i/o: decoder state structure */ Word32 *x[MCT_MAX_CHANNELS][NB_DIV] /* i/o: decoded and dequan. spect. input to MCT */ -#ifndef OPT_SBA_DEC_PATH - , - Word16 q_x[MCT_MAX_CHANNELS] -#endif /* OPT_SBA_DEC_PATH */ ); void mctStereoIGF_dec_fx( @@ -1164,11 +1160,6 @@ void stereo_decoder_tcx_fx( const Word16 last_core_l, /* i : last core for left channel */ const Word16 last_core_r, /* i : last core for right channel */ const Word16 tmp_plc_upmix /* i : indicates temp upmix for PLC decision */ -#ifndef OPT_SBA_DEC_PATH - , - Word16 *q_x_ch2, - Word16 *q_x_ch1 -#endif /* OPT_SBA_DEC_PATH */ ); void v_multc_acc_32_16( diff --git a/lib_com/options.h b/lib_com/options.h index 98bf33a6b..e0007670d 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,7 +77,6 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE #define OPT_BIN_REND_V2_NBE -#define OPT_SBA_DEC_PATH /* Optimization made in SBA decoding path */ #define OPT_IVAS_FILTER_ROM /* Optimization made in IVAS filter table */ /* Both following 2 macros (IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST*) are independent from each other, they refer to different code blocks */ //#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version. Obsoleted by MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE. */ diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index d989607a1..e77563e6d 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -1779,67 +1779,36 @@ void ivas_qmetadata_to_dirac_fx( } ELSE { -#ifndef OPT_SBA_DEC_PATH - Word16 tmp1, tmp4; -#endif /* OPT_SBA_DEC_PATH */ Word16 a, b_tmp; Word16 exp_factor = 0; move16(); a = rand_triangular_signed_fx( seed_ptr, &exp_factor ); // q = exp_factor -#ifndef OPT_SBA_DEC_PATH - tmp1 = mult( a, dirac_dithering_azi_scale_fx[diff_idx] ); // exp_factor + 5 - - Word32 tmp1_32 = L_deposit_h( tmp1 ); -#else /* OPT_SBA_DEC_PATH */ Word32 tmp1_32 = L_mult( a, dirac_dithering_azi_scale_fx[diff_idx] ); // exp_factor + 5 -#endif /* OPT_SBA_DEC_PATH */ Word16 final_1_exp; Word32 final_1_32; -#ifndef OPT_SBA_DEC_PATH - final_1_32 = BASOP_Util_Add_Mant32Exp( azimuth_fx, 9, tmp1_32, add( exp_factor, 5 ), &final_1_exp ); -#else /* OPT_SBA_DEC_PATH */ Word16 norm_op1 = norm_l( azimuth_fx ); Word16 norm_op2 = norm_l( tmp1_32 ); Word16 op2_e = add( exp_factor, 5 ); final_1_exp = add( s_max( s_max( sub( 9, norm_op1 ), sub( op2_e, norm_op2 ) ), 0 ), 2 ); // 2 for headroom final_1_32 = L_add( L_shr( azimuth_fx, sub( final_1_exp, 9 ) ), L_shr( tmp1_32, sub( final_1_exp, op2_e ) ) ); -#endif /* OPT_SBA_DEC_PATH */ b_tmp = rand_triangular_signed_fx( seed_ptr, &exp_factor ); // q = exp_factor -#ifndef OPT_SBA_DEC_PATH - tmp4 = mult( b_tmp, dirac_dithering_ele_scale_fx[diff_idx] ); // exp_factor + 4 - - Word32 tmp4_32 = L_deposit_h( tmp4 ); -#else /* OPT_SBA_DEC_PATH */ Word32 tmp4_32 = L_mult( b_tmp, dirac_dithering_ele_scale_fx[diff_idx] ); // exp_factor + 4 -#endif /* OPT_SBA_DEC_PATH */ Word16 final_2_exp; Word32 final_2_32; -#ifndef OPT_SBA_DEC_PATH - final_2_32 = BASOP_Util_Add_Mant32Exp( elevation_fx, 9, tmp4_32, add( exp_factor, 4 ), &final_2_exp ); -#else /* OPT_SBA_DEC_PATH */ norm_op1 = norm_l( elevation_fx ); norm_op2 = norm_l( tmp4_32 ); op2_e = add( exp_factor, 4 ); final_2_exp = add( s_max( s_max( sub( 9, norm_op1 ), sub( op2_e, norm_op2 ) ), 0 ), 2 ); // 2 for headroom final_2_32 = L_add( L_shr( elevation_fx, sub( final_2_exp, 9 ) ), L_shr( tmp4_32, sub( final_2_exp, op2_e ) ) ); -#endif /* OPT_SBA_DEC_PATH */ - -#ifndef OPT_SBA_DEC_PATH - final_1_32 = BASOP_Util_Add_Mant32Exp( final_1_32, final_1_exp, ONE_IN_Q30, 0, &final_1_exp ); /*0.5 in q31*/ - final_2_32 = BASOP_Util_Add_Mant32Exp( final_2_32, final_2_exp, ONE_IN_Q30, 0, &final_2_exp ); - azi = extract_h( L_shr( final_1_32, sub( sub( 31, final_1_exp ), 16 ) ) ); - ele = extract_h( L_shr( final_2_32, sub( sub( 31, final_2_exp ), 16 ) ) ); -#else /* OPT_SBA_DEC_PATH */ final_1_32 = L_add( final_1_32, L_shl( 1, sub( 30, final_1_exp ) ) ); /*0.5 in q31*/ final_2_32 = L_add( final_2_32, L_shl( 1, sub( 30, final_2_exp ) ) ); azi = extract_h( L_shr( final_1_32, sub( 15, final_1_exp ) ) ); ele = extract_h( L_shr( final_2_32, sub( 15, final_2_exp ) ) ); -#endif /* OPT_SBA_DEC_PATH */ /*addition of one to compensate precision loss*/ diff --git a/lib_dec/ivas_mct_core_dec_fx.c b/lib_dec/ivas_mct_core_dec_fx.c index 1222eccf1..2762fc835 100644 --- a/lib_dec/ivas_mct_core_dec_fx.c +++ b/lib_dec/ivas_mct_core_dec_fx.c @@ -199,9 +199,6 @@ void ivas_mct_core_dec( Word16 tcx_offsetFB; Word16 left_rect; Word16 L_spec; -#ifndef OPT_SBA_DEC_PATH - Word16 scale, tmp1, tmp2; -#endif /* OPT_SBA_DEC_PATH */ #ifdef DEBUG_MCT float nrg[MCT_MAX_CHANNELS]; #endif @@ -221,18 +218,10 @@ void ivas_mct_core_dec( move16(); FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { -#ifndef OPT_SBA_DEC_PATH - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - sts[i] = hCPE[cpe_id]->hCoreCoder[ch]; - i = add( i, 1 ); - } -#else /* OPT_SBA_DEC_PATH */ FOR( ch = 0; ch < CPE_CHANNELS; ( ch++, i++ ) ) { sts[i] = hCPE[cpe_id]->hCoreCoder[ch]; } -#endif /* OPT_SBA_DEC_PATH */ } i = 0; @@ -278,7 +267,6 @@ void ivas_mct_core_dec( { CONTINUE; } -#ifdef OPT_SBA_DEC_PATH IF( EQ_16( st->core, TCX_10_CORE ) ) { Word16 L_frame_2 = shr( st->L_frame, 1 ); @@ -332,43 +320,6 @@ void ivas_mct_core_dec( move16(); } } -#else /* OPT_SBA_DEC_PATH */ - IF( EQ_16( st->core, TCX_10_CORE ) ) - { - nSubframes = NB_DIV; - } - ELSE - { - nSubframes = 1; - } - move16(); - - FOR( k = 0; k < nSubframes; k++ ) - { - L_spec = BASOP_Util_Divide1616_Scale( st->hTcxCfg->tcx_coded_lines, nSubframes, &scale ); - L_spec = shr( L_spec, sub( 15, scale ) ); - - tmp1 = BASOP_Util_Divide1616_Scale( st->L_frame, nSubframes, &scale ); - tmp1 = shr( tmp1, sub( 15, scale ) ); - tmp2 = BASOP_Util_Divide1616_Scale( st->hTcxDec->L_frameTCX, nSubframes, &scale ); - tmp2 = shr( tmp1, sub( 15, scale ) ); - init_tcx_info_fx( st, tmp1, tmp2, k, bfi, &tcx_offset, &tcx_offsetFB, &L_frame, &L_frameTCX, &left_rect, &L_spec ); - - Word16 x_e, x_len; - /* mono or dual mono IGF decoding */ - x_e = sub( 31, q_x[ch] ); - decoder_tcx_IGF_mono_fx( st, x_fx[ch][k], &x_e, &x_len, L_frame, left_rect, bfi, k ); - q_x[ch] = sub( 31, x_e ); - move16(); - FOR( i = 0; i < x_len; i++ ) - { - x_fx[ch][k][i] = L_shr( x_fx[ch][k][i], sub( q_x[ch], Q11 ) ); - move32(); - } - q_x[ch] = Q11; - move16(); - } -#endif /* OPT_SBA_DEC_PATH */ } } ELSE @@ -383,23 +334,7 @@ void ivas_mct_core_dec( * MCT processing *--------------------------------------------------------------------------------*/ -#ifdef OPT_SBA_DEC_PATH apply_MCT_dec_fx( hMCT, sts, x_fx ); -#else /* OPT_SBA_DEC_PATH */ - apply_MCT_dec_fx( hMCT, sts, x_fx, q_x ); - FOR( ch = 0; ch < nChannels; ch++ ) - { - FOR( i = 0; i < L_FRAME48k / 2; i++ ) - { - x_fx[ch][0][i] = L_shr( x_fx[ch][0][i], sub( q_x[ch], Q11 ) ); - x_fx[ch][1][i] = L_shr( x_fx[ch][1][i], sub( q_x[ch], Q11 ) ); - move32(); - move32(); - } - q_x[ch] = Q11; - move16(); - } -#endif /* OPT_SBA_DEC_PATH */ } pop_wmops(); diff --git a/lib_dec/ivas_mct_dec_mct_fx_fx.c b/lib_dec/ivas_mct_dec_mct_fx_fx.c index 050385b96..824fa5697 100644 --- a/lib_dec/ivas_mct_dec_mct_fx_fx.c +++ b/lib_dec/ivas_mct_dec_mct_fx_fx.c @@ -166,10 +166,6 @@ static void applyGlobalILD_fx( Decoder_State **sts, MCT_DEC_HANDLE hMCT, Word32 *x[MCT_MAX_CHANNELS][NB_DIV] -#ifndef OPT_SBA_DEC_PATH - , - Word16 q_x[MCT_MAX_CHANNELS] -#endif /* OPT_SBA_DEC_PATH */ ) { Word16 ch, k; @@ -211,14 +207,8 @@ static void applyGlobalILD_fx( FOR( k = 0; k < nSubframes; k++ ) { v_multc_fixed( x[ch][k], qratio, x[ch][k], L_subframeTCX ); // Qx - 5 + q_qratio -#ifdef OPT_SBA_DEC_PATH scale_sig32( x[ch][k], L_subframeTCX, sub( 5, q_qratio ) ); -#endif /* OPT_SBA_DEC_PATH */ } -#ifndef OPT_SBA_DEC_PATH - q_x[ch] = add( sub( q_x[ch], 5 ), q_qratio ); - move16(); -#endif /* OPT_SBA_DEC_PATH */ } ELSE { @@ -240,10 +230,6 @@ void apply_MCT_dec_fx( MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ Decoder_State **sts, /* i/o: decoder state structure */ Word32 *x[MCT_MAX_CHANNELS][NB_DIV] /* i/o: decoded and dequan. spect. input to MCT */ -#ifndef OPT_SBA_DEC_PATH - , - Word16 q_x[MCT_MAX_CHANNELS] -#endif /* OPT_SBA_DEC_PATH */ ) { Word16 pair; @@ -253,18 +239,10 @@ void apply_MCT_dec_fx( { hBlock = hMCT->hBlockData[pair]; -#ifndef OPT_SBA_DEC_PATH - stereo_decoder_tcx_fx( hBlock->hStereoMdct, hBlock->mask, &x[hBlock->ch2][0], &x[hBlock->ch1][0], &x[hBlock->ch2][0], hBlock->hStereoMdct->mdct_stereo_mode, sts[hBlock->ch1]->core, sts[hBlock->ch2]->core, sts[0]->igf, sts[0]->hTcxDec->L_frameTCX, sts[1]->hTcxDec->L_frameTCX, 1, TCX_20_CORE, TCX_20_CORE, 0, &q_x[hBlock->ch2], &q_x[hBlock->ch1] ); -#else /* OPT_SBA_DEC_PATH */ stereo_decoder_tcx_fx( hBlock->hStereoMdct, hBlock->mask, &x[hBlock->ch2][0], &x[hBlock->ch1][0], &x[hBlock->ch2][0], hBlock->hStereoMdct->mdct_stereo_mode, sts[hBlock->ch1]->core, sts[hBlock->ch2]->core, sts[0]->igf, sts[0]->hTcxDec->L_frameTCX, sts[1]->hTcxDec->L_frameTCX, 1, TCX_20_CORE, TCX_20_CORE, 0 ); -#endif /* OPT_SBA_DEC_PATH */ } -#ifndef OPT_SBA_DEC_PATH - applyGlobalILD_fx( sts, hMCT, x, q_x ); -#else /* OPT_SBA_DEC_PATH */ applyGlobalILD_fx( sts, hMCT, x ); -#endif /* OPT_SBA_DEC_PATH */ return; } diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index 9e26be4d5..458af213e 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -737,11 +737,7 @@ void ivas_mdct_core_invQ_fx( q_r = sub( 30, sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp ); /* both input in same Q */ -#ifndef OPT_SBA_DEC_PATH - stereo_decoder_tcx_fx( hCPE->hStereoMdct, ms_mask, x_0[1], &spectralData_tmp[0], &spectralData_tmp[1], &hCPE->hStereoMdct->mdct_stereo_mode[0], sts[0]->core, sts[1]->core, sts[0]->igf, L_frameTCX[0], L_frameTCX[1], 0, sts[0]->last_core, sts[1]->last_core, 1, &q_r, &q_l ); -#else /* OPT_SBA_DEC_PATH */ stereo_decoder_tcx_fx( hCPE->hStereoMdct, ms_mask, x_0[1], &spectralData_tmp[0], &spectralData_tmp[1], &hCPE->hStereoMdct->mdct_stereo_mode[0], sts[0]->core, sts[1]->core, sts[0]->igf, L_frameTCX[0], L_frameTCX[1], 0, sts[0]->last_core, sts[1]->last_core, 1 ); -#endif /* OPT_SBA_DEC_PATH */ Copy_Scale_sig_32_16( spectralData_tmp[0], sts[0]->hTonalMDCTConc->lastBlockData.spectralData, L_frameTCX[0], -15 ); // q_l - 15 Copy_Scale_sig_32_16( spectralData_tmp[1], sts[1]->hTonalMDCTConc->lastBlockData.spectralData, L_frameTCX[1], -15 ); // q_r - 15 diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index 6a661ea50..8a1d339d4 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -438,17 +438,8 @@ void stereo_mdct_core_dec_fx( test(); IF( ( !bfi || ( sts[0]->core != ACELP_CORE || sts[1]->core != ACELP_CORE ) ) && !hCPE->hStereoMdct->isSBAStereoMode ) { -#ifndef OPT_SBA_DEC_PATH - Word16 q_x_1 = 11, q_x_0 = 11; - move16(); - move16(); -#endif /* OPT_SBA_DEC_PATH */ -#ifdef OPT_SBA_DEC_PATH stereo_decoder_tcx_fx( hCPE->hStereoMdct, ms_mask, x_0_fx[1], x_fx[0], x_fx[1], &hCPE->hStereoMdct->mdct_stereo_mode[0], sts[0]->core, sts[1]->core, sts[0]->igf, L_frameTCX[0], L_frameTCX[1], 0, sts[0]->last_core, sts[1]->last_core, 0 ); -#else /* OPT_SBA_DEC_PATH */ - stereo_decoder_tcx_fx( hCPE->hStereoMdct, ms_mask, x_0_fx[1], x_fx[0], x_fx[1], &hCPE->hStereoMdct->mdct_stereo_mode[0], sts[0]->core, sts[1]->core, sts[0]->igf, L_frameTCX[0], L_frameTCX[1], 0, sts[0]->last_core, sts[1]->last_core, 0, &q_x_1, &q_x_0 ); -#endif /* OPT_SBA_DEC_PATH */ } ivas_mdct_core_tns_ns_fx( hCPE, fUseTns, tnsData, x_fx, Aq_fx_32, 0, 20 ); diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index 492060a67..c34fd8624 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -314,11 +314,6 @@ void stereo_decoder_tcx_fx( const Word16 last_core_l, /* i : last core for left channel Q0*/ const Word16 last_core_r, /* i : last core for right channel Q0*/ const Word16 tmp_plc_upmix /* i : indicates temp upmix for PLC decision Q0*/ -#ifndef OPT_SBA_DEC_PATH - , - Word16 *q_x_ch2, - Word16 *q_x_ch1 -#endif /* OPT_SBA_DEC_PATH */ ) { Word16 i, k, sfb, nSubframes; @@ -365,12 +360,6 @@ void stereo_decoder_tcx_fx( } } inverseMS_fx( sfbConf->sfbOffset[sfbConf->nBandsStereoCore], spec_l[k], spec_r[k], SQRT2_OVER_2_FIXED ); -#ifndef OPT_SBA_DEC_PATH - *q_x_ch2 = *q_x_ch2; - move16(); - *q_x_ch1 = *q_x_ch1; - move16(); -#endif /* OPT_SBA_DEC_PATH */ } ELSE IF( EQ_16( mdct_stereo_mode[k], SMDCT_BW_MS ) ) { @@ -387,12 +376,6 @@ void stereo_decoder_tcx_fx( } } inverseBwMS_fx( sfbConf->sfbOffset[sfb], sfbConf->sfbOffset[sfb + 1], spec_l[k], spec_r[k], SQRT2_OVER_2_FIXED ); -#ifndef OPT_SBA_DEC_PATH - *q_x_ch2 = *q_x_ch2; - move16(); - *q_x_ch1 = *q_x_ch1; - move16(); -#endif /* OPT_SBA_DEC_PATH */ } } } @@ -410,12 +393,6 @@ void stereo_decoder_tcx_fx( } } inverseMS_fx( sub( sfbConf->sfbOffset[sfbConf->sfbCnt], sfbConf->sfbOffset[sfbConf->nBandsStereoCore] ), &spec_l[k][sfbConf->sfbOffset[sfbConf->nBandsStereoCore]], &spec_r[k][sfbConf->sfbOffset[sfbConf->nBandsStereoCore]], SQRT2_OVER_2_FIXED ); -#ifndef OPT_SBA_DEC_PATH - *q_x_ch2 = *q_x_ch2; - move16(); - *q_x_ch1 = *q_x_ch1; - move16(); -#endif /* OPT_SBA_DEC_PATH */ } ELSE IF( EQ_16( hStereoMdct->IGFStereoMode[k], SMDCT_BW_MS ) ) { @@ -432,12 +409,6 @@ void stereo_decoder_tcx_fx( } } inverseBwMS_fx( sfbConf->sfbOffset[sfb], sfbConf->sfbOffset[sfb + 1], spec_l[k], spec_r[k], SQRT2_OVER_2_FIXED ); -#ifndef OPT_SBA_DEC_PATH - *q_x_ch2 = *q_x_ch2; - move16(); - *q_x_ch1 = *q_x_ch1; - move16(); -#endif /* OPT_SBA_DEC_PATH */ } } } @@ -495,10 +466,6 @@ void stereo_decoder_tcx_fx( nrgRatio = L_shl( nrgRatio, shift ); /* Q26 + shift */ v_multc_fixed( spec_r[k], nrgRatio, spec_r[k], L_frameTCX_r ); /* spec_r will be in Qx + shift - Q5 */ Scale_sig32( spec_r[k], L_frameTCX_r, sub( 5, shift ) ); /* Qx */ -#ifndef OPT_SBA_DEC_PATH - *q_x_ch2 = *q_x_ch2; - move16(); -#endif /* OPT_SBA_DEC_PATH */ } ELSE IF( ( LT_32( nrgRatio, ONE_IN_Q26 ) ) && ( LT_16( k, tmp2 ) ) ) { @@ -506,10 +473,6 @@ void stereo_decoder_tcx_fx( shift = sub( 5, tmp_e ); v_multc_fixed( spec_l[k], inv_nrgRatio, spec_l[k], L_frameTCX_l ); /* spec_r will be in Qx - tmp_e */ Scale_sig32( spec_l[k], L_frameTCX_l, sub( 5, shift ) ); /* Qx */ -#ifndef OPT_SBA_DEC_PATH - *q_x_ch1 = *q_x_ch1; - move16(); -#endif /* OPT_SBA_DEC_PATH */ } } } /* for k */ diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 05c27811f..1a5d0a18e 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -807,7 +807,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( ONE_IN_Q29 /*0.25f Q31*/, h_dirac_output_synthesis_state->diffuse_power_factor_fx, num_freq_bands ); /*h_dirac_output_synthesis_state->diffuse_power_factor_q+Q31-Q31->h_dirac_output_synthesis_state->diffuse_power_factor_q*/ -#ifdef OPT_SBA_DEC_PATH /*Direct gain*/ Word16 *exp_temp_cy_cross_dir_smooth_fx = (Word16 *) malloc( num_freq_bands * num_channels_dir * sizeof( Word16 ) ); @@ -1077,281 +1076,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } free( exp_temp_cy_cross_dir_smooth_fx ); -#else /* OPT_SBA_DEC_PATH */ - /*Direct gain*/ - - Word16 *Q_temp_cy_cross_dir_smooth_fx = (Word16 *) malloc( num_freq_bands * num_channels_dir * sizeof( Word16 ) ); - - Word16 tmp16 = imult1616( num_freq_bands, num_channels_dir ); - FOR( Word16 kk = 0; kk < tmp16; kk++ ) - { - h_dirac_output_synthesis_state->Q_temp_cy_cross_dir_smooth_fx[kk] = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth; - move16(); - } - - FOR( ch_idx = 0; ch_idx < s_min( 4, nchan_transport ); ch_idx++ ) - { - Word16 k; - IF( ch_idx != 0 ) - { - Word32 a, c; - Word16 b, b_exp, sqr_exp, q_diff_aab, q_diff_c; - Word32 mpy_a_a_b, mpy_diff_c, mpy_diff_aab; - Word32 sqr_inp, sqr; - - /*Directonal sound gain nrg compensation*/ - c = L_add( ONE_IN_Q29 /*1 Q29*/, Mpy_32_16_1( L_sub( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr_fx, ONE_IN_Q29 /*1 Q29*/ ), 5461 /*1.0 / 6.0 Q15*/ ) ); /*Diffuseness modellling nrg compensation*/ /*Q29*/ - FOR( k = 0; k < num_freq_bands_diff; k++ ) - { - a = h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + k]; // Q = h_dirac_output_synthesis_state->q_direct_responses - move32(); - IF( reference_power[k + num_freq_bands] == 0 ) - { - b = 0; - move16(); - b_exp = 0; - move16(); - } - ELSE - { - IF( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] == 0 ) - { - b = MAX_16; - move16(); - b_exp = 0; - move16(); - } - ELSE - { - b = BASOP_Util_Divide3232_Scale( reference_power[k + num_freq_bands], reference_power[k + ( ch_idx + 1 ) * num_freq_bands], &b_exp ); /*Q(15-b_exp)*/ - } - } - - mpy_a_a_b = Mpy_32_32( a, Mpy_32_16_1( a, b ) ); // Q = (h_dirac_output_synthesis_state->q_direct_responses + (15 - b_exp) - 15) + (h_dirac_output_synthesis_state->q_direct_responses) - 31 - mpy_diff_aab = Mpy_32_32( L_sub( L_shl( 1, q_diffuseness ), diffuseness[k] ), mpy_a_a_b ); // Q(q_diff_aab) = 2*(h_dirac_output_synthesis_state->q_direct_responses) - b_exp - 31 + q_diffuseness -31 - mpy_diff_c = Mpy_32_32( diffuseness[k], c ); // Q(q_diff_c) = q_diffuseness - 2 - - q_diff_aab = add( sub( add( h_dirac_output_synthesis_state->direct_responses_q, sub( 15, b_exp ) ), 15 ), add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); - q_diff_c = sub( q_diffuseness, 2 ); - - test(); - IF( mpy_diff_c != 0 && mpy_diff_aab != 0 ) - { - sqr_inp = BASOP_Util_Add_Mant32Exp( mpy_diff_c, sub( 31, q_diff_c ), mpy_diff_aab, sub( 31, q_diff_aab ), &sqr_exp ); /*Q(31-sqr_exp)*/ - } - ELSE - { - IF( mpy_diff_c == 0 ) - { - sqr_inp = mpy_diff_aab; /*Q(q_diff_aab)*/ - move32(); - sqr_exp = sub( 31, q_diff_aab ); - } - ELSE - { - sqr_inp = mpy_diff_c; /*Q(q_diff_c)*/ - move32(); - sqr_exp = sub( 31, q_diff_c ); - } - } - sqr = Sqrt32( sqr_inp, &sqr_exp ); /*Q(31-sqr_exp)*/ - sqr = L_shr( sqr, 2 ); /*Q(31-sqr_exp)*/ - IF( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] != 0 ) - { - IF( LT_16( sub( 31, sqr_exp ), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = L_shr( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k], sub( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, sub( 31, sqr_exp ) ) ); /*h_dirac_output_synthesis_state->q_cy_cross_dir_smooth-> (31-sqr_exp) */ - move32(); - h_dirac_output_synthesis_state->Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); - move16(); - } - ELSE - { - sqr = L_shr( sqr, sub( sub( 31, sqr_exp ), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ); /*( 31- sqr_exp )-> h_dirac_output_synthesis_state->q_cy_cross_dir_smooth*/ - h_dirac_output_synthesis_state->Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth; - move16(); - } - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = L_add( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k], sqr ); /*Q_temp_cy_cross_dir_smooth_fx*/ - move32(); - } - ELSE - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = L_add( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k], sqr ); /*31-sqr_exp*/ - move32(); - h_dirac_output_synthesis_state->Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); - move16(); - } - } - c = Madd_32_16( ONE_IN_Q27 /*1 Q27*/, L_sub( h_dirac_output_synthesis_params->diffuse_compensation_factor_fx, ONE_IN_Q27 /*1 Q27*/ ), 5461 ); /*Diffuseness modellling nrg compensation*/ /* 1.0 / 6.0 = 5461 in Q15*/ /*Q27*/ - FOR( ; k < num_freq_bands; k++ ) - { - a = h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + k]; // Q = h_dirac_output_synthesis_state->q_direct_responses - move32(); - IF( reference_power[k + num_freq_bands] == 0 ) - { - sqr_inp = Mpy_32_32( diffuseness[k], c ); - sqr_exp = sub( 31 + 4, q_diffuseness ); - } - ELSE - { - Word16 diff_c_exp; - Word16 diff_aab_exp; - IF( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] == 0 ) - { - mpy_a_a_b = Mpy_32_32( a, a ); // Q = (h_dirac_output_synthesis_state->q_direct_responses + (15 - b_exp) - 15) + (h_dirac_output_synthesis_state->q_direct_responses) - 31 - mpy_diff_aab = Mpy_32_32( L_sub( L_shl( 1, q_diffuseness ), diffuseness[k] ), mpy_a_a_b ); // Q = 2*(h_dirac_output_synthesis_state->q_direct_responses) - b_exp - 31 + q_diffuseness -31 - mpy_diff_c = Mpy_32_32( diffuseness[k], c ); // Q = q_diffuseness - 4 - diff_aab_exp = sub( 31 + 62, add( h_dirac_output_synthesis_state->direct_responses_q, add( h_dirac_output_synthesis_state->direct_responses_q, q_diffuseness ) ) ); - diff_c_exp = sub( 31 + 4, q_diffuseness ); - - sqr_inp = BASOP_Util_Add_Mant32Exp( mpy_diff_c, diff_c_exp, mpy_diff_aab, diff_aab_exp, &sqr_exp ); /*q(31-sqr_exp)*/ - } - ELSE - { - b = BASOP_Util_Divide3232_Scale( reference_power[k + num_freq_bands], reference_power[k + ( ch_idx + 1 ) * num_freq_bands], &b_exp ); /*q(15-b_exp)*/ - - mpy_a_a_b = Mpy_32_32( a, Mpy_32_16_1( a, b ) ); // Q = (h_dirac_output_synthesis_state->q_direct_responses + (15 - b_exp) - 15) + (h_dirac_output_synthesis_state->q_direct_responses) - 31 - mpy_diff_aab = Mpy_32_32( L_sub( L_shl( 1, q_diffuseness ), diffuseness[k] ), mpy_a_a_b ); // Q = 2*(h_dirac_output_synthesis_state->q_direct_responses) - b_exp - 31 + q_diffuseness -31 - mpy_diff_c = Mpy_32_32( diffuseness[k], c ); // Q = q_diffuseness - 4 - diff_aab_exp = sub( sub( add( sub( 31 + 62, h_dirac_output_synthesis_state->direct_responses_q ), b_exp ), h_dirac_output_synthesis_state->direct_responses_q ), q_diffuseness ); - diff_c_exp = sub( 31 + 4, q_diffuseness ); - - sqr_inp = BASOP_Util_Add_Mant32Exp( mpy_diff_c, diff_c_exp, mpy_diff_aab, diff_aab_exp, &sqr_exp ); /*q(31-sqr_exp)*/ - } - } - sqr = Sqrt32( sqr_inp, &sqr_exp ); /*Q(31-sqr_exp)*/ - sqr = L_shr( sqr, 2 ); /*Q(31-sqr_exp)*/ - - - IF( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] != 0 ) - { - IF( LT_16( sub( 31, sqr_exp ), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = L_shr( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k], sub( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, sub( 31, sqr_exp ) ) ); /*h_dirac_output_synthesis_state->q_cy_cross_dir_smooth->Q( 31- sqr_exp )*/ - move32(); - h_dirac_output_synthesis_state->Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); - move16(); - } - ELSE - { - sqr = L_shr( sqr, sub( sub( 31, sqr_exp ), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ); /*Q(31- sqr_exp)->h_dirac_output_synthesis_state->q_cy_cross_dir_smooth*/ - h_dirac_output_synthesis_state->Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth; - move16(); - } - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = L_add( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k], sqr ); /*Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k]*/ - move32(); - } - ELSE - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = L_add( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k], sqr ); /*Q(31- sqr_exp)*/ - move32(); - h_dirac_output_synthesis_state->Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); - move16(); - } - } - } - ELSE - { - Word32 sqr_inp, mpy_diff, sqr; - Word16 sqr_exp; - /*Diffuseness modellling nrg compensation*/ - FOR( k = 0; k < num_freq_bands_diff; k++ ) - { - /*diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) )*/ - mpy_diff = Mpy_32_32( diffuseness[k], L_sub( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr_fx /*q29=0.5 * q30*/, ONE_IN_Q29 /*0.5 Q30*/ ) /*q30*/ ); // Q = q_diffuseness - 1 - sqr_inp = L_add( L_shl( 1, sub( q_diffuseness, 1 ) ), mpy_diff ); // Q = q_diffuseness - 1 - sqr_exp = sub( 31, sub( q_diffuseness, 1 ) ); - sqr = Sqrt32( sqr_inp, &sqr_exp ); /*Q(31-sqr_exp)*/ - sqr = L_shr( sqr, 2 ); /*Q(31-sqr_exp)*/ - IF( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] != 0 ) - { - IF( LT_16( sub( 31, sqr_exp ), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = L_shr( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k], sub( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, sub( 31, sqr_exp ) ) ); /*h_dirac_output_synthesis_state->q_cy_cross_dir_smooth->Q(31- sqr_exp)*/ - move32(); - h_dirac_output_synthesis_state->Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); - move16(); - } - ELSE - { - sqr = L_shr( sqr, sub( sub( 31, sqr_exp ), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ); /*Q(31-sqr_exp)->h_dirac_output_synthesis_state->q_cy_cross_dir_smooth*/ - h_dirac_output_synthesis_state->Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth; - move16(); - } - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = L_add( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k], sqr ); /*Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k]*/ - move32(); - } - ELSE - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = L_add( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k], sqr ); /*Q(31-sqr_exp)*/ - move32(); - h_dirac_output_synthesis_state->Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); - move16(); - } - } - FOR( ; k < num_freq_bands; k++ ) - { - mpy_diff = Mpy_32_32( diffuseness[k], L_sub( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr_fx, ONE_IN_Q29 /*1 Q29*/ ) ); // Q = q_diffuseness - 1 - sqr_inp = L_add( L_shl( 1, sub( q_diffuseness, 1 ) ), mpy_diff ); // Q = q_diffuseness - 1 - sqr_exp = sub( 31, sub( q_diffuseness, 1 ) ); - sqr = Sqrt32( sqr_inp, &sqr_exp ); /*Q(31-sqr_exp)*/ - sqr = L_shr( sqr, 2 ); /*Q(31-sqr_exp)*/ - IF( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] != 0 ) - { - IF( LT_16( sub( 31, sqr_exp ), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = L_shr( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k], sub( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, sub( 31, sqr_exp ) ) ); /*h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, Q( 31- sqr_exp )*/ - move32(); - h_dirac_output_synthesis_state->Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); - move16(); - } - ELSE - { - sqr = L_shr( sqr, sub( sub( 31, sqr_exp ), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ); /*Q( 31- sqr_exp ), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth*/ - h_dirac_output_synthesis_state->Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth; - move16(); - } - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = L_add( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k], sqr ); /*Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k]*/ - move32(); - } - ELSE - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = L_add( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k], sqr ); /*Q(31-sqr_exp)*/ - move32(); - h_dirac_output_synthesis_state->Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); - move16(); - } - } - } - } - Word16 temp = MAX_16; /*q0*/ - move16(); - tmp16 = imult1616( num_freq_bands, num_channels_dir ); - FOR( Word16 kk = 0; kk < tmp16; kk++ ) - { - temp = s_min( h_dirac_output_synthesis_state->Q_temp_cy_cross_dir_smooth_fx[kk], temp ); - } - h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = temp; - move16(); - FOR( Word16 kk = 0; kk < tmp16; kk++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[kk] = L_shl( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[kk], sub( temp, h_dirac_output_synthesis_state->Q_temp_cy_cross_dir_smooth_fx[kk] ) ); /*Q_temp_cy_cross_dir_smooth_fx[kk]->temp*/ - move32(); - } - /*Directional gain (panning)*/ - Word16 temp_q = sub( add( h_dirac_output_synthesis_state->direct_power_factor_q, h_dirac_output_synthesis_state->direct_responses_q ), 31 ); - IF( LT_16( temp_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ) - { - Word16 temp_q1 = sub( temp_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ); - FOR( Word16 kk = 0; kk < tmp16; kk++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[kk] = L_shl( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[kk], temp_q1 ); /*h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ->temp_q*/ - move32(); - } - h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = temp_q; - move16(); - } -#endif /* OPT_SBA_DEC_PATH */ Word16 temp_q1 = sub( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, temp_q ); FOR( ch_idx = s_min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) @@ -1846,20 +1570,12 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( /*Direct input->output*/ p_gains_dir = h_dirac_output_synthesis_state.cy_cross_dir_smooth_prev_fx; // (p_gains_dir_q) p_gains_dir_prev = h_dirac_output_synthesis_state.gains_dir_prev_fx; -#ifdef OPT_SBA_DEC_PATH q_shift = sub( h_dirac_output_synthesis_state.q_cy_cross_dir_smooth_prev, h_dirac_output_synthesis_state.gains_dir_prev_q ); -#endif /* OPT_SBA_DEC_PATH */ FOR( ch_idx = 0; ch_idx < num_channels_dir; ch_idx++ ) { -#ifdef OPT_SBA_DEC_PATH Scale_sig32( &h_dirac_output_synthesis_state.gains_dir_prev_fx[ch_idx * num_freq_bands], num_freq_bands, q_shift ); /*h_dirac_output_synthesis_state.gains_dir_prev_q->h_dirac_output_synthesis_state.q_cy_cross_dir_smooth_prev*/ -#else /* OPT_SBA_DEC_PATH */ - Scale_sig32( &h_dirac_output_synthesis_state.gains_dir_prev_fx[ch_idx * num_freq_bands], - num_freq_bands, - sub( h_dirac_output_synthesis_state.q_cy_cross_dir_smooth_prev, h_dirac_output_synthesis_state.gains_dir_prev_q ) ); /*h_dirac_output_synthesis_state.gains_dir_prev_q->h_dirac_output_synthesis_state.q_cy_cross_dir_smooth_prev*/ -#endif /* OPT_SBA_DEC_PATH */ } h_dirac_output_synthesis_state.gains_dir_prev_q = h_dirac_output_synthesis_state.q_cy_cross_dir_smooth_prev; move16(); -- GitLab From 468f229fdaeef0c6246e824295a6cbf13689ee48 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:55:01 +0200 Subject: [PATCH 17/35] [cleanup] accept OPT_IVAS_FILTER_ROM --- lib_com/cldfb_fx.c | 455 ------------------------------ lib_com/options.h | 1 - lib_com/rom_com.c | 238 ---------------- lib_com/rom_com_fx.h | 19 -- lib_com/stat_com.h | 4 - lib_isar/isar_splitRendererPost.c | 8 - lib_isar/lib_isar_post_rend.c | 4 - lib_isar/lib_isar_pre_rend.c | 8 - 8 files changed, 737 deletions(-) diff --git a/lib_com/cldfb_fx.c b/lib_com/cldfb_fx.c index 30b8d57d0..886a23758 100644 --- a/lib_com/cldfb_fx.c +++ b/lib_com/cldfb_fx.c @@ -104,12 +104,7 @@ void cldfbAnalysis_ivas_fx( Word32 iBuffer_fx[2 * CLDFB_NO_CHANNELS_MAX]; const Word32 *rot_vctr_re_fx; const Word32 *rot_vctr_im_fx; -#ifdef OPT_IVAS_FILTER_ROM const Word32 *ptr_pf_fx; -#else /* OPT_IVAS_FILTER_ROM */ - const Word16 *ptr_pf_fx; - Word16 ptr_pf_sf; -#endif /* OPT_IVAS_FILTER_ROM */ Word32 *timeBuffer_fx, buffer_fx[( CLDFB_NO_CHANNELS_MAX * CLDFB_NO_COL_MAX ) + ( 9 * CLDFB_NO_CHANNELS_MAX )]; Word16 offset, frameSize; @@ -151,12 +146,7 @@ void cldfbAnalysis_ivas_fx( rot_vctr_re_fx = h_cldfb->rot_vec_ana_re_fx; rot_vctr_im_fx = h_cldfb->rot_vec_ana_im_fx; -#ifdef OPT_IVAS_FILTER_ROM ptr_pf_fx = h_cldfb->p_filter_32; -#else /* OPT_IVAS_FILTER_ROM */ - ptr_pf_fx = h_cldfb->p_filter; - ptr_pf_sf = h_cldfb->p_filter_sf; // Q14 -#endif /* OPT_IVAS_FILTER_ROM */ move16(); FOR( i = 0; i < no_col; i++ ) @@ -164,7 +154,6 @@ void cldfbAnalysis_ivas_fx( FOR( k = 0; k < M4; k++ ) { /* prototype filter */ -#ifdef OPT_IVAS_FILTER_ROM r1_fx = Msub_32_32( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // Qx r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // Qx r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // Qx @@ -189,36 +178,6 @@ void cldfbAnalysis_ivas_fx( i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // Qx i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // Qx -#else /* OPT_IVAS_FILTER_ROM */ - r1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // Qx - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // Qx - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // Qx - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // Qx - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // Qx - - r2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 0 * L2 )] ); // Qx - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 1 * L2 )] ); // Qx - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 2 * L2 )] ); // Qx - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 3 * L2 )] ); // Qx - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 4 * L2 )] ); // Qx - - i1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )] ); // Qx - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )] ); // Qx - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )] ); // Qx - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )] ); // Qx - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )] ); // Qx - - i2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // Qx - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // Qx - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // Qx - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // Qx - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // Qx - - r1_fx = Mpy_32_16_1( r1_fx, ptr_pf_sf ); // Qx - 1 - r2_fx = Mpy_32_16_1( r2_fx, ptr_pf_sf ); // Qx - 1 - i1_fx = Mpy_32_16_1( i1_fx, ptr_pf_sf ); // Qx - 1 - i2_fx = Mpy_32_16_1( i2_fx, ptr_pf_sf ); // Qx - 1 -#endif /* OPT_IVAS_FILTER_ROM */ /* folding + pre modulation of DST IV */ rr12_fx = L_sub( r1_fx, r2_fx ); // Qx - 1 @@ -242,7 +201,6 @@ void cldfbAnalysis_ivas_fx( FOR( k = M4; k < M2; k++ ) { /* prototype filter */ -#ifdef OPT_IVAS_FILTER_ROM r1_fx = Msub_32_32( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // Qx r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // Qx r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // Qx @@ -266,36 +224,6 @@ void cldfbAnalysis_ivas_fx( i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )] ); // Qx i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )] ); // Qx i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )] ); // Qx -#else /* OPT_IVAS_FILTER_ROM */ - r1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // Qx - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // Qx - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // Qx - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // Qx - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // Qx - - r2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 0 * L2 )] ); // Qx - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 1 * L2 )] ); // Qx - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 2 * L2 )] ); // Qx - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 3 * L2 )] ); // Qx - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 4 * L2 )] ); // Qx - - i1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // Qx - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // Qx - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // Qx - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // Qx - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // Qx - - i2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )] ); // Qx - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )] ); // Qx - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )] ); // Qx - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )] ); // Qx - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )] ); // Qx - - r1_fx = Mpy_32_16_1( r1_fx, ptr_pf_sf ); // Qx - 1 - r2_fx = Mpy_32_16_1( r2_fx, ptr_pf_sf ); // Qx - 1 - i1_fx = Mpy_32_16_1( i1_fx, ptr_pf_sf ); // Qx - 1 - i2_fx = Mpy_32_16_1( i2_fx, ptr_pf_sf ); // Qx - 1 -#endif /* OPT_IVAS_FILTER_ROM */ /* folding + pre modulation of DST IV */ rr12_fx = L_add( r1_fx, r2_fx ); // Qx - 1 @@ -384,12 +312,7 @@ void cldfbAnalysis_ts_fx( const Word32 *rot_vctr_im_fx; const Word32 *rot_vctr_delay_re_fx; const Word32 *rot_vctr_delay_im_fx; -#ifdef OPT_IVAS_FILTER_ROM const Word32 *ptr_pf_fx; -#else /* OPT_IVAS_FILTER_ROM */ - const Word16 *ptr_pf_fx; - Word16 ptr_pf_sf; -#endif /* OPT_IVAS_FILTER_ROM */ Word32 *timeBuffer_fx, buffer_fx[( CLDFB_NO_CHANNELS_MAX * CLDFB_NO_COL_MAX ) + ( 9 * CLDFB_NO_CHANNELS_MAX )]; Word16 offset, frameSize; @@ -436,12 +359,7 @@ void cldfbAnalysis_ts_fx( rot_vctr_delay_re_fx = h_cldfb->rot_vec_ana_delay_re_fx; // q = 31 rot_vctr_delay_im_fx = h_cldfb->rot_vec_ana_delay_im_fx; // q = 31 -#ifdef OPT_IVAS_FILTER_ROM ptr_pf_fx = h_cldfb->p_filter_32; -#else /* OPT_IVAS_FILTER_ROM */ - ptr_pf_fx = h_cldfb->p_filter; - ptr_pf_sf = h_cldfb->p_filter_sf; // Q14 -#endif /* OPT_IVAS_FILTER_ROM */ move16(); FOR( i = 0; i < no_col; i++ ) @@ -449,7 +367,6 @@ void cldfbAnalysis_ts_fx( FOR( k = 0; k < M4; k++ ) { /* prototype filter */ -#ifdef OPT_IVAS_FILTER_ROM r1_fx = Msub_32_32( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[L2 - M2 - 1 - ( 2 * k ) + 0 * L2] ); // q r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q @@ -473,36 +390,6 @@ void cldfbAnalysis_ts_fx( i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // q i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // q -#else /* OPT_IVAS_FILTER_ROM */ - r1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[L2 - M2 - 1 - ( 2 * k ) + 0 * L2] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // q - - r2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 0 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 1 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 2 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 3 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 4 * L2 )] ); // q - - i1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )] ); // q - - i2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // q - - r1_fx = Mpy_32_16_1( r1_fx, ptr_pf_sf ); // q - 1 - r2_fx = Mpy_32_16_1( r2_fx, ptr_pf_sf ); // q - 1 - i1_fx = Mpy_32_16_1( i1_fx, ptr_pf_sf ); // q - 1 - i2_fx = Mpy_32_16_1( i2_fx, ptr_pf_sf ); // q - 1 -#endif /* OPT_IVAS_FILTER_ROM */ /* folding + pre modulation of DST IV */ rr12_fx = L_sub( r1_fx, r2_fx ); // q -1 @@ -526,7 +413,6 @@ void cldfbAnalysis_ts_fx( FOR( k = M4; k < M2; k++ ) { /* prototype filter */ -#ifdef OPT_IVAS_FILTER_ROM r1_fx = Msub_32_32( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q @@ -550,36 +436,6 @@ void cldfbAnalysis_ts_fx( i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )] ); // q i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )] ); // q i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )] ); // q -#else /* OPT_IVAS_FILTER_ROM */ - r1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // q - - r2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 0 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 1 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 2 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 3 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 4 * L2 )] ); // q - - i1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // q - - i2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )] ); // q - - r1_fx = Mpy_32_16_1( r1_fx, ptr_pf_sf ); // q - 1 - r2_fx = Mpy_32_16_1( r2_fx, ptr_pf_sf ); // q - 1 - i1_fx = Mpy_32_16_1( i1_fx, ptr_pf_sf ); // q - 1 - i2_fx = Mpy_32_16_1( i2_fx, ptr_pf_sf ); // q - 1 -#endif /* OPT_IVAS_FILTER_ROM */ /* folding + pre modulation of DST IV */ rr12_fx = L_add( r1_fx, r2_fx ); // q - 1 @@ -727,12 +583,7 @@ void cldfbAnalysis_ts_fx_var_q( const Word32 *rot_vctr_im_fx; const Word32 *rot_vctr_delay_re_fx; const Word32 *rot_vctr_delay_im_fx; -#ifdef OPT_IVAS_FILTER_ROM const Word32 *ptr_pf_fx; -#else /* OPT_IVAS_FILTER_ROM */ - const Word16 *ptr_pf_fx; - Word16 ptr_pf_sf; -#endif /* OPT_IVAS_FILTER_ROM */ Word32 *timeBuffer_fx, buffer_fx[( CLDFB_NO_CHANNELS_MAX * CLDFB_NO_COL_MAX ) + ( 9 * CLDFB_NO_CHANNELS_MAX )]; Word16 offset, frameSize; @@ -796,12 +647,7 @@ void cldfbAnalysis_ts_fx_var_q( rot_vctr_delay_re_fx = h_cldfb->rot_vec_ana_delay_re_fx; // q = 31 rot_vctr_delay_im_fx = h_cldfb->rot_vec_ana_delay_im_fx; // q = 31 -#ifdef OPT_IVAS_FILTER_ROM ptr_pf_fx = h_cldfb->p_filter_32; -#else /* OPT_IVAS_FILTER_ROM */ - ptr_pf_fx = h_cldfb->p_filter; - ptr_pf_sf = h_cldfb->p_filter_sf; // Q14 -#endif /* OPT_IVAS_FILTER_ROM */ move16(); FOR( i = 0; i < no_col; i++ ) @@ -809,7 +655,6 @@ void cldfbAnalysis_ts_fx_var_q( FOR( k = 0; k < M4; k++ ) { /* prototype filter */ -#ifdef OPT_IVAS_FILTER_ROM r1_fx = Msub_32_32( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q @@ -833,36 +678,6 @@ void cldfbAnalysis_ts_fx_var_q( i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // q i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // q -#else /* OPT_IVAS_FILTER_ROM */ - r1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // q - - r2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 0 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 1 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 2 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 3 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 4 * L2 )] ); // q - - i1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )] ); // q - - i2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // q - - r1_fx = Mpy_32_16_1( r1_fx, ptr_pf_sf ); // q - 1 - r2_fx = Mpy_32_16_1( r2_fx, ptr_pf_sf ); // q - 1 - i1_fx = Mpy_32_16_1( i1_fx, ptr_pf_sf ); // q - 1 - i2_fx = Mpy_32_16_1( i2_fx, ptr_pf_sf ); // q - 1 -#endif /* OPT_IVAS_FILTER_ROM */ /* folding + pre modulation of DST IV */ rr12_fx = L_sub( r1_fx, r2_fx ); // q -1 @@ -886,7 +701,6 @@ void cldfbAnalysis_ts_fx_var_q( FOR( k = M4; k < M2; k++ ) { /* prototype filter */ -#ifdef OPT_IVAS_FILTER_ROM r1_fx = Msub_32_32( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q @@ -911,36 +725,6 @@ void cldfbAnalysis_ts_fx_var_q( i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )] ); // q i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )] ); // q -#else /* OPT_IVAS_FILTER_ROM */ - r1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // q - - r2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 0 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 1 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 2 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 3 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 4 * L2 )] ); // q - - i1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // q - - i2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )] ); // q - - r1_fx = Mpy_32_16_1( r1_fx, ptr_pf_sf ); // q - 1 - r2_fx = Mpy_32_16_1( r2_fx, ptr_pf_sf ); // q - 1 - i1_fx = Mpy_32_16_1( i1_fx, ptr_pf_sf ); // q - 1 - i2_fx = Mpy_32_16_1( i2_fx, ptr_pf_sf ); // q - 1 -#endif /* OPT_IVAS_FILTER_ROM */ /* folding + pre modulation of DST IV */ rr12_fx = L_add( r1_fx, r2_fx ); // q - 1 @@ -1059,12 +843,7 @@ void cldfbAnalysis_ts_fx_fixed_q( const Word32 *rot_vctr_im_fx; const Word32 *rot_vctr_delay_re_fx; const Word32 *rot_vctr_delay_im_fx; -#ifdef OPT_IVAS_FILTER_ROM const Word32 *ptr_pf_fx; -#else /* OPT_IVAS_FILTER_ROM */ - const Word16 *ptr_pf_fx; - Word16 ptr_pf_sf; -#endif /* OPT_IVAS_FILTER_ROM */ Word32 *timeBuffer_fx, buffer_fx[( CLDFB_NO_CHANNELS_MAX * CLDFB_NO_COL_MAX ) + ( 9 * CLDFB_NO_CHANNELS_MAX )]; Word16 offset, frameSize, gb, hr, shift; @@ -1110,12 +889,7 @@ void cldfbAnalysis_ts_fx_fixed_q( rot_vctr_delay_re_fx = h_cldfb->rot_vec_ana_delay_re_fx; // q = 31 rot_vctr_delay_im_fx = h_cldfb->rot_vec_ana_delay_im_fx; // q = 31 -#ifdef OPT_IVAS_FILTER_ROM ptr_pf_fx = h_cldfb->p_filter_32; -#else /* OPT_IVAS_FILTER_ROM */ - ptr_pf_fx = h_cldfb->p_filter; - ptr_pf_sf = h_cldfb->p_filter_sf; // Q14 -#endif /* OPT_IVAS_FILTER_ROM */ move16(); FOR( i = 0; i < no_col; i++ ) @@ -1123,7 +897,6 @@ void cldfbAnalysis_ts_fx_fixed_q( FOR( k = 0; k < M4; k++ ) { /* prototype filter */ -#ifdef OPT_IVAS_FILTER_ROM r1_fx = Msub_32_32( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q @@ -1147,36 +920,6 @@ void cldfbAnalysis_ts_fx_fixed_q( i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // q i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // q -#else /* OPT_IVAS_FILTER_ROM */ - r1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // q - - r2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 0 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 1 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 2 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 3 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - M2 + ( 2 * k ) + 4 * L2 )] ); // q - - i1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )] ); // q - - i2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // q - - r1_fx = Mpy_32_16_1( r1_fx, ptr_pf_sf ); // q - 1 - r2_fx = Mpy_32_16_1( r2_fx, ptr_pf_sf ); // q - 1 - i1_fx = Mpy_32_16_1( i1_fx, ptr_pf_sf ); // q - 1 - i2_fx = Mpy_32_16_1( i2_fx, ptr_pf_sf ); // q - 1 -#endif /* OPT_IVAS_FILTER_ROM */ /* folding + pre modulation of DST IV */ rr12_fx = L_sub( r1_fx, r2_fx ); // q -1 @@ -1200,7 +943,6 @@ void cldfbAnalysis_ts_fx_fixed_q( FOR( k = M4; k < M2; k++ ) { /* prototype filter */ -#ifdef OPT_IVAS_FILTER_ROM r1_fx = Msub_32_32( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q r1_fx = Msub_32_32( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q @@ -1224,36 +966,6 @@ void cldfbAnalysis_ts_fx_fixed_q( i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )] ); // q i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )] ); // q i2_fx = Msub_32_32( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )] ); // q -#else /* OPT_IVAS_FILTER_ROM */ - r1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // q - r1_fx = Msub_32_16( r1_fx, timeBuffer_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // q - - r2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 0 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 1 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 2 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 3 * L2 )] ); // q - r2_fx = Msub_32_16( r2_fx, timeBuffer_fx[( L2 - 5 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 5 * M2 + ( 2 * k ) + 4 * L2 )] ); // q - - i1_fx = Msub_32_16( 0, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 0 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 1 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 2 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 3 * L2 )] ); // q - i1_fx = Msub_32_16( i1_fx, timeBuffer_fx[( L2 + M2 - 1 - ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 + M2 - 1 - ( 2 * k ) + 4 * L2 )] ); // q - - i2_fx = Msub_32_16( 0, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 0 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 1 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 2 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 3 * L2 )] ); // q - i2_fx = Msub_32_16( i2_fx, timeBuffer_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )], ptr_pf_fx[( L2 - 3 * M2 + ( 2 * k ) + 4 * L2 )] ); // q - - r1_fx = Mpy_32_16_1( r1_fx, ptr_pf_sf ); // q - 1 - r2_fx = Mpy_32_16_1( r2_fx, ptr_pf_sf ); // q - 1 - i1_fx = Mpy_32_16_1( i1_fx, ptr_pf_sf ); // q - 1 - i2_fx = Mpy_32_16_1( i2_fx, ptr_pf_sf ); // q - 1 -#endif /* OPT_IVAS_FILTER_ROM */ /* folding + pre modulation of DST IV */ rr12_fx = L_add( r1_fx, r2_fx ); // q - 1 @@ -1409,12 +1121,7 @@ void cldfbSynthesis_ivas_fx( Word32 new_samples_fx[2 * CLDFB_NO_CHANNELS_MAX]; Word32 *ptr_time_out_fx; -#ifdef OPT_IVAS_FILTER_ROM const Word32 *p_filter_32; -#else /* OPT_IVAS_FILTER_ROM */ - const Word16 *p_filter; - Word16 p_filter_sf; -#endif /* OPT_IVAS_FILTER_ROM */ Word32 accu0, accu1, accu2, accu3, accu4; Word16 no_col = h_cldfb->no_col; @@ -1444,12 +1151,7 @@ void cldfbSynthesis_ivas_fx( synthesisBuffer_fx = buffer_fx; Copy32( h_cldfb->cldfb_state_fx, synthesisBuffer_fx + i_mult( M1, no_col ), h_cldfb->p_filter_length ); -#ifdef OPT_IVAS_FILTER_ROM p_filter_32 = h_cldfb->p_filter_32; -#else /* OPT_IVAS_FILTER_ROM */ - p_filter = h_cldfb->p_filter; - p_filter_sf = h_cldfb->p_filter_sf; // Q14 -#endif /* OPT_IVAS_FILTER_ROM */ ptr_time_out_fx = timeOut_fx; /*synthesisBuffer += M1 * h_cldfb->no_col;*/ @@ -1560,19 +1262,11 @@ void cldfbSynthesis_ivas_fx( { FOR( i = 0; i < L2; i++ ) { -#ifdef OPT_IVAS_FILTER_ROM accu0 = Madd_32_32( synthesisBuffer_fx[i], new_samples_fx[L2 - 1 - i], p_filter_32[i] ); // Qx - 1 accu1 = Madd_32_32( synthesisBuffer_fx[1 * L2 + i], new_samples_fx[L2 - 1 - i], p_filter_32[( 1 * L2 + i )] ); // Qx - 1 accu2 = Madd_32_32( synthesisBuffer_fx[2 * L2 + i], new_samples_fx[L2 - 1 - i], p_filter_32[( 2 * L2 + i )] ); // Qx - 1 accu3 = Madd_32_32( synthesisBuffer_fx[3 * L2 + i], new_samples_fx[L2 - 1 - i], p_filter_32[( 3 * L2 + i )] ); // Qx - 1 accu4 = Madd_32_32( synthesisBuffer_fx[4 * L2 + i], new_samples_fx[L2 - 1 - i], p_filter_32[( 4 * L2 + i )] ); // Qx - 1 -#else /* OPT_IVAS_FILTER_ROM */ - accu0 = Madd_32_16( synthesisBuffer_fx[i], Mpy_32_16_1( new_samples_fx[L2 - 1 - i], p_filter[i] ), p_filter_sf ); // Qx - 1 - accu1 = Madd_32_16( synthesisBuffer_fx[1 * L2 + i], Mpy_32_16_1( new_samples_fx[L2 - 1 - i], p_filter[( 1 * L2 + i )] ), p_filter_sf ); // Qx - 1 - accu2 = Madd_32_16( synthesisBuffer_fx[2 * L2 + i], Mpy_32_16_1( new_samples_fx[L2 - 1 - i], p_filter[( 2 * L2 + i )] ), p_filter_sf ); // Qx - 1 - accu3 = Madd_32_16( synthesisBuffer_fx[3 * L2 + i], Mpy_32_16_1( new_samples_fx[L2 - 1 - i], p_filter[( 3 * L2 + i )] ), p_filter_sf ); // Qx - 1 - accu4 = Madd_32_16( synthesisBuffer_fx[4 * L2 + i], Mpy_32_16_1( new_samples_fx[L2 - 1 - i], p_filter[( 4 * L2 + i )] ), p_filter_sf ); // Qx - 1 -#endif /* OPT_IVAS_FILTER_ROM */ synthesisBuffer_fx[i] = accu0; move32(); @@ -1591,21 +1285,12 @@ void cldfbSynthesis_ivas_fx( FOR( i = 0; i < L2; i++ ) { -#ifdef OPT_IVAS_FILTER_ROM Word32 prod = L_shl_sat( ( new_samples_fx[L2 - 1 - i] ), shift ); accu0 = Madd_32_32( synthesisBuffer_fx[i], prod, p_filter_32[i] ); // Qx -1 + shift accu1 = Madd_32_32( synthesisBuffer_fx[1 * L2 + i], prod, p_filter_32[( 1 * L2 + i )] ); // Qx -1 + shift accu2 = Madd_32_32( synthesisBuffer_fx[2 * L2 + i], prod, p_filter_32[( 2 * L2 + i )] ); // Qx -1 + shift accu3 = Madd_32_32( synthesisBuffer_fx[3 * L2 + i], prod, p_filter_32[( 3 * L2 + i )] ); // Qx -1 + shift accu4 = Madd_32_32( synthesisBuffer_fx[4 * L2 + i], prod, p_filter_32[( 4 * L2 + i )] ); // Qx -1 + shift -#else /* OPT_IVAS_FILTER_ROM */ - Word32 prod = L_shl_sat( Mpy_32_16_1( new_samples_fx[L2 - 1 - i], p_filter_sf ), shift ); - accu0 = Madd_32_16( synthesisBuffer_fx[i], prod, p_filter[i] ); // Qx -1 + shift - accu1 = Madd_32_16( synthesisBuffer_fx[1 * L2 + i], prod, p_filter[( 1 * L2 + i )] ); // Qx -1 + shift - accu2 = Madd_32_16( synthesisBuffer_fx[2 * L2 + i], prod, p_filter[( 2 * L2 + i )] ); // Qx -1 + shift - accu3 = Madd_32_16( synthesisBuffer_fx[3 * L2 + i], prod, p_filter[( 3 * L2 + i )] ); // Qx -1 + shift - accu4 = Madd_32_16( synthesisBuffer_fx[4 * L2 + i], prod, p_filter[( 4 * L2 + i )] ); // Qx -1 + shift -#endif /* OPT_IVAS_FILTER_ROM */ synthesisBuffer_fx[i] = accu0; move32(); @@ -2074,12 +1759,7 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_ana_delay_im_fx = NULL; hs->rot_vec_syn_delay_im_fx = NULL; hs->rot_vec_syn_delay_re_fx = NULL; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = CLDFB80_10_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 17036; // Q14 - hs->p_filter = CLDFB80_10_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = CLDFB80_10_SCALE_FX_Q8; } ELSE IF( EQ_32( hs->prototype, CLDFB_PROTOTYPE_5_00MS ) ) @@ -2090,12 +1770,7 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_ana_delay_im_fx = rot_vec_delay_im_LDQMF_fx; hs->rot_vec_syn_delay_re_fx = rot_vec_delay_re_LDQMF_fx; hs->rot_vec_syn_delay_im_fx = rot_vec_delay_im_LDQMF_fx; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = LDQMF_10_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 15388; // Q14 - hs->p_filter = LDQMF_10_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = LDQMF_10_SCALE_FX_Q8; } BREAK; @@ -2113,12 +1788,7 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_ana_delay_im_fx = NULL; hs->rot_vec_syn_delay_im_fx = NULL; hs->rot_vec_syn_delay_re_fx = NULL; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = CLDFB80_16_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 17051; // Q14 - hs->p_filter = CLDFB80_16_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = CLDFB80_16_SCALE_FX_Q8; } ELSE IF( EQ_32( hs->prototype, CLDFB_PROTOTYPE_5_00MS ) ) @@ -2129,12 +1799,7 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_ana_delay_im_fx = rot_vec_delay_im_LDQMF_fx; hs->rot_vec_syn_delay_re_fx = rot_vec_delay_re_LDQMF_fx; hs->rot_vec_syn_delay_im_fx = rot_vec_delay_im_LDQMF_fx; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = LDQMF_16_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 15388; // Q14 - hs->p_filter = LDQMF_16_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = LDQMF_16_SCALE_FX_Q8; } BREAK; @@ -2152,12 +1817,7 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_ana_delay_im_fx = NULL; hs->rot_vec_syn_delay_im_fx = NULL; hs->rot_vec_syn_delay_re_fx = NULL; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = CLDFB80_20_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 17050; // Q14 - hs->p_filter = CLDFB80_20_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = CLDFB80_20_SCALE_FX_Q8; } ELSE IF( EQ_32( hs->prototype, CLDFB_PROTOTYPE_5_00MS ) ) @@ -2168,12 +1828,7 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_ana_delay_im_fx = rot_vec_delay_im_LDQMF_fx; hs->rot_vec_syn_delay_re_fx = rot_vec_delay_re_LDQMF_fx; hs->rot_vec_syn_delay_im_fx = rot_vec_delay_im_LDQMF_fx; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = LDQMF_20_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 15390; // Q14 - hs->p_filter = LDQMF_20_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = LDQMF_20_SCALE_FX_Q8; } BREAK; @@ -2191,12 +1846,7 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_ana_delay_im_fx = NULL; hs->rot_vec_syn_delay_im_fx = NULL; hs->rot_vec_syn_delay_re_fx = NULL; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = CLDFB80_30_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 17051; // Q14 - hs->p_filter = CLDFB80_30_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = CLDFB80_30_SCALE_FX_Q8; } ELSE IF( EQ_32( hs->prototype, CLDFB_PROTOTYPE_5_00MS ) ) @@ -2207,12 +1857,7 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_ana_delay_im_fx = rot_vec_delay_im_LDQMF_fx; hs->rot_vec_syn_delay_re_fx = rot_vec_delay_re_LDQMF_fx; hs->rot_vec_syn_delay_im_fx = rot_vec_delay_im_LDQMF_fx; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = LDQMF_30_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 15388; // Q14 - hs->p_filter = LDQMF_30_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = LDQMF_30_SCALE_FX_Q8; } BREAK; @@ -2230,12 +1875,7 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_ana_delay_im_fx = NULL; hs->rot_vec_syn_delay_im_fx = NULL; hs->rot_vec_syn_delay_re_fx = NULL; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = CLDFB80_32_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 17050; // Q14 - hs->p_filter = CLDFB80_32_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = CLDFB80_32_SCALE_FX_Q8; } ELSE IF( EQ_32( hs->prototype, CLDFB_PROTOTYPE_5_00MS ) ) @@ -2246,12 +1886,7 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_ana_delay_im_fx = rot_vec_delay_im_LDQMF_fx; hs->rot_vec_syn_delay_re_fx = rot_vec_delay_re_LDQMF_fx; hs->rot_vec_syn_delay_im_fx = rot_vec_delay_im_LDQMF_fx; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = LDQMF_32_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 15392; // Q14 - hs->p_filter = LDQMF_32_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = LDQMF_32_SCALE_FX_Q8; } BREAK; @@ -2269,12 +1904,7 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_ana_delay_im_fx = NULL; hs->rot_vec_syn_delay_im_fx = NULL; hs->rot_vec_syn_delay_re_fx = NULL; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = CLDFB80_40_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 17051; // Q14 - hs->p_filter = CLDFB80_40_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = CLDFB80_40_SCALE_FX_Q8; } ELSE IF( EQ_32( hs->prototype, CLDFB_PROTOTYPE_5_00MS ) ) @@ -2285,12 +1915,7 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_ana_delay_im_fx = rot_vec_delay_im_LDQMF_fx; hs->rot_vec_syn_delay_re_fx = rot_vec_delay_re_LDQMF_fx; hs->rot_vec_syn_delay_im_fx = rot_vec_delay_im_LDQMF_fx; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = LDQMF_40_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 15391; // Q14 - hs->p_filter = LDQMF_40_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = LDQMF_40_SCALE_FX_Q8; } BREAK; @@ -2308,12 +1933,7 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_ana_delay_im_fx = NULL; hs->rot_vec_syn_delay_re_fx = NULL; hs->rot_vec_syn_delay_im_fx = NULL; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = CLDFB80_60_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 17051; // Q14 - hs->p_filter = CLDFB80_60_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = CLDFB80_60_SCALE_FX_Q8; } ELSE IF( EQ_32( hs->prototype, CLDFB_PROTOTYPE_5_00MS ) ) @@ -2324,12 +1944,7 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_ana_delay_im_fx = rot_vec_delay_im_LDQMF_fx; hs->rot_vec_syn_delay_re_fx = rot_vec_delay_re_LDQMF_fx; hs->rot_vec_syn_delay_im_fx = rot_vec_delay_im_LDQMF_fx; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = LDQMF_60_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 15391; // Q14 - hs->p_filter = LDQMF_60_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = LDQMF_60_SCALE_FX_Q8; } BREAK; @@ -2379,12 +1994,7 @@ static void cldfb_init_proto_and_twiddles_enc_fx( hs->scale = cldfb_scale_2_5ms[0]; move16(); move16(); -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = CLDFB80_10_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 17036; // Q14 - hs->p_filter = CLDFB80_10_fx; -#endif /* OPT_IVAS_FILTER_ROM */ } ELSE IF( EQ_16( hs->prototype, CLDFB_PROTOTYPE_5_00MS ) ) { @@ -2396,12 +2006,7 @@ static void cldfb_init_proto_and_twiddles_enc_fx( hs->rot_vec_ana_delay_im_fx = rot_vec_delay_im_LDQMF_fx; hs->rot_vec_syn_delay_re_fx = rot_vec_delay_re_LDQMF_fx; hs->rot_vec_syn_delay_im_fx = rot_vec_delay_im_LDQMF_fx; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = LDQMF_10_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 15388; // Q14 - hs->p_filter = LDQMF_10_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = cldfb_scale_5_0ms[0]; move16(); move16(); @@ -2429,12 +2034,7 @@ static void cldfb_init_proto_and_twiddles_enc_fx( hs->rot_vec_ana_delay_im_fx = NULL; hs->rot_vec_syn_delay_re_fx = NULL; hs->rot_vec_syn_delay_im_fx = NULL; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = CLDFB80_16_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 17051; // Q14 - hs->p_filter = CLDFB80_16_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = cldfb_scale_2_5ms[1]; move16(); move16(); @@ -2449,12 +2049,7 @@ static void cldfb_init_proto_and_twiddles_enc_fx( hs->rot_vec_ana_delay_im_fx = rot_vec_delay_im_LDQMF_fx; hs->rot_vec_syn_delay_re_fx = rot_vec_delay_re_LDQMF_fx; hs->rot_vec_syn_delay_im_fx = rot_vec_delay_im_LDQMF_fx; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = LDQMF_16_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 15388; // Q14 - hs->p_filter = LDQMF_16_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = cldfb_scale_5_0ms[1]; move16(); move16(); @@ -2489,12 +2084,7 @@ static void cldfb_init_proto_and_twiddles_enc_fx( hs->rot_vec_ana_delay_im_fx = NULL; hs->rot_vec_syn_delay_re_fx = NULL; hs->rot_vec_syn_delay_im_fx = NULL; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = CLDFB80_20_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 17050; // Q14 - hs->p_filter = CLDFB80_20_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = cldfb_scale_2_5ms[2]; move16(); move16(); @@ -2509,12 +2099,7 @@ static void cldfb_init_proto_and_twiddles_enc_fx( hs->rot_vec_ana_delay_im_fx = rot_vec_delay_im_LDQMF_fx; hs->rot_vec_syn_delay_re_fx = rot_vec_delay_re_LDQMF_fx; hs->rot_vec_syn_delay_im_fx = rot_vec_delay_im_LDQMF_fx; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = LDQMF_20_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 15390; // Q14 - hs->p_filter = LDQMF_20_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = cldfb_scale_5_0ms[2]; move16(); move16(); @@ -2549,12 +2134,7 @@ static void cldfb_init_proto_and_twiddles_enc_fx( hs->rot_vec_syn_delay_re_fx = NULL; hs->rot_vec_syn_delay_im_fx = NULL; hs->scale = cldfb_scale_2_5ms[6]; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = CLDFB80_30_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter = CLDFB80_30_fx; - hs->p_filter_sf = (Word16) 17051; // Q14 -#endif /* OPT_IVAS_FILTER_ROM */ } ELSE IF( EQ_16( hs->prototype, CLDFB_PROTOTYPE_5_00MS ) ) { @@ -2567,12 +2147,7 @@ static void cldfb_init_proto_and_twiddles_enc_fx( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_re_LDQMF_fx; hs->rot_vec_syn_delay_im_fx = rot_vec_delay_im_LDQMF_fx; hs->scale = cldfb_scale_5_0ms[6]; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = LDQMF_30_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter = LDQMF_30_fx; - hs->p_filter_sf = (Word16) 15388; // Q14 -#endif /* OPT_IVAS_FILTER_ROM */ move16(); move16(); } @@ -2599,12 +2174,7 @@ static void cldfb_init_proto_and_twiddles_enc_fx( hs->rot_vec_ana_delay_im_fx = NULL; hs->rot_vec_syn_delay_re_fx = NULL; hs->rot_vec_syn_delay_im_fx = NULL; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = CLDFB80_32_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 17050; // Q14 - hs->p_filter = CLDFB80_32_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = cldfb_scale_2_5ms[3]; move16(); move16(); @@ -2620,12 +2190,7 @@ static void cldfb_init_proto_and_twiddles_enc_fx( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_re_LDQMF_fx; hs->rot_vec_syn_delay_im_fx = rot_vec_delay_im_LDQMF_fx; hs->scale = cldfb_scale_5_0ms[3]; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = LDQMF_32_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter = LDQMF_32_fx; - hs->p_filter_sf = (Word16) 15392; // Q14 -#endif /* OPT_IVAS_FILTER_ROM */ move16(); move16(); } @@ -2659,12 +2224,7 @@ static void cldfb_init_proto_and_twiddles_enc_fx( hs->rot_vec_syn_delay_re_fx = NULL; hs->rot_vec_syn_delay_im_fx = NULL; hs->scale = cldfb_scale_2_5ms[4]; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = CLDFB80_40_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter = CLDFB80_40_fx; - hs->p_filter_sf = (Word16) 17051; // Q14 -#endif /* OPT_IVAS_FILTER_ROM */ move16(); move16(); } @@ -2678,12 +2238,7 @@ static void cldfb_init_proto_and_twiddles_enc_fx( hs->rot_vec_ana_delay_im_fx = rot_vec_delay_im_LDQMF_fx; hs->rot_vec_syn_delay_re_fx = rot_vec_delay_re_LDQMF_fx; hs->rot_vec_syn_delay_im_fx = rot_vec_delay_im_LDQMF_fx; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = LDQMF_40_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 15391; // Q14 - hs->p_filter = LDQMF_40_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = cldfb_scale_5_0ms[4]; move16(); move16(); @@ -2717,12 +2272,7 @@ static void cldfb_init_proto_and_twiddles_enc_fx( hs->rot_vec_ana_delay_im_fx = NULL; hs->rot_vec_syn_delay_re_fx = NULL; hs->rot_vec_syn_delay_im_fx = NULL; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = CLDFB80_60_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 17051; // Q14 - hs->p_filter = CLDFB80_60_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = cldfb_scale_2_5ms[5]; move16(); move16(); @@ -2737,12 +2287,7 @@ static void cldfb_init_proto_and_twiddles_enc_fx( hs->rot_vec_ana_delay_im_fx = rot_vec_delay_im_LDQMF_fx; hs->rot_vec_syn_delay_re_fx = rot_vec_delay_re_LDQMF_fx; hs->rot_vec_syn_delay_im_fx = rot_vec_delay_im_LDQMF_fx; -#ifdef OPT_IVAS_FILTER_ROM hs->p_filter_32 = LDQMF_60_fx; -#else /* OPT_IVAS_FILTER_ROM */ - hs->p_filter_sf = (Word16) 15391; // Q14 - hs->p_filter = LDQMF_60_fx; -#endif /* OPT_IVAS_FILTER_ROM */ hs->scale = cldfb_scale_5_0ms[5]; move16(); move16(); diff --git a/lib_com/options.h b/lib_com/options.h index e0007670d..0eff953e7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,7 +77,6 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE #define OPT_BIN_REND_V2_NBE -#define OPT_IVAS_FILTER_ROM /* Optimization made in IVAS filter table */ /* Both following 2 macros (IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST*) are independent from each other, they refer to different code blocks */ //#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version. Obsoleted by MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE. */ //#define HARM_SCE_INIT diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index b10f5cc52..004413469 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -5194,243 +5194,6 @@ const Word16 freqTable[2] = {20, 40}; // Q0 /* SNR: 109.44, PHASE: 3.500000000000000 */ /* SNR: 109.44, PHASE: 3.500000000000000 */ -#ifndef OPT_IVAS_FILTER_ROM -const Word16 CLDFB80_10_fx[100] = // q = 15 sf = 17036 qsf = 14 -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -7, -2, 0, 0, 0, -1, 0, 0, 0, -8, -31, - -4, 0, 0, -6, 5, 0, 0, -1, 33, -63, -24, 11, 49, 54, 49, 69, 89, 95, 52, -44, -50, 24, 80, 71, 8, - -103, -205, -300, -429, 587, 764, 1010, 1347, 1783, 2309, 2880, 3411, 3810, 4001, 3950, 3582, 2797, - 1568, -98, -2200, -4710, -7582, -10752, -14132, 17583, 20974, 24169, 27024, 29400, 31176, 32302, - 32767, 32696, 32027, 30287, 27571, 24530, 21358, 18039, 14649, 11219, 7832, 4369, 1312 -}; - - -/* SNR: 292.49, PHASE: 2.000000000000000 */ -const Word16 CLDFB80_16_fx[160] = // q = 15 sf = 17051 qsf = 14 -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, - -4, -1, -1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, -2, -13, -38, -16, -5, -3, -1, 0, -1, 1, -7, 1, 0, 1, 1, 1, - 10, 52, -67, -48, -23, -3, 22, 47, 56, 36, 50, 57, 70, 87, 93, 95, 80, 40, -34, -61, -46, 0, 45, 78, - 82, 65, 29, -38, -110, -175, -233, -293, -368, -457, 559, 658, 776, 923, 1104, 1322, 1579, 1873, 2203, - 2556, 2913, 3252, 3551, 3787, 3943, 4005, 3975, 3832, 3542, 3087, 2458, 1656, 683, -459, -1772, -3248, - -4875, -6643, -8536, -10537, -12624, -14766, 16922, 19062, 21161, 23180, 25080, 26833, 28403, 29754, - 30863, 31722, 32320, 32657, 32767, 32685, 32379, 31797, 30709, 29137, 27361, 25471, 23533, 21541, 19486, - 17392, 15275, 13136, 10996, 8882, 6757, 4582, 2509, 876, -}; - -/* SNR: 89.77, PHASE: 1.500000000000000 */ -const Word16 CLDFB80_20_fx[200] = // q = 15 sf = 17050 qsf = 14 -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -9, -6, -1, -2, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, -3, -15, -37, -20, -4, -5, -3, -1, 0, 0, - -4, 8, -15, 4, 0, 1, 1, 1, 2, -4, 10, 57, -62, -58, -27, -19, -1, 19, 39, 52, 57, 24, 52, 53, 60, 75, 87, 92, - 96, 88, 69, 33, -29, -56, -59, -34, 4, 41, 72, 87, 78, 64, 37, -18, -75, -131, -181, -228, -275, -328, -394, - -466, 549, 627, 713, 817, 939, 1085, 1253, 1446, 1664, 1904, 2168, 2449, 2736, 3018, 3284, 3524, 3724, 3876, - 3972, 4006, 3982, 3890, 3707, 3424, 3032, 2528, 1914, 1191, 358, -583, -1633, -2789, -4043, -5392, -6827, -8342, - -9927, -11572, -13263, -14983, 16709, 18424, 20121, 21779, 23377, 24898, 26326, 27645, 28834, 29878, 30765, - 31493, 32056, 32450, 32679, 32767, 32733, 32567, 32235, 31727, 30857, 29634, 28272, 26803, 25281, 23730, 22147, - 20522, 18862, 17182, 15489, 13781, 12065, 10360, 8671, 6973, 5237, 3512, 1961, 735, -}; - - -/* SNR: 89.29, PHASE: 0.833333333333333 */ -const Word16 CLDFB80_30_fx[300] = // q = 15 sf = 17051 qsf = 14 -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -7, -4, -2, -2, -1, -1, 0, 0, 0, 0, 0, 0, 0, - 0, -1, -1, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, -2, -8, -19, -31, -31, -20, -7, -4, -5, -3, 0, -1, 0, 0, 1, -3, -6, 18, - -23, 5, 3, -3, 0, 1, 2, 0, 1, 2, -1, 0, 11, 33, 61, -57, -63, -54, -33, -24, -16, -4, 11, 23, 36, 49, 54, 56, 54, - 8, 52, 49, 55, 60, 69, 78, 86, 89, 93, 96, 95, 87, 75, 52, 22, -19, -44, -59, -60, -50, -28, -2, 24, 47, 67, 80, - 86, 80, 71, 62, 48, 8, -27, -65, -103, -139, -173, -205, -235, -266, -300, -338, -382, -429, -478, 534, 587, 641, - 698, 763, 836, 917, 1009, 1111, 1223, 1346, 1480, 1626, 1781, 1945, 2122, 2307, 2496, 2688, 2878, 3063, 3241, 3408, - 3560, 3694, 3806, 3896, 3960, 3997, 4003, 3987, 3946, 3866, 3744, 3579, 3366, 3105, 2794, 2434, 2024, 1566, 1060, - 505, -98, -750, -1450, -2198, -2991, -3827, -4706, -5625, -6582, -7575, -8601, -9658, -10742, -11850, -12978, -14119, - -15271, 16422, 17566, 18707, 19838, 20954, 22048, 23114, 24147, 25141, 26094, 26999, 27851, 28644, 29373, 30034, 30626, - 31147, 31596, 31972, 32272, 32496, 32649, 32737, 32767, 32744, 32665, 32521, 32301, 31997, 31636, 31056, 30259, 29415, - 28506, 27545, 26550, 25535, 24507, 23467, 22412, 21338, 20246, 19139, 18023, 16900, 15771, 14635, 13494, 12350, 11209, - 10077, 8952, 7825, 6685, 5527, 4365, 3235, 2198, 1311, 541, -}; - -/* SNR: 85.69, PHASE: 0.750000000000000 */ -const Word16 CLDFB80_32_fx[320] = // q = 15 sf = 17050 qsf = 14 -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -8, -5, -2, -1, -2, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, - -1, -1, 0, 1, 0, 0, -1, 0, 0, 0, 0, 1, -1, -3, -9, -20, -31, -32, -20, -10, -2, -5, -4, -2, 0, 0, 0, 0, 0, -3, -5, 18, -24, 4, - 3, -2, 2, 1, 2, 0, 1, 2, 2, -5, 4, 11, 37, 61, -56, -65, -57, -38, -23, -20, -9, 2, 16, 29, 40, 51, 55, 57, 52, 6, 52, 49, 54, - 59, 65, 74, 84, 88, 91, 94, 96, 93, 85, 71, 50, 21, -18, -43, -57, -61, -54, -36, -13, 12, 35, 55, 73, 84, 85, 79, 69, 62, 50, - 11, -21, -56, -93, -127, -159, -190, -219, -248, -278, -310, -348, -389, -433, -480, 532, 582, 632, 685, 744, 810, 883, 965, - 1056, 1156, 1264, 1383, 1511, 1649, 1796, 1951, 2117, 2290, 2467, 2646, 2825, 3000, 3170, 3332, 3482, 3617, 3735, 3834, 3912, - 3968, 4000, 4003, 3988, 3952, 3881, 3775, 3630, 3445, 3217, 2946, 2631, 2273, 1872, 1429, 943, 413, -157, -771, -1428, -2126, - -2864, -3641, -4455, -5305, -6189, -7106, -8052, -9027, -10028, -11053, -12097, -13156, -14228, -15309, 16387, 17461, 18531, - 19594, 20644, 21677, 22687, 23669, 24620, 25536, 26413, 27246, 28032, 28765, 29440, 30056, 30611, 31104, 31534, 31899, 32198, - 32430, 32598, 32706, 32761, 32767, 32727, 32635, 32483, 32262, 31968, 31629, 31085, 30337, 29554, 28712, 27822, 26897, 25951, - 24992, 24023, 23042, 22047, 21034, 20006, 18967, 17919, 16866, 15808, 14744, 13674, 12601, 11530, 10466, 9409, 8355, 7294, 6217, - 5127, 4042, 2998, 2049, 1236, 515, -}; - -/* SNR: 81.55, PHASE: 0.500000000000000 */ -const Word16 CLDFB80_40_fx[400] = // q = 15 sf = 17051 qsf = 14 -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -10, -9, -6, -4, - -2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, 0, 0, 0, 1, -1, 0, 0, -1, 0, 0, 0, 0, 0, 2, -1, -2, -5, -12, -22, -29, - -37, -24, -18, -9, -2, -6, -4, -3, -2, 0, -1, 0, 0, 0, 1, -2, -6, -2, 20, -24, 0, 5, 2, -2, 2, 0, 2, 2, 0, 1, 2, 2, 2, -6, 3, 11, - 18, 47, 61, -57, -68, -60, -52, -36, -23, -22, -14, -6, 3, 16, 25, 35, 44, 51, 54, 56, 56, 44, 3, 49, 49, 51, 56, 59, 64, 72, 79, - 86, 88, 90, 93, 96, 96, 92, 86, 77, 59, 45, 17, -14, -38, -50, -60, -61, -55, -42, -25, -5, 15, 33, 49, 65, 77, 85, 85, 81, 75, 67, - 62, 54, 22, -4, -31, -60, -90, -117, -144, -169, -193, -216, -239, -262, -287, -313, -344, -377, -411, -447, -485, 527, 569, 606, - 648, 690, 737, 790, 845, 906, 973, 1046, 1125, 1209, 1299, 1395, 1498, 1607, 1722, 1842, 1966, 2099, 2237, 2378, 2520, 2664, 2807, - 2948, 3086, 3219, 3347, 3467, 3578, 3678, 3766, 3843, 3905, 3953, 3987, 4003, 4001, 3989, 3967, 3921, 3853, 3762, 3646, 3505, 3336, - 3140, 2916, 2665, 2385, 2078, 1744, 1382, 993, 577, 133, -337, -835, -1360, -1913, -2490, -3093, -3720, -4372, -5046, -5743, -6460, - -7198, -7956, -8731, -9524, -10332, -11155, -11990, -12836, -13690, -14550, -15416, 16279, 17137, 17995, 18849, 19698, 20538, 21367, - 22183, 22983, 23764, 24524, 25263, 25977, 26665, 27325, 27953, 28548, 29107, 29629, 30112, 30556, 30960, 31324, 31647, 31929, 32168, - 32365, 32519, 32634, 32711, 32755, 32767, 32750, 32702, 32620, 32498, 32333, 32121, 31865, 31595, 31160, 30560, 29950, 29304, 28623, - 27911, 27175, 26424, 25662, 24894, 24118, 23336, 22544, 21743, 20930, 20108, 19278, 18442, 17602, 16759, 15912, 15062, 14208, 13351, - 12493, 11636, 10783, 9936, 9092, 8249, 7400, 6542, 5673, 4799, 3934, 3099, 2320, 1623, 1018, 436, -}; - - -/* SNR: 85.15, PHASE: 0.166666666666667 */ -const Word16 CLDFB80_60_fx[600] = // q = 15 sf = 17051 qsf = 14 -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -11, -9, -9, -6, -6, -4, -3, -1, -1, -1, -2, - -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -2, -3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, -1, - -2, -3, -5, -11, -15, -25, -27, -37, -35, -26, -20, -17, -11, -4, -2, -6, -5, -4, -4, -3, -2, 0, -1, -1, 0, 0, 0, 0, 0, 0, -2, -4, -6, - -3, 8, 18, -21, -15, 2, 6, 4, 2, -2, 0, 2, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 2, 1, -4, -4, 5, 10, 10, 23, 42, 57, 61, -58, -62, -67, -60, - -58, -49, -39, -27, -23, -23, -19, -13, -7, -1, 5, 15, 19, 26, 34, 39, 46, 50, 52, 55, 56, 57, 56, 48, 24, 2, 43, 52, 49, 50, 53, 56, - 59, 60, 66, 71, 75, 80, 85, 87, 88, 90, 92, 94, 95, 96, 96, 93, 88, 85, 79, 69, 56, 47, 33, 12, -8, -29, -41, -48, -56, -61, -61, -59, - -54, -45, -34, -22, -9, 4, 18, 30, 41, 52, 62, 72, 78, 83, 87, 85, 82, 78, 73, 68, 64, 62, 58, 37, 17, 0, -18, -36, -55, -75, -94, -112, - -131, -148, -165, -181, -197, -212, -228, -243, -258, -275, -291, -309, -328, -349, -371, -394, -417, -441, -466, -492, 520, 549, 575, 599, - 627, 655, 683, 713, 746, 781, 817, 855, 896, 939, 985, 1033, 1085, 1138, 1194, 1253, 1315, 1379, 1446, 1516, 1588, 1663, 1741, 1822, 1904, - 1987, 2076, 2168, 2261, 2354, 2449, 2544, 2640, 2735, 2830, 2925, 3018, 3109, 3198, 3284, 3368, 3448, 3524, 3595, 3662, 3724, 3780, 3831, - 3876, 3914, 3947, 3972, 3991, 4002, 4005, 3999, 3991, 3981, 3960, 3930, 3890, 3839, 3779, 3707, 3624, 3530, 3424, 3306, 3175, 3032, 2877, - 2709, 2528, 2336, 2131, 1914, 1685, 1444, 1191, 926, 648, 358, 56, -257, -583, -920, -1270, -1633, -2007, -2392, -2789, -3196, -3614, -4043, - -4483, -4932, -5392, -5861, -6339, -6827, -7324, -7828, -8341, -8862, -9391, -9926, -10469, -11017, -11572, -12131, -12695, -13262, -13833, - -14406, -14982, -15561, 16136, 16708, 17280, 17853, 18423, 18991, 19557, 20120, 20678, 21230, 21778, 22318, 22851, 23376, 23892, 24400, 24897, - 25384, 25860, 26325, 26778, 27217, 27644, 28055, 28452, 28833, 29197, 29545, 29876, 30189, 30485, 30764, 31024, 31267, 31492, 31698, 31886, - 32055, 32205, 32336, 32448, 32542, 32618, 32678, 32722, 32751, 32766, 32767, 32756, 32731, 32692, 32637, 32565, 32475, 32364, 32233, 32082, - 31911, 31726, 31551, 31261, 30855, 30461, 30055, 29633, 29194, 28739, 28271, 27790, 27300, 26802, 26298, 25790, 25279, 24765, 24249, 23729, - 23205, 22678, 22145, 21608, 21067, 20521, 19971, 19417, 18861, 18303, 17743, 17181, 16618, 16054, 15488, 14920, 14351, 13780, 13208, 12636, - 12064, 11494, 10925, 10359, 9795, 9233, 8671, 8108, 7542, 6972, 6398, 5818, 5236, 4654, 4077, 3512, 2965, 2445, 1961, 1516, 1114, 735, 325, -}; - - -/* 5ms delay prototype */ -const Word16 LDQMF_10_fx[] = // q = 15 sf = 15388 qsf = 14 -{ - 4, 2, -2, -7, -11, -13, -14, -14, -16, -21, -31, -44, -56, -66, -70, -67, -57, -39, -15, 12, -43, -75, -104, -132, -156, -178, -196, -210, - -221, -229, -238, -248, -262, -281, -306, -332, -353, -359, -340, -281, 168, -11, -267, -606, -1030, -1534, -2105, -2724, -3361, -3979, -4533, - -4973, -5242, -5284, -5046, -4480, -3551, -2234, -523, 1572, -4024, -6784, -9789, -12957, -16197, -19406, -22478, -25307, -27793, -29846, -31391, - -32374, -32768, -32565, -31782, -30462, -28663, -26465, -23956, -21234, 18397, 15542, 12766, 10150, 7762, 5656, 3864, 2396, 1242, 371, -221, - -567, -753, -808, -763, -646, -489, -322, -174, -64, -}; - -const Word16 LDQMF_16_fx[] = // q = 15 sf = 15388 qsf = 14 -{ - 4, 3, 1, 0, -3, -7, -9, -12, -13, -14, -14, -14, -14, -16, -19, -23, -29, -37, -45, -53, -60, -65, -69, -70, -68, -64, -56, -45, -32, -16, 0, 18, - -38, -57, -76, -95, -113, -130, -146, -161, -174, -186, -197, -206, -214, -220, -226, -231, -236, -242, -248, -257, -267, -280, -295, -311, -327, - -342, -353, -359, -357, -342, -312, -264, 194, 98, -24, -178, -364, -583, -835, -1119, -1434, -1777, -2143, -2527, -2922, -3321, -3714, -4089, - -4437, -4743, -4995, -5179, -5282, -5289, -5188, -4966, -4613, -4120, -3480, -2688, -1742, -641, 610, 2006, -3539, -5197, -6965, -8828, -10765, - -12756, -14777, -16804, -18811, -20773, -22663, -24455, -26125, -27649, -29006, -30177, -31143, -31892, -32415, -32708, -32768, -32594, -32193, - -31574, -30747, -29729, -28536, -27189, -25709, -24120, -22444, -20707, 18934, 17143, 15365, 13619, 11927, 10307, 8775, 7345, 6028, 4832, 3762, - 2820, 2002, 1305, 720, 235, -135, -394, -583, -710, -783, -808, -793, -746, -672, -581, -479, -374, -273, -182, -107, -49, -}; - -const Word16 LDQMF_20_fx[] = // q = 15 sf = 15390 qsf = 14 -{ - 4, 4, 3, 1, -1, -3, -6, -8, -10, -12, -13, -13, -14, -14, -14, -14, -15, -17, -20, -23, -28, -34, -41, -47, -53, -59, -64, -67, -70, -70, -69, -65, - -60, -53, -44, -33, -21, -8, 5, 20, -36, -51, -67, -82, -97, -111, -125, -138, -150, -162, -173, -182, -191, -199, -207, -213, -218, -223, -227, - -231, -235, -240, -245, -251, -258, -266, -276, -287, -299, -312, -325, -338, -348, -356, -360, -357, -348, -329, -300, -258, 202, 130, 40, -67, - -195, -344, -513, -704, -916, -1149, -1401, -1671, -1957, -2256, -2566, -2882, -3201, -3518, -3828, -4125, -4403, -4655, -4876, -5057, -5193, -5275, - -5297, -5252, -5134, -4936, -4654, -4283, -3818, -3258, -2600, -1843, -987, -34, 1014, 2153, -3380, -4687, -6068, -7514, -9017, -10567, -12153, -13762, - -15383, -17003, -18609, -20188, -21726, -23209, -24625, -25961, -27205, -28346, -29373, -30279, -31052, -31686, -32178, -32523, -32720, -32768, -32666, - -32417, -32026, -31496, -30835, -30049, -29149, -28143, -27043, -25859, -24603, -23288, -21925, -20528, 19110, 17678, 16249, 14835, 13446, 12092, 10783, - 9528, 8333, 7207, 6153, 5177, 4281, 3466, 2732, 2078, 1502, 999, 565, 191, -105, -324, -497, -627, -719, -777, -805, -805, -782, -739, -680, -609, -530, - -447, -363, -283, -208, -142, -88, -44, -}; - -const Word16 LDQMF_30_fx[] = // q = 15 sf = 15388 qsf = 14 -{ - 3, 4, 4, 3, 2, 0, 0, -2, -4, -5, -7, -8, -10, -11, -12, -13, -13, -13, -14, -14, -14, -14, -14, -14, -15, -16, -17, -19, -21, -24, -27, -31, -35, -40, - -44, -48, -52, -56, -60, -63, -66, -68, -69, -70, -70, -69, -67, -65, -61, -57, -51, -45, -39, -31, -23, -15, -6, 3, 12, 22, -33, -43, -54, -64, -75, - -85, -95, -104, -114, -123, -132, -140, -148, -156, -164, -171, -178, -184, -190, -196, -201, -205, -210, -214, -217, -221, -224, -227, -229, -232, -235, - -238, -241, -244, -248, -252, -257, -262, -268, -274, -281, -289, -297, -306, -314, -323, -332, -339, -347, -353, -357, -359, -359, -356, -350, -340, -325, - -306, -281, -250, 212, 168, 116, 56, -11, -87, -172, -267, -370, -484, -606, -738, -880, -1030, -1190, -1358, -1534, -1718, -1908, -2105, -2307, -2514, - -2724, -2936, -3149, -3361, -3571, -3778, -3979, -4173, -4359, -4533, -4695, -4842, -4973, -5084, -5175, -5242, -5284, -5298, -5284, -5238, -5159, -5046, - -4896, -4708, -4480, -4212, -3903, -3551, -3156, -2717, -2234, -1707, -1137, -523, 133, 832, 1572, 2352, -3170, -4024, -4913, -5833, -6784, -7762, -8765, - -9789, -10831, -11888, -12957, -14034, -15115, -16197, -17275, -18346, -19406, -20451, -21476, -22478, -23453, -24398, -25307, -26179, -27008, -27793, - -28529, -29215, -29846, -30422, -30938, -31391, -31783, -32111, -32374, -32571, -32703, -32768, -32766, -32698, -32565, -32367, -32105, -31782, -31399, - -30958, -30462, -29912, -29311, -28663, -27971, -27237, -26465, -25658, -24821, -23956, -23067, -22159, -21234, -20296, 19352, 18397, 17442, 16489, 15542, - 14603, 13677, 12766, 11872, 10999, 10150, 9326, 8529, 7762, 7027, 6324, 5656, 5023, 4425, 3864, 3338, 2849, 2396, 1977, 1593, 1242, 922, 633, 371, 134, -63, - -221, -356, -471, -567, -645, -707, -753, -784, -802, -808, -803, -788, -763, -730, -691, -646, -597, -544, -489, -433, -377, -322, -270, -220, -174, -132, - -96, -64, -36, -}; - -const Word16 LDQMF_32_fx[] = // q = 15 sf = 15392 qsf = 14 -{ - 3, 4, 4, 3, 2, 1, 0, -1, -3, -4, -6, -7, -9, -10, -11, -12, -13, -13, -13, -14, -14, -14, -14, -14, -14, -15, -15, -16, -18, -19, -22, -24, -27, -31, -35, - -39, -43, -47, -51, -54, -58, -61, -64, -66, -68, -70, -70, -70, -69, -67, -65, -62, -58, -53, -48, -42, -35, -28, -20, -12, -4, 4, 13, 22, -33, -42, -52, - -62, -72, -81, -91, -100, -109, -117, -126, -134, -142, -150, -157, -164, -171, -177, -183, -189, -194, -199, -204, -208, -212, -215, -219, -222, -224, - -227, -230, -232, -235, -237, -240, -243, -246, -250, -254, -259, -264, -270, -277, -283, -291, -298, -306, -315, -323, -331, -338, -345, -351, -356, -359, - -360, -358, -354, -347, -336, -321, -302, -278, -248, 213, 172, 125, 70, 8, -60, -137, -221, -314, -415, -525, -642, -768, -902, -1045, -1195, -1352, -1517, - -1688, -1866, -2049, -2237, -2429, -2625, -2822, -3021, -3221, -3419, -3616, -3809, -3997, -4178, -4352, -4516, -4670, -4811, -4937, -5047, -5139, -5212, -5263, - -5292, -5296, -5273, -5223, -5143, -5032, -4889, -4713, -4502, -4256, -3973, -3653, -3296, -2900, -2465, -1992, -1481, -930, -342, 283, 945, 1644, 2377, -3143, - -3942, -4771, -5628, -6512, -7421, -8353, -9304, -10273, -11256, -12252, -13256, -14267, -15281, -16294, -17305, -18309, -19303, -20284, -21249, -22194, -23116, - -24013, -24880, -25715, -26515, -27277, -27999, -28677, -29310, -29896, -30432, -30916, -31344, -31718, -32037, -32299, -32503, -32650, -32738, -32768, -32739, - -32652, -32508, -32308, -32052, -31742, -31379, -30966, -30504, -29994, -29440, -28844, -28207, -27533, -26825, -26085, -25316, -24521, -23703, -22865, -22010, - -21141, -20262, 19377, 18482, 17587, 16693, 15804, 14921, 14049, 13188, 12342, 11512, 10702, 9913, 9147, 8405, 7690, 7003, 6344, 5716, 5118, 4552, 4017, 3514, - 3043, 2603, 2195, 1817, 1468, 1149, 856, 590, 348, 127, -58, -207, -337, -448, -542, -620, -683, -733, -769, -793, -806, -808, -800, -784, -760, -729, -692, -651, - -605, -556, -505, -452, -400, -348, -297, -249, -203, -162, -124, -91, -62, -35, -}; - -const Word16 LDQMF_40_fx[] = // q = 15 sf = 15391 qsf = 14 -{ - 3, 4, 4, 4, 3, 2, 1, 0, 0, -1, -2, -4, -5, -6, -7, -9, -10, -11, -11, -12, -13, -13, -13, -13, -14, -14, -14, -14, -14, -14, -14, -14, -15, -16, -16, -18, -19, -20, - -22, -24, -27, -30, -33, -36, -39, -42, -46, -49, -52, -55, -58, -60, -63, -65, -67, -68, -69, -70, -70, -70, -69, -68, -66, -64, -61, -58, -55, -51, -46, -41, -36, - -30, -24, -18, -11, -5, 1, 9, 16, 23, -32, -39, -47, -55, -63, -71, -78, -86, -93, -101, -108, -115, -122, -128, -135, -141, -147, -153, -159, -165, -170, -175, -180, - -185, -189, -193, -197, -201, -205, -208, -211, -214, -217, -219, -222, -224, -226, -228, -230, -232, -234, -236, -239, -241, -243, -246, -249, -252, -256, -260, -264, - -268, -273, -279, -284, -290, -296, -302, -309, -315, -322, -328, -335, -340, -346, -350, -354, -357, -359, -360, -358, -356, -351, -344, -335, -323, -308, -291, -270, - -245, 217, 185, 149, 109, 64, 15, -38, -97, -161, -230, -304, -384, -469, -559, -655, -755, -861, -973, -1089, -1210, -1336, -1467, -1602, -1741, -1884, -2030, -2180, - -2333, -2487, -2644, -2802, -2962, -3121, -3281, -3439, -3596, -3751, -3903, -4052, -4196, -4335, -4468, -4595, -4714, -4824, -4925, -5016, -5096, -5163, -5218, -5259, - -5286, -5297, -5292, -5269, -5229, -5170, -5091, -4993, -4873, -4732, -4569, -4384, -4175, -3943, -3687, -3407, -3103, -2774, -2420, -2041, -1638, -1210, -758, -281, - 218, 743, 1290, 1860, 2452, -3065, -3699, -4352, -5025, -5715, -6423, -7146, -7884, -8636, -9400, -10175, -10960, -11753, -12552, -13357, -14166, -14976, -15788, -16598, - -17406, -18209, -19006, -19795, -20575, -21344, -22101, -22842, -23568, -24276, -24965, -25633, -26279, -26901, -27498, -28069, -28612, -29126, -29610, -30062, -30483, - -30870, -31222, -31539, -31820, -32066, -32276, -32448, -32584, -32683, -32744, -32768, -32754, -32703, -32615, -32491, -32330, -32135, -31904, -31639, -31341, -31010, - -30648, -30255, -29833, -29383, -28905, -28402, -27875, -27325, -26753, -26160, -25550, -24921, -24278, -23620, -22950, -22268, -21577, -20879, -20174, 19467, 18751, - 18035, 17319, 16604, 15892, 15185, 14484, 13789, 13103, 12426, 11759, 11105, 10463, 9835, 9222, 8625, 8045, 7481, 6936, 6409, 5901, 5413, 4945, 4497, 4069, 3662, 3275, - 2908, 2561, 2234, 1927, 1639, 1370, 1118, 884, 667, 466, 279, 107, -41, -164, -274, -372, -458, -533, -598, -654, -700, -737, -766, -787, -801, -807, -807, -801, -790, - -773, -751, -726, -696, -664, -628, -590, -551, -510, -468, -426, -384, -343, -302, -263, -226, -191, -158, -127, -100, -76, -54, -32, -}; - -const Word16 LDQMF_60_fx[] = // q = 15 sf = 15391 qsf = 14 -{ - 3, 4, 4, 4, 4, 3, 3, 3, 2, 1, 1, 0, 0, -1, -1, -2, -3, -4, -5, -6, -6, -7, -8, -9, -9, -10, -11, -11, -12, -12, -12, -13, -13, -13, -13, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -15, -15, -16, -16, -17, -18, -19, -20, -21, -22, -23, -25, -26, -28, -30, -32, -34, -36, -39, -41, -43, -45, -47, -49, -51, -53, -55, -57, -59, - -61, -62, -64, -65, -66, -67, -68, -69, -70, -70, -70, -70, -70, -69, -69, -68, -67, -65, -64, -62, -60, -58, -55, -53, -50, -47, -44, -40, -37, -33, -29, -25, -21, -17, -13, - -8, -3, 0, 5, 10, 15, 20, 25, -30, -36, -41, -46, -51, -57, -62, -67, -72, -77, -82, -87, -92, -97, -102, -107, -111, -116, -121, -125, -129, -134, -138, -142, -146, -150, - -154, -158, -162, -166, -169, -173, -176, -179, -182, -186, -189, -191, -194, -197, -199, -202, -204, -207, -209, -211, -213, -215, -216, -218, -220, -221, -223, -224, -226, - -227, -229, -230, -231, -233, -234, -235, -237, -238, -240, -241, -243, -245, -247, -249, -251, -253, -255, -258, -260, -263, -266, -269, -273, -276, -280, -283, -287, -291, - -295, -299, -304, -308, -312, -317, -321, -325, -329, -334, -337, -341, -345, -348, -351, -354, -356, -358, -359, -360, -359, -359, -357, -355, -352, -348, -343, -337, -329, - -321, -311, -300, -287, -273, -258, -241, 222, 202, 180, 156, 130, 102, 72, 40, 6, -29, -67, -107, -150, -195, -242, -292, -344, -398, -454, -513, -575, -638, -704, -773, -843, - -916, -992, -1069, -1149, -1231, -1315, -1401, -1489, -1579, -1671, -1765, -1860, -1957, -2055, -2155, -2256, -2358, -2462, -2566, -2671, -2776, -2882, -2988, -3095, -3201, - -3307, -3413, -3518, -3622, -3726, -3828, -3929, -4028, -4125, -4220, -4313, -4403, -4490, -4574, -4655, -4733, -4806, -4876, -4941, -5002, -5057, -5108, -5153, -5193, -5226, - -5254, -5275, -5289, -5297, -5297, -5289, -5275, -5252, -5221, -5181, -5133, -5077, -5011, -4936, -4851, -4757, -4654, -4540, -4416, -4283, -4138, -3984, -3818, -3642, -3456, - -3258, -3050, -2830, -2600, -2359, -2106, -1843, -1569, -1283, -987, -680, -362, -34, 304, 654, 1013, 1383, 1763, 2153, 2553, -2962, -3380, -3807, -4242, -4687, -5139, -5599, - -6067, -6543, -7025, -7514, -8009, -8510, -9017, -9529, -10046, -10567, -11092, -11620, -12152, -12687, -13223, -13762, -14301, -14842, -15383, -15924, -16464, -17003, -17541, - -18076, -18609, -19139, -19665, -20187, -20705, -21218, -21725, -22226, -22721, -23208, -23688, -24160, -24624, -25079, -25524, -25960, -26386, -26800, -27204, -27596, -27977, - -28345, -28701, -29043, -29373, -29688, -29990, -30278, -30552, -30810, -31052, -31278, -31489, -31685, -31865, -32029, -32177, -32308, -32424, -32522, -32605, -32670, -32719, - -32752, -32768, -32767, -32749, -32715, -32665, -32598, -32515, -32416, -32302, -32171, -32025, -31863, -31687, -31495, -31289, -31068, -30834, -30585, -30324, -30049, -29761, - -29461, -29148, -28824, -28489, -28143, -27786, -27419, -27042, -26656, -26262, -25858, -25447, -25028, -24603, -24170, -23732, -23287, -22838, -22383, -21925, -21462, -20997, - -20528, -20057, 19586, 19110, 18633, 18155, 17677, 17200, 16724, 16248, 15775, 15303, 14834, 14368, 13905, 13445, 12990, 12538, 12092, 11650, 11214, 10783, 10358, 9939, 9527, - 9122, 8724, 8333, 7950, 7574, 7207, 6847, 6496, 6153, 5819, 5493, 5177, 4869, 4570, 4281, 4000, 3728, 3466, 3212, 2968, 2732, 2505, 2287, 2078, 1878, 1686, 1502, 1326, 1159, - 999, 847, 702, 565, 434, 310, 191, 80, -19, -105, -183, -257, -324, -387, -444, -497, -545, -588, -627, -662, -693, -719, -742, -762, -777, -790, -799, -805, -808, -808, -805, - -800, -792, -782, -770, -755, -739, -721, -701, -680, -658, -634, -609, -584, -557, -530, -503, -475, -447, -419, -391, -363, -336, -309, -283, -257, -232, -208, -185, -163, - -142, -123, -104, -88, -72, -57, -44, -28, -}; - -#else /* OPT_IVAS_FILTER_ROM */ const Word32 CLDFB80_10_fx[100] = // q = 30 { @@ -6200,7 +5963,6 @@ const Word32 LDQMF_60_fx[] = // q = 30 -7153632, -6413878, -5706099, -5031208, -4393110, -3792571, -3230785, -2713518, -2227977, -1784736, -1364255, -871387 }; -#endif /* OPT_IVAS_FILTER_ROM */ const Word32 rot_vec_delay_re_LDQMF_fx[60] = // q = 31 { diff --git a/lib_com/rom_com_fx.h b/lib_com/rom_com_fx.h index 9bf335aac..3f35abb9f 100644 --- a/lib_com/rom_com_fx.h +++ b/lib_com/rom_com_fx.h @@ -70,24 +70,6 @@ extern const Word16 sin_twiddle_table_25_5_5[25]; // Q15 extern const Word16 cos_twiddle_table_16_8_2[16]; // Q15 extern const Word16 sin_twiddle_table_16_8_2[16]; // Q15 -#ifndef OPT_IVAS_FILTER_ROM -extern const Word16 CLDFB80_10_fx[100]; // Q15 -extern const Word16 CLDFB80_16_fx[160]; // Q15 -extern const Word16 CLDFB80_20_fx[200]; // Q15 -extern const Word16 CLDFB80_30_fx[300]; // Q15 -extern const Word16 CLDFB80_32_fx[320]; // Q15 -extern const Word16 CLDFB80_40_fx[400]; // Q15 -extern const Word16 CLDFB80_60_fx[600]; // Q15 - -/*5ms delay*/ -extern const Word16 LDQMF_10_fx[100]; // Q15 -extern const Word16 LDQMF_16_fx[160]; // Q15 -extern const Word16 LDQMF_20_fx[200]; // Q15 -extern const Word16 LDQMF_30_fx[300]; // Q15 -extern const Word16 LDQMF_32_fx[320]; // Q15 -extern const Word16 LDQMF_40_fx[400]; // Q15 -extern const Word16 LDQMF_60_fx[600]; // Q15 -#else /* OPT_IVAS_FILTER_ROM */ extern const Word32 CLDFB80_10_fx[100]; // Q30 extern const Word32 CLDFB80_16_fx[160]; // Q30 @@ -105,7 +87,6 @@ extern const Word32 LDQMF_30_fx[300]; // Q30 extern const Word32 LDQMF_32_fx[320]; // Q30 extern const Word32 LDQMF_40_fx[400]; // Q30 extern const Word32 LDQMF_60_fx[600]; // Q30 -#endif /* OPT_IVAS_FILTER_ROM */ /* Not used anywhere extern const Word16 LDQMF_10_enc_fx[100]; extern const Word16 LDQMF_16_enc_fx[160]; diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h index 506d2d1cd..07ee62965 100644 --- a/lib_com/stat_com.h +++ b/lib_com/stat_com.h @@ -619,11 +619,7 @@ typedef struct cldfb_filter_bank_struct Word16 da; /* delay analysis */ CLDFB_PROTOTYPE prototype; const Word16 *p_filter; /*!< Pointer to filter coefficients */ // Q15 -#ifdef OPT_IVAS_FILTER_ROM const Word32 *p_filter_32; /*!< Pointer to filter coefficients */ // Q15 -#else /* OPT_IVAS_FILTER_ROM */ - Word16 p_filter_sf; // Q0 -#endif /* OPT_IVAS_FILTER_ROM */ /* rotation vectors */ const Word32 *rot_vec_syn_re_fx; // Q29 diff --git a/lib_isar/isar_splitRendererPost.c b/lib_isar/isar_splitRendererPost.c index 632e1cdc5..09e2d7fc2 100644 --- a/lib_isar/isar_splitRendererPost.c +++ b/lib_isar/isar_splitRendererPost.c @@ -1846,11 +1846,7 @@ static void isar_rend_CldfbSplitPostRendProcessTdIn( ImagBuffer_fx[slot_idx] = Cldfb_ImagBuffer_Binaural_fx[ch_idx][slot_idx]; scaleFactor = s_min( scaleFactor, s_min( getScaleFactor32( RealBuffer_fx[slot_idx], CLDFB_NO_CHANNELS_MAX ), getScaleFactor32( ImagBuffer_fx[slot_idx], CLDFB_NO_CHANNELS_MAX ) ) ); } -#ifdef OPT_IVAS_FILTER_ROM scaleFactor = s_min( sub( scaleFactor, 6 ), Q24 ); // guarded bits -#else - scaleFactor = s_min( sub( scaleFactor, 3 ), Q24 ); // guarded bits -#endif FOR( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) { Scale_sig32( RealBuffer_fx[slot_idx], CLDFB_NO_CHANNELS_MAX, scaleFactor ); @@ -1918,11 +1914,7 @@ void isar_rend_CldfbSplitPostRendProcess( scaleFactor = s_min( scaleFactor, s_min( getScaleFactor32( RealBuffer_fx[slot_idx], CLDFB_NO_CHANNELS_MAX ), getScaleFactor32( ImagBuffer_fx[slot_idx], CLDFB_NO_CHANNELS_MAX ) ) ); } -#ifdef OPT_IVAS_FILTER_ROM scaleFactor = s_min( sub( scaleFactor, 6 ), Q24 ); // guarded bits -#else - scaleFactor = s_min( sub( scaleFactor, 3 ), Q24 ); // guarded bits -#endif FOR( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) { Scale_sig32( RealBuffer_fx[slot_idx], CLDFB_NO_CHANNELS_MAX, scaleFactor ); diff --git a/lib_isar/lib_isar_post_rend.c b/lib_isar/lib_isar_post_rend.c index c0a199e95..723d29000 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -1504,11 +1504,7 @@ static ivas_error renderSplitBinauralWithPostRot( scaleFactor = s_min( scaleFactor, s_min( getScaleFactor32( RealBuffer_fx[slot_idx], CLDFB_NO_CHANNELS_MAX ), getScaleFactor32( ImagBuffer_fx[slot_idx], CLDFB_NO_CHANNELS_MAX ) ) ); } -#ifdef OPT_IVAS_FILTER_ROM scaleFactor = sub( scaleFactor, 6 ); // guarded bits -#else - scaleFactor = sub( scaleFactor, 3 ); // guarded bits -#endif FOR( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) { diff --git a/lib_isar/lib_isar_pre_rend.c b/lib_isar/lib_isar_pre_rend.c index cecea02ae..d4809fc30 100644 --- a/lib_isar/lib_isar_pre_rend.c +++ b/lib_isar/lib_isar_pre_rend.c @@ -444,11 +444,7 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( q_final = s_min( q1, q2 ); q_final = s_min( add( Q_buff_re, q_final ), add( Q_buff_im, q_final ) ); -#ifdef OPT_IVAS_FILTER_ROM q_final = sub( q_final, 6 ); // guard bits -#else - q_final = sub( q_final, 3 ); // guard bits -#endif q_final = s_min( q_final, Q25 ); FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) @@ -512,11 +508,7 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( } q_final = s_min( q1, q2 ); q_final = s_min( add( Q_buff_re, q_final ), add( Q_buff_im, q_final ) ); -#ifdef OPT_IVAS_FILTER_ROM q_final = sub( q_final, 6 ); // guard bits -#else - q_final = sub( q_final, 3 ); // guard bits -#endif q_final = s_min( q_final, Q25 ); FOR( j = 0; j < CLDFB_NO_COL_MAX; j++ ) { -- GitLab From 4a8653000b35921e2425a776c1c9e20837059166 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:56:41 +0200 Subject: [PATCH 18/35] [cleanup] remove inactive //#define HARM_SCE_INIT --- lib_com/options.h | 1 - lib_enc/ivas_init_enc_fx.c | 8 -------- lib_enc/ivas_sce_enc_fx.c | 2 -- 3 files changed, 11 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 0eff953e7..7bbefaff9 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -79,7 +79,6 @@ #define OPT_BIN_REND_V2_NBE /* Both following 2 macros (IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST*) are independent from each other, they refer to different code blocks */ //#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version. Obsoleted by MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE. */ -//#define HARM_SCE_INIT #define MERGE_REQUEST_1472_SPEEDUP_ivas_mc_param_enc_fx_NONBE /* FhG: reduce WMOPS of dmx calculation in ivas_param_mc_param_est_enc_fx() by using 64 Bit addition. Requires MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE. */ diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index 68b7fa7f7..8dc2a6254 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -558,19 +558,11 @@ ivas_error ivas_init_encoder_fx( move16(); sce_id = 0; move16(); -#ifndef HARM_SCE_INIT test(); IF( NE_32( ( error = create_evs_sce_enc_fx( st_ivas, sce_id, ivas_total_brate ) ), IVAS_ERR_OK ) ) { return error; } -#else - test(); - IF( NE_32( ( error = create_sce_enc_fx( st_ivas, sce_id, ivas_total_brate ) ), IVAS_ERR_OK ) ) - { - return error; - } -#endif /* prepare stereo downmix for EVS */ IF( EQ_16( hEncoderConfig->stereo_dmx_evs, 1 ) ) { diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 879a98246..65420a56d 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -490,7 +490,6 @@ ivas_error create_sce_enc_fx( * * Create, allocate and initialize EVS encoder SCE handle *-------------------------------------------------------------------------*/ -#ifndef HARM_SCE_INIT ivas_error create_evs_sce_enc_fx( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const Word16 sce_id, /* i : SCE # identifier */ @@ -632,7 +631,6 @@ ivas_error create_evs_sce_enc_fx( return error; } -#endif /*------------------------------------------------------------------------- * destroy_sce_enc_fx() * -- GitLab From ae43357765f6f970c861762bd98819ad5b267dee Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:58:53 +0200 Subject: [PATCH 19/35] [cleanup] accept MERGE_REQUEST_1472_SPEEDUP_ivas_mc_param_enc_fx_NONBE, remove inactive IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE --- lib_com/options.h | 4 -- lib_enc/ivas_mc_param_enc_fx.c | 119 --------------------------------- 2 files changed, 123 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 7bbefaff9..617cd5211 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,10 +77,6 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE #define OPT_BIN_REND_V2_NBE -/* Both following 2 macros (IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST*) are independent from each other, they refer to different code blocks */ -//#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version. Obsoleted by MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE. */ -#define MERGE_REQUEST_1472_SPEEDUP_ivas_mc_param_enc_fx_NONBE /* FhG: reduce WMOPS of dmx calculation in ivas_param_mc_param_est_enc_fx() by using 64 Bit addition. Requires MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE. */ - #define FIX_1348_BIT_PRECISION_IMPROVEMENT #define FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index ba2c52073..b748d26fa 100644 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -664,15 +664,8 @@ static void ivas_param_mc_param_est_enc_fx( Word32 *p_slot_frame_f_real_fx[MAX_CICP_CHANNELS]; /* Output of the MDFT FB - real part */ Word32 *p_slot_frame_f_imag_fx[MAX_CICP_CHANNELS]; /* Output of the MDFT FB - imag part */ -#ifdef MERGE_REQUEST_1472_SPEEDUP_ivas_mc_param_enc_fx_NONBE Word64 dmx_real_64[PARAM_MC_MAX_TRANSPORT_CHANS]; Word64 dmx_imag_64[PARAM_MC_MAX_TRANSPORT_CHANS]; -#else - Word32 dmx_real_fx[PARAM_MC_MAX_TRANSPORT_CHANS]; /* Downmix channel - Real Part */ - Word16 dmx_real_e[PARAM_MC_MAX_TRANSPORT_CHANS]; /* Downmix channel - Real Part */ - Word32 dmx_imag_fx[PARAM_MC_MAX_TRANSPORT_CHANS]; /* Downmix channel - Imag Part */ - Word16 dmx_imag_e[PARAM_MC_MAX_TRANSPORT_CHANS]; /* Downmix channel - Imag Part */ -#endif Word32 a_fx, b_fx, c_fx, d_fx; /* Tmp complex values */ Word16 a_e, b_e, c_e, d_e; /* Tmp complex values */ Word64 Cy_sum_real_64[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; @@ -749,9 +742,6 @@ static void ivas_param_mc_param_est_enc_fx( } Word16 gb = find_guarded_bits_fx( l_ts ); -#ifndef MERGE_REQUEST_1472_SPEEDUP_ivas_mc_param_enc_fx_NONBE - Word16 add20gb = add( 20, gb ); -#endif sub35gb = sub( 32, sub( 11, find_guarded_bits_fx( l_ts ) ) ); // 31 - (((11 - gb) + 31 + norm) - 32) sub62gb = sub( 63, shl( sub( 11, find_guarded_bits_fx( l_ts ) ), 1 ) ); // 31 - ((2*(11 - gb) + norm) - 32) @@ -784,7 +774,6 @@ static void ivas_param_mc_param_est_enc_fx( FOR( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) { -#ifdef MERGE_REQUEST_1472_SPEEDUP_ivas_mc_param_enc_fx_NONBE Word64 real_64; Word64 imag_64; @@ -803,61 +792,17 @@ static void ivas_param_mc_param_est_enc_fx( move64(); move64(); -#else - Word32 real_fx = L_add( 0, 0 ); - Word16 real_e = add( 0, 0 ); - Word32 imag_fx = L_add( 0, 0 ); - Word16 imag_e = add( 0, 0 ); - FOR( inp_ch = 0; inp_ch < nchan_input; inp_ch++ ) - { - L_tmp = Mpy_32_32( slot_frame_f_real_fx[inp_ch][cur_cldfb_band], ( *p_dmx_fac_fx ) ); - real_fx = BASOP_Util_Add_Mant32Exp( real_fx, real_e, L_tmp, add20gb, &real_e ); - L_tmp = Mpy_32_32( slot_frame_f_imag_fx[inp_ch][cur_cldfb_band], ( *p_dmx_fac_fx ) ); - imag_fx = BASOP_Util_Add_Mant32Exp( imag_fx, imag_e, L_tmp, add20gb, &imag_e ); - p_dmx_fac_fx++; - } - dmx_real_fx[ch_idx1] = real_fx; - dmx_real_e[ch_idx1] = real_e; - dmx_imag_fx[ch_idx1] = imag_fx; - dmx_imag_e[ch_idx1] = imag_e; - move32(); - move16(); - move32(); - move16(); - -#endif } /* Cx for transport channels */ FOR( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) { -#ifdef MERGE_REQUEST_1472_SPEEDUP_ivas_mc_param_enc_fx_NONBE CONVERT_DMX( dmx_real_64[ch_idx1], a_fx, a_e ); CONVERT_DMX( dmx_imag_64[ch_idx1], b_fx, b_e ); -#endif FOR( ch_idx2 = 0; ch_idx2 < nchan_transport; ++ch_idx2 ) { -#ifdef MERGE_REQUEST_1472_SPEEDUP_ivas_mc_param_enc_fx_NONBE CONVERT_DMX( dmx_real_64[ch_idx2], c_fx, c_e ); CONVERT_DMX( dmx_imag_64[ch_idx2], d_fx, d_e ); -#else - a_fx = dmx_real_fx[ch_idx1]; - move32(); - a_e = dmx_real_e[ch_idx1]; - move16(); - b_fx = dmx_imag_fx[ch_idx1]; - move32(); - b_e = dmx_imag_e[ch_idx1]; - move16(); - c_fx = dmx_real_fx[ch_idx2]; - move32(); - c_e = dmx_real_e[ch_idx2]; - move16(); - d_fx = dmx_imag_fx[ch_idx2]; - move32(); - d_e = dmx_imag_e[ch_idx2]; - move16(); -#endif /* (a-ib)(c+id) = ac + bd + i(ad-bc) */ L_tmp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a_fx, c_fx ), add( a_e, c_e ), Mpy_32_32( b_fx, d_fx ), add( b_e, d_e ), &tmp_e ); @@ -907,7 +852,6 @@ static void ivas_param_mc_param_est_enc_fx( FOR( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) { -#ifdef MERGE_REQUEST_1472_SPEEDUP_ivas_mc_param_enc_fx_NONBE Word64 real_64; Word64 imag_64; @@ -926,54 +870,15 @@ static void ivas_param_mc_param_est_enc_fx( dmx_imag_64[ch_idx1] = imag_64; move64(); move64(); -#else - Word32 real_fx = L_add( 0, 0 ); - Word16 real_e = 0; - move16(); - Word32 imag_fx = L_add( 0, 0 ); - Word16 imag_e = 0; - move16(); - - FOR( inp_ch = 0; inp_ch < nchan_input; inp_ch++ ) - { - L_tmp = Mpy_32_32( slot_frame_f_real_fx[inp_ch][cur_cldfb_band], ( *p_dmx_fac_fx ) ); - real_fx = BASOP_Util_Add_Mant32Exp( real_fx, real_e, L_tmp, add20gb, &real_e ); - L_tmp = Mpy_32_32( slot_frame_f_imag_fx[inp_ch][cur_cldfb_band], ( *p_dmx_fac_fx ) ); - imag_fx = BASOP_Util_Add_Mant32Exp( imag_fx, imag_e, L_tmp, add20gb, &imag_e ); - p_dmx_fac_fx++; - } - dmx_real_fx[ch_idx1] = real_fx; - move32(); - dmx_real_e[ch_idx1] = real_e; - move16(); - dmx_imag_fx[ch_idx1] = imag_fx; - move32(); - dmx_imag_e[ch_idx1] = imag_e; - move16(); - -#endif } /* Cx for transport channels */ FOR( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) { -#ifdef MERGE_REQUEST_1472_SPEEDUP_ivas_mc_param_enc_fx_NONBE CONVERT_DMX( dmx_real_64[ch_idx1], a_fx, a_e ); CONVERT_DMX( dmx_imag_64[ch_idx1], b_fx, b_e ); -#else - a_fx = dmx_real_fx[ch_idx1]; - move32(); - a_e = dmx_real_e[ch_idx1]; - move16(); - b_fx = dmx_imag_fx[ch_idx1]; - move32(); - b_e = dmx_imag_e[ch_idx1]; - move16(); - -#endif FOR( ch_idx2 = 0; ch_idx2 < nchan_transport; ++ch_idx2 ) { -#ifdef MERGE_REQUEST_1472_SPEEDUP_ivas_mc_param_enc_fx_NONBE CONVERT_DMX( dmx_real_64[ch_idx2], c_fx, c_e ); CONVERT_DMX( dmx_imag_64[ch_idx2], d_fx, d_e ); @@ -981,12 +886,6 @@ static void ivas_param_mc_param_est_enc_fx( L_tmp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a_fx, c_fx ), add( a_e, c_e ), Mpy_32_32( b_fx, d_fx ), add( b_e, d_e ), &tmp_e ); Cx_sum_fx[cur_param_band][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cx_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cx_sum_e[cur_param_band][ch_idx1][ch_idx2], L_tmp, tmp_e, &Cx_sum_e[cur_param_band][ch_idx1][ch_idx2] ); -#else - /* (a-ib)(c+id) = ac + bd + i(ad-bc) */ - L_tmp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a_fx, dmx_real_fx[ch_idx2] ), add( a_e, dmx_real_e[ch_idx2] ), Mpy_32_32( b_fx, dmx_imag_fx[ch_idx2] ), add( b_e, dmx_imag_e[ch_idx2] ), &tmp_e ); - Cx_sum_fx[cur_param_band][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cx_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cx_sum_e[cur_param_band][ch_idx1][ch_idx2], L_tmp, tmp_e, - &Cx_sum_e[cur_param_band][ch_idx1][ch_idx2] ); -#endif move32(); } } @@ -994,24 +893,6 @@ static void ivas_param_mc_param_est_enc_fx( /* Cy for input channels */ FOR( ch_idx1 = 0; ch_idx1 < nchan_input; ++ch_idx1 ) { -#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE - a_e = norm_l( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band] ); - a_fx = L_shl( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], a_e ); - a_e = sub( add20gb, a_e ); - if ( a_fx == 0 ) - { - a_e = 0; - move16(); - } - b_e = norm_l( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band] ); - b_fx = L_shl( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band], b_e ); - b_e = sub( add20gb, b_e ); - if ( b_fx == 0 ) - { - b_e = 0; - move16(); - } -#endif a_fx = slot_frame_f_real_fx[ch_idx1][cur_cldfb_band]; b_fx = slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band]; move32(); -- GitLab From a7e803878ef91f30a9d83e879ed6bc3a8a0bce8b Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 19:59:46 +0200 Subject: [PATCH 20/35] [cleanup] accept FIX_1802 --- lib_com/options.h | 1 - lib_dec/dec_tcx_fx.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 617cd5211..03ba8052a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -82,7 +82,6 @@ #define FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN #define FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD -#define FIX_1802 #define FIX_USAN_BASOP_UTIL_DIVIDE3232 /* Eri: Fix USAN error in BASOP_Util_Divide3232_Scale_newton by adding explicit type cast for -1 in hex */ diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 850aed602..80eacd386 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3458,11 +3458,7 @@ void IMDCT_ivas_fx( // sub( q_xn_buf_fx_32, q_win ) == 16 - L_norm_arr( xn_buf_fx_32, L_frame ) // q_xn_buf_fx_32 - q_win == 16 - L_norm_arr( xn_buf_fx_32, L_frame ) // q_win == - 16 + L_norm_arr( xn_buf_fx_32, L_frame ) + q_xn_buf_fx_32 -#ifdef FIX_1802 q_win = s_min( q_win, add( sub( q_xn_buf_fx_32, 16 ), sub( L_norm_arr( xn_buf_fx_32 + ( overlap / 2 ) + nz, L_frame ), 2 ) ) ); -#else - q_win = s_min( q_win, add( sub( q_xn_buf_fx_32, 16 ), L_norm_arr( xn_buf_fx_32, L_frame ) ) - 2 ); -#endif } IMDCT_ivas_fx_rescale( xn_buf_fx, &q_xn_buf_fx, syn_Overl_TDAC_fx, Q_syn_Overl_TDAC_fx, old_syn_overl_fx, Q_old_syn_overl_fx, hTcxDec->old_syn_Overl, &hTcxDec->Q_old_syn_Overl, old_out_fx, q_old_out_fx, q_win, FB_flag ); #endif -- GitLab From f7819b01599a2f632f43c3b2bbf9e53bdc6a13c9 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 20:00:38 +0200 Subject: [PATCH 21/35] [cleanup] accept FIX_USAN_BASOP_UTIL_DIVIDE3232 --- lib_com/basop_util.c | 4 ---- lib_com/options.h | 1 - 2 files changed, 5 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 4c7ebea26..ee959cf6f 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1408,11 +1408,7 @@ Word32 BASOP_Util_Divide3232_Scale_newton( Word32 x, Word32 y, Word16 *s ) *s = 0; return ( (Word32) 0 ); } -#ifdef FIX_USAN_BASOP_UTIL_DIVIDE3232 IF( EQ_32( y, (Word32) 0x80000000 ) ) -#else - IF( EQ_32( y, 0x80000000 ) ) -#endif { /* Division by -1.0: same as negation of numerator */ /* Return normalized negated numerator */ diff --git a/lib_com/options.h b/lib_com/options.h index 03ba8052a..5bf8a15f1 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -83,7 +83,6 @@ #define FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD -#define FIX_USAN_BASOP_UTIL_DIVIDE3232 /* Eri: Fix USAN error in BASOP_Util_Divide3232_Scale_newton by adding explicit type cast for -1 in hex */ #define FIX_1740_MISING_POP_WMOPS /* VA: fix issue 1740: missing pop_wmops() */ -- GitLab From deb69febb8fa209f7ad0529722d3afcb4984eb75 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 20:01:17 +0200 Subject: [PATCH 22/35] [cleanup] accept FIX_1740_MISING_POP_WMOPS --- lib_com/options.h | 1 - lib_rend/lib_rend_fx.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5bf8a15f1..9aa0aab8b 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -84,7 +84,6 @@ -#define FIX_1740_MISING_POP_WMOPS /* VA: fix issue 1740: missing pop_wmops() */ #define FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC /* FhG: NON-BE!!! Simplify azimuth & elevation calculations, remove parameter mismatch for divide3232, fix copy/paste error for elevation */ #define FIX_ISSUE_1744_IVAS_DIRAC_GET_MONO_FLAG /* FhG: NON-BE!!! Simplify threshold - comparison, change (wrong) Equal-comparion to (correct) Greater-Than-comparison */ diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index 1ef5cd9f6..ad1d5c8ae 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -6474,9 +6474,7 @@ static ivas_error renderLfeToBinaural_fx( ELSE { /* no LFE to render */ -#ifdef FIX_1740_MISING_POP_WMOPS pop_wmops(); -#endif return IVAS_ERR_OK; } -- GitLab From 405a9899f6ceceb0a7b2a719d7f37a40f0b31547 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 20:02:17 +0200 Subject: [PATCH 23/35] [cleanup] accept FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC --- lib_com/options.h | 1 - lib_dec/ivas_spar_md_dec_fx.c | 33 --------------------------------- 2 files changed, 34 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9aa0aab8b..acad14692 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -85,7 +85,6 @@ -#define FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC /* FhG: NON-BE!!! Simplify azimuth & elevation calculations, remove parameter mismatch for divide3232, fix copy/paste error for elevation */ #define FIX_ISSUE_1744_IVAS_DIRAC_GET_MONO_FLAG /* FhG: NON-BE!!! Simplify threshold - comparison, change (wrong) Equal-comparion to (correct) Greater-Than-comparison */ #define NONBE_FIX_864_JBM_RENDER_FRAMESIZE /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */ diff --git a/lib_dec/ivas_spar_md_dec_fx.c b/lib_dec/ivas_spar_md_dec_fx.c index 523810feb..a75c47e85 100644 --- a/lib_dec/ivas_spar_md_dec_fx.c +++ b/lib_dec/ivas_spar_md_dec_fx.c @@ -44,9 +44,7 @@ /*------------------------------------------------------------------------------------------* * Local constants *------------------------------------------------------------------------------------------*/ -#ifdef FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC #define DEG180_BY_PI_Q24 ( (Word32) 0x394BB835 ) /* 180.0/PI in Q24) */ -#endif #define IVAS_DEFAULT_DTX_CNG_RAMP ( 8 ) @@ -2948,22 +2946,7 @@ void ivas_spar_to_dirac_fx( Word16 check_azi_fx = BASOP_util_atan2( dvy_fx[band], dvx_fx[band], 0 ); /*Q13*/ -#ifdef FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC Word32 azi_intermediate = Mpy_32_16_1( DEG180_BY_PI_Q24, check_azi_fx ); -#else - Word16 check_azi_fx_res; - Word32 check_azi_fx_32 = L_shl( check_azi_fx, 16 ); /*Q29*/ - - IF( check_azi_fx_32 < 0 ) - { - check_azi_fx_res = negate( divide3232( L_negate( check_azi_fx_32 ), 1686629760 /*3.145f in Q29*/ ) ); /*Q15*/ - } - ELSE - { - check_azi_fx_res = divide3232( check_azi_fx_32, 1686629760 /*3.145f in Q29*/ ); /*Q15*/ - } - Word32 azi_intermediate = Mpy_32_16_1( DEGREE_180_Q_22, check_azi_fx_res ); /*Q22*/ -#endif azi_intermediate = L_add( azi_intermediate, ONE_IN_Q21 ); /*Q22*/ @@ -2978,23 +2961,7 @@ void ivas_spar_to_dirac_fx( } Word16 check_ele_fx = BASOP_util_atan2( dvz_fx[band], radius_fx, sub( add( 9, q_dvnorm ), q_temp ) ); /*Q13*/ -#ifdef FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC Word32 ele_intermediate = Mpy_32_16_1( DEG180_BY_PI_Q24, check_ele_fx ); -#else - - Word16 check_ele_fx_res; - Word32 check_ele_fx_32 = L_shl( check_ele_fx, 16 ); /*Q29*/ - - IF( check_ele_fx_32 < 0 ) - { - check_ele_fx_res = negate( divide3232( L_negate( check_ele_fx_32 ), 1686629760 /*3.145f in Q29*/ ) ); /*Q15*/ - } - ELSE - { - check_ele_fx_res = divide3232( check_ele_fx_32, 1686629760 /*3.145f in Q29*/ ); /*Q15*/ - } - Word32 ele_intermediate = Mpy_32_16_1( DEGREE_180_Q_22, check_ele_fx_res ); /*Q22*/ -#endif ele_intermediate = L_add( ele_intermediate, ONE_IN_Q21 ); /*Q22*/ Word16 ele_res; -- GitLab From 58977a20fe5f29839f34b454c2b5ec250095be55 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 20:03:03 +0200 Subject: [PATCH 24/35] [cleanup] accept FIX_ISSUE_1744_IVAS_DIRAC_GET_MONO_FLAG --- lib_com/options.h | 1 - lib_enc/ivas_dirac_enc_fx.c | 13 ------------- 2 files changed, 14 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index acad14692..c85290541 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -85,7 +85,6 @@ -#define FIX_ISSUE_1744_IVAS_DIRAC_GET_MONO_FLAG /* FhG: NON-BE!!! Simplify threshold - comparison, change (wrong) Equal-comparion to (correct) Greater-Than-comparison */ #define NONBE_FIX_864_JBM_RENDER_FRAMESIZE /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */ #define FIX_1762_COMPILER_ISSUE /* FhG: fix compiler issues with W_mac_32_32() + ONE_IN_Q30 */ diff --git a/lib_enc/ivas_dirac_enc_fx.c b/lib_enc/ivas_dirac_enc_fx.c index ab48d0f3b..db4551d27 100644 --- a/lib_enc/ivas_dirac_enc_fx.c +++ b/lib_enc/ivas_dirac_enc_fx.c @@ -660,7 +660,6 @@ static Word16 ivas_dirac_get_mono_flag_fx( move32(); move16(); } -#ifdef FIX_ISSUE_1744_IVAS_DIRAC_GET_MONO_FLAG IF( BASOP_Util_Cmp_Mant32Exp( W_band_power, W_band_power_e, Mpy_32_32( other_ch_band_power, threshold ), other_ch_band_power_e + threshold_e ) == 1 ) { any_mono_band = 1; @@ -671,18 +670,6 @@ static Word16 ivas_dirac_get_mono_flag_fx( any_mc_band = 1; move16(); } -#else - IF( BASOP_Util_Cmp_Mant32Exp( divide3232( W_band_power, other_ch_band_power ), 31, threshold, threshold_e ) == 0 ) - { - any_mono_band = 1; - move16(); - } - ELSE - { - any_mc_band = 1; - move16(); - } -#endif } } } -- GitLab From e7898b878651c64840d6d1ad677a2bb31ecf0130 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 20:03:50 +0200 Subject: [PATCH 25/35] [cleanup] accept FIX_1762_COMPILER_ISSUE --- lib_com/options.h | 1 - lib_enc/analy_sp_fx.c | 4 ---- lib_enc/find_tilt_fx.c | 4 ---- 3 files changed, 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c85290541..6ed50ccec 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -87,7 +87,6 @@ #define NONBE_FIX_864_JBM_RENDER_FRAMESIZE /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */ -#define FIX_1762_COMPILER_ISSUE /* FhG: fix compiler issues with W_mac_32_32() + ONE_IN_Q30 */ #define ISSUE_1751_replace_shl_ro /*FhG: replace shl_ro by overflow-free alternatives*/ #define ISSUE_1770_replace_shr_ro /* FhG: replace by non-overflow-alternative - BE */ #define ISSUE_1772_replace_shr_o /* FhG: replace by non-overflow-alternative - BE */ diff --git a/lib_enc/analy_sp_fx.c b/lib_enc/analy_sp_fx.c index 48ed114c7..f9a6d0351 100644 --- a/lib_enc/analy_sp_fx.c +++ b/lib_enc/analy_sp_fx.c @@ -646,11 +646,7 @@ void ivas_analy_sp_fx( move32(); /* PS[i] = ( Bin_E[i] + 1e-5f + Bin_E[i + L_FFT / 2] + 1e-5f ) / 2.0f; */ -#ifndef FIX_1762_COMPILER_ISSUE - PS[i] = W_extract_h( W_add( W_mac_32_32( W_mult_32_32( Bin_E[i], ONE_IN_Q30 ), Bin_E[i + L_FFT / 2], ONE_IN_Q30 ), W_shr( W_shl( add_const, 32 ), sub( 31, *q_Bin_E ) ) ) ); // *q_Bin_E -#else PS[i] = W_extract_h( W_add( W_shl( W_add( W_deposit32_l( Bin_E[i] ), W_deposit32_l( Bin_E[i + L_FFT / 2] ) ), 31 ), W_shr( W_shl( add_const, 32 ), sub( 31, *q_Bin_E ) ) ) ); // *q_Bin_E -#endif move32(); /* Bin_E[i] = (float) ( 10.0f * log( PS[i] ) ); */ diff --git a/lib_enc/find_tilt_fx.c b/lib_enc/find_tilt_fx.c index a49955e6c..3d9d373ba 100644 --- a/lib_enc/find_tilt_fx.c +++ b/lib_enc/find_tilt_fx.c @@ -324,11 +324,7 @@ void find_tilt_ivas_fx( } lp_bckr = W_shl_sat_l( sum, -16 ); // q_bckr /*hp_bckr = 0.5f * (bckr[max_band-1] + bckr[max_band]);*/ /* estimated noise E in last 2 critical bands */ -#ifndef FIX_1762_COMPILER_ISSUE - hp_bckr = W_extract_h( W_mac_32_32( W_mult_32_32( bckr[max_band - 1], ONE_IN_Q30 ), bckr[max_band], ONE_IN_Q30 ) ); // q_bckr -#else hp_bckr = W_extract_h( W_shl( W_add( W_deposit32_l( bckr[max_band - 1] ), W_deposit32_l( bckr[max_band] ) ), 31 ) ); // q_bckr -#endif if ( hp_bckr == 0 ) /* Avoid division by zero. */ { hp_bckr = L_deposit_l( 1 ); -- GitLab From f9d17812d135b5439f8b0c900872ec036a87cd17 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 20:05:35 +0200 Subject: [PATCH 26/35] [cleanup] accept ISSUE_1751_replace_shl_ro, ISSUE_1770_replace_shr_ro, ISSUE_1772_replace_shr_o --- lib_com/deemph_fx.c | 4 ---- lib_com/low_rate_band_att_fx.c | 8 -------- lib_com/options.h | 3 --- lib_com/syn_filt_fx.c | 12 ------------ lib_com/tools_fx.c | 8 -------- lib_dec/FEC_HQ_core_fx.c | 8 -------- lib_dec/FEC_HQ_phase_ecu_fx.c | 10 ---------- lib_dec/dec_gen_voic_fx.c | 9 --------- lib_dec/jbm_pcmdsp_similarityestimation_fx.c | 5 ----- lib_enc/ari_hm_enc_fx.c | 4 ---- lib_enc/cod_tcx_fx.c | 8 -------- lib_enc/enc_gen_voic_rf_fx.c | 4 ---- lib_enc/find_uv_fx.c | 10 ---------- lib_enc/gaus_enc_fx.c | 8 -------- lib_enc/multi_harm_fx.c | 8 -------- lib_enc/set_impulse_fx.c | 4 ---- lib_enc/stat_noise_uv_enc_fx.c | 8 -------- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 10 ---------- 18 files changed, 131 deletions(-) diff --git a/lib_com/deemph_fx.c b/lib_com/deemph_fx.c index 523061b98..9be25cddb 100644 --- a/lib_com/deemph_fx.c +++ b/lib_com/deemph_fx.c @@ -197,11 +197,7 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W { FOR( i = 0; i < L; i++ ) { -#ifdef ISSUE_1772_replace_shr_o L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/, &Overflow ); /*Qx-shift+16*/ -#else - L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), shr_o( x[i], shift, &Overflow ), -32768 /*1.0f in Q15*/, &Overflow ); /*Qx-shift+16*/ -#endif x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ move16(); } diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 186074445..e9fc12515 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -97,11 +97,7 @@ void ivas_fine_gain_pred_fx( /*gp *= 1.0f - 0.05f / accuracy; */ tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ -#ifdef ISSUE_1772_replace_shr_o tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ -#else - tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */ -#endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ @@ -209,11 +205,7 @@ void fine_gain_pred_fx( /*gp *= 1.0f - 0.05f / accuracy; */ tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ -#ifdef ISSUE_1772_replace_shr_o tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ -#else - tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */ -#endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ diff --git a/lib_com/options.h b/lib_com/options.h index 6ed50ccec..f806a823f 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -87,9 +87,6 @@ #define NONBE_FIX_864_JBM_RENDER_FRAMESIZE /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */ -#define ISSUE_1751_replace_shl_ro /*FhG: replace shl_ro by overflow-free alternatives*/ -#define ISSUE_1770_replace_shr_ro /* FhG: replace by non-overflow-alternative - BE */ -#define ISSUE_1772_replace_shr_o /* FhG: replace by non-overflow-alternative - BE */ #define FIX_1735_W_SHL_SAT_L /* FhG: Usage of W_shl_sat_l() */ #define FIX_ISSUE_1792 /* FhG: fix noise bursts in binaural rendering */ diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c index 1216c4533..7724e596c 100644 --- a/lib_com/syn_filt_fx.c +++ b/lib_com/syn_filt_fx.c @@ -188,20 +188,12 @@ void syn_filt_fx( Word16 *yy; Word32 s; Word16 q; -#ifndef ISSUE_1772_replace_shr_o - Flag Overflow = 0; - move16(); -#endif Word16 a0; yy = &buf[0]; q = add( norm_s( a[0] ), 1 ); -#ifdef ISSUE_1772_replace_shr_o a0 = shr_sat( a[0], shift ); /* input / 2^shift */ -#else - a0 = shr_o( a[0], shift, &Overflow ); /* input / 2^shift */ -#endif /*------------------------------------------------------------------* * copy initial filter states into synthesis buffer and do synthesis @@ -379,11 +371,7 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W *-----------------------------------------------------------------------*/ mem += m; /*move16();*/ -#ifdef ISSUE_1772_replace_shr_o a0 = shr_sat( a[0], shift ); /* input / 2^shift */ -#else - a0 = shr_o( a[0], shift, &Overflow ); /* input / 2^shift */ -#endif /*-----------------------------------------------------------------------* * Do the filtering *-----------------------------------------------------------------------*/ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 5b9cc52d7..2f5c3c8d3 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -3124,11 +3124,7 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { -#ifdef ISSUE_1770_replace_shr_ro y[i] = add_o( x1[i], shr_r_sat( x2[i], Qyx2 ), &Overflow ); -#else - y[i] = add_o( x1[i], shr_ro( x2[i], Qyx2, &Overflow ), &Overflow ); -#endif move16(); } } @@ -3136,11 +3132,7 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { -#ifdef ISSUE_1770_replace_shr_ro y[i] = add_o( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ), &Overflow ); -#else - y[i] = add_o( shr_ro( x1[i], Qyx1, &Overflow ), shr_ro( x2[i], Qyx2, &Overflow ), &Overflow ); -#endif move16(); } } diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c index 40e26df9c..a69584a32 100644 --- a/lib_dec/FEC_HQ_core_fx.c +++ b/lib_dec/FEC_HQ_core_fx.c @@ -638,11 +638,7 @@ void ivas_HQ_FEC_Mem_update_fx( exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] ); tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) ); exp = add( 15, sub( exp1, exp2 ) ); -#ifdef ISSUE_1772_replace_shr_o *mean_en_high_fx = add_o( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ), &Overflow ); -#else - *mean_en_high_fx = add_o( *mean_en_high_fx, shr_o( tmp_fx, sub( exp, 5 ), &Overflow ), &Overflow ); -#endif move16(); } *mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] ); @@ -928,11 +924,7 @@ void HQ_FEC_Mem_update_fx( exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] ); tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) ); exp = add( 15, sub( exp1, exp2 ) ); -#ifdef ISSUE_1772_replace_shr_o *mean_en_high_fx = add_o( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ), &Overflow ); -#else - *mean_en_high_fx = add_o( *mean_en_high_fx, shr_o( tmp_fx, sub( exp, 5 ), &Overflow ), &Overflow ); -#endif move16(); } *mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] ); diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index 4be003ecb..9f1c12faa 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -1164,12 +1164,6 @@ static Word16 imax_fx( /* o: The location, relative to the Word16 y1, y2, y3, man, expo, edge; const Word16 *pY; Word32 numer, denom, sign, acc, y3_y1; -#ifndef ISSUE_1772_replace_shr_o -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* Seek the extremum of the parabola P(x) defined by 3 consecutive points so that P([-1 0 1]) = [y1 y2 y3] */ pY = y; @@ -1203,11 +1197,7 @@ static Word16 imax_fx( /* o: The location, relative to the /* Although the output of ratio() is in Q14, adding the missing factor of 2 (See above) * in the denominator, the output is now considered to be in Q15. */ man = ratio( numer, denom, &expo ); /* The mantissa is considered in Q15 */ -#ifdef ISSUE_1772_replace_shr_o posi = shr_sat( man, expo ); /* in Q15 (Due to saturation, it is automatically bound inside [-1.0,1.0].) */ -#else - posi = shr_o( man, expo, &Overflow ); /* in Q15 (Due to saturation, it is automatically bound inside [-1.0,1.0].) */ -#endif if ( sign < 0 ) /* Restore the sign. */ { posi = negate( posi ); diff --git a/lib_dec/dec_gen_voic_fx.c b/lib_dec/dec_gen_voic_fx.c index a58cd19c9..ac1df74b2 100644 --- a/lib_dec/dec_gen_voic_fx.c +++ b/lib_dec/dec_gen_voic_fx.c @@ -463,20 +463,11 @@ ivas_error decod_gen_voic_fx( test(); test(); test(); -#ifdef ISSUE_1751_replace_shl_ro IF( GT_16( shr_r_sat( enratio, sub( Qenratio, 15 ) ), 8192 ) && /*compare with 0.25 in Q15*/ LT_16( shr_r_sat( enratio, sub( Qenratio, 10 ) ), 15360 ) && /*compare with 15.0 in Q10*/ GT_16( shr_r_sat( sp_enratio, sub( Qsp_enratio, 15 ) ), 4915 ) && /*compare with 0.15 in Q15*/ LT_16( st_fx->bfi_pitch_fx, 9600 ) && /*Q6*/ LT_16( pitch_buf_fx[( NB_SUBFR16k - 1 )], 9600 ) ) /*Q6*/ -#else - Flag Overflow; - IF( GT_16( shl_ro( enratio, sub( 15, Qenratio ), &Overflow ), 8192 ) && /*compare with 0.25 in Q15*/ - LT_16( shl_ro( enratio, sub( 10, Qenratio ), &Overflow ), 15360 ) && /*compare with 15.0 in Q10*/ - GT_16( shl_ro( sp_enratio, sub( 15, Qsp_enratio ), &Overflow ), 4915 ) && /*compare with 0.15 in Q15*/ - LT_16( st_fx->bfi_pitch_fx, 9600 ) && /*Q6*/ - LT_16( pitch_buf_fx[( NB_SUBFR16k - 1 )], 9600 ) ) /*Q6*/ -#endif { IF( NE_32( ( error = DTFS_new_fx( &PREVP ) ), IVAS_ERR_OK ) ) { diff --git a/lib_dec/jbm_pcmdsp_similarityestimation_fx.c b/lib_dec/jbm_pcmdsp_similarityestimation_fx.c index 7015022eb..1166cb1f7 100644 --- a/lib_dec/jbm_pcmdsp_similarityestimation_fx.c +++ b/lib_dec/jbm_pcmdsp_similarityestimation_fx.c @@ -141,12 +141,7 @@ Word16 normalized_cross_correlation_self_fx( const Word16 *signal, normCC = add( normCC, 16 ); /* scale to Q15 with saturation */ BASOP_SATURATE_WARNING_OFF -#ifdef ISSUE_1751_replace_shl_ro cc = shr_r_sat( cc, negate( add( normXY, normCC ) ) ); -#else - Flag Overflow; - cc = shl_ro( cc, add( normXY, normCC ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON *energy = L_shr_r( L_deposit_l( sqrtXY ), normXY ); } diff --git a/lib_enc/ari_hm_enc_fx.c b/lib_enc/ari_hm_enc_fx.c index 1172bd890..d62dcf141 100644 --- a/lib_enc/ari_hm_enc_fx.c +++ b/lib_enc/ari_hm_enc_fx.c @@ -458,11 +458,7 @@ Word16 SearchPeriodicityIndex_fx( tmp = sub( norm_l( tmp32 ), 1 ); tmp2 = norm_l( AbsTotal ); tmp3 = div_s( round_fx_o( L_shl_o( tmp32, tmp, &Overflow ), &Overflow ), round_fx_o( L_shl_o( AbsTotal, tmp2, &Overflow ), &Overflow ) ); -#ifdef ISSUE_1772_replace_shr_o *RelativeScore = shr_sat( tmp3, add( sub( tmp, tmp2 ), 2 ) ); /* -> 2Q13 */ -#else - *RelativeScore = shr_o( tmp3, add( sub( tmp, tmp2 ), 2 ), &Overflow ); /* -> 2Q13 */ -#endif move16(); } ELSE diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index ff1e8a233..640a5ba3c 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -2604,11 +2604,7 @@ void QuantizeSpectrum_fx( /* scale output */ FOR( i = 0; i < L_frame; i++ ) { -#ifdef ISSUE_1772_replace_shr_o xn_buf16[i] = shr_sat( xn_buf16[i], Q ); -#else - xn_buf16[i] = shr_o( xn_buf16[i], Q, &Overflow ); -#endif move16(); } @@ -4530,11 +4526,7 @@ void InternalTCXDecoder_fx( /* scale output */ FOR( i = 0; i < L_frame; i++ ) { -#ifdef ISSUE_1772_replace_shr_o xn_buf16[i] = shr_sat( xn_buf16[i], Q ); -#else - xn_buf16[i] = shr_o( xn_buf16[i], Q, &Overflow ); -#endif move16(); } diff --git a/lib_enc/enc_gen_voic_rf_fx.c b/lib_enc/enc_gen_voic_rf_fx.c index 8d9e1e1a1..0e79baa5f 100644 --- a/lib_enc/enc_gen_voic_rf_fx.c +++ b/lib_enc/enc_gen_voic_rf_fx.c @@ -449,11 +449,7 @@ void coder_acelp_rf_fx( Ltmp = L_add_o( Ltmp, Ltmp2, &Overflow ); /* Q15 + Q_xn */ hRF->rf_mem_w0 = sub_o( xn[L_SUBFR - 1], round_fx_o( L_shl_o( Ltmp, 1, &Overflow ), &Overflow ), &Overflow ); /* Q_xn */ move16(); -#ifdef ISSUE_1772_replace_shr_o hRF->rf_mem_w0 = shr_sat( hRF->rf_mem_w0, shift ); /*Qnew-1*/ -#else - hRF->rf_mem_w0 = shr_o( hRF->rf_mem_w0, shift, &Overflow ); /*Qnew-1*/ -#endif /*-------------------------------------------------------* diff --git a/lib_enc/find_uv_fx.c b/lib_enc/find_uv_fx.c index 9dcd8386b..6114fb69b 100644 --- a/lib_enc/find_uv_fx.c +++ b/lib_enc/find_uv_fx.c @@ -32,12 +32,6 @@ static Word16 find_ener_decrease_fx( /* o : maximum Word16 wtmp0, wtmp1; Word32 maxEnr, minEnr; Word16 dE2, exp0, exp1; -#ifndef ISSUE_1770_replace_shr_ro -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif dE2 = 0; move16(); @@ -78,11 +72,7 @@ static Word16 find_ener_decrease_fx( /* o : maximum exp1 = sub( norm_l( maxEnr ), 1 ); wtmp1 = extract_h( L_shl( maxEnr, exp1 ) ); wtmp1 = div_s( wtmp1, wtmp0 ); -#ifdef ISSUE_1770_replace_shr_ro dE2 = shr_r_sat( wtmp1, add( sub( exp1, exp0 ), 15 - 10 ) ); /*Q10*/ -#else - dE2 = shr_ro( wtmp1, add( sub( exp1, exp0 ), 15 - 10 ), &Overflow ); /*Q10*/ -#endif return dE2; } diff --git a/lib_enc/gaus_enc_fx.c b/lib_enc/gaus_enc_fx.c index 1efe1f656..2f9a01268 100644 --- a/lib_enc/gaus_enc_fx.c +++ b/lib_enc/gaus_enc_fx.c @@ -362,11 +362,7 @@ void gauss2v_fx( exp_den = norm_l( Lden ); Den = extract_h( L_shl( Lden, exp_den ) ); -#ifdef ISSUE_1772_replace_shr_o delta = shr_sat( div_s( Num, Den ), sub( exp_num, exp_den ) ); /* Q15 */ -#else - delta = shr_o( div_s( Num, Den ), sub( exp_num, exp_den ), &Overflow ); /* Q15 */ -#endif delta = i_mult2( delta, m_sign ); /* Apply sign Q0*/ /* index_delta = (short)(FAC_DELTA * fdelta) */ index_delta = shr( delta, SFAC_DELTA ); @@ -827,11 +823,7 @@ void gauss2v_ivas_fx( exp_den = norm_l( Lden ); Den = extract_h( L_shl( Lden, exp_den ) ); -#ifdef ISSUE_1772_replace_shr_o delta = shr_sat( div_s( Num, Den ), sub( exp_num, exp_den ) ); /* Q15 */ -#else - delta = shr_o( div_s( Num, Den ), sub( exp_num, exp_den ), &Overflow ); /* Q15 */ -#endif delta = i_mult2( delta, m_sign ); /* Apply sign */ /* index_delta = (short)(FAC_DELTA * fdelta) */ index_delta = shr( delta, SFAC_DELTA ); diff --git a/lib_enc/multi_harm_fx.c b/lib_enc/multi_harm_fx.c index c49c405b5..665ee5edf 100644 --- a/lib_enc/multi_harm_fx.c +++ b/lib_enc/multi_harm_fx.c @@ -238,11 +238,7 @@ Word16 multi_harm_fx( /* o : frame multi-harmonicity corxy = shl( corxy, cor ); /* cor = corxy * corxy / (corx2 * cory2) */ corxy = div_s( corxy, corx2 ); -#ifdef ISSUE_1772_replace_shr_o cor = shr_sat( corxy, sub( shl( tmp16, 1 ), Expx2 ) ); /* Q15 */ -#else - cor = shr_o( corxy, sub( shl( tmp16, 1 ), Expx2 ), &Overflow ); /* Q15 */ -#endif } ELSE { @@ -579,11 +575,7 @@ Word16 multi_harm_ivas_fx( /* o : frame multi-harmoni corxy = shl( corxy, cor ); /* cor = corxy * corxy / (corx2 * cory2) */ corxy = div_s( corxy, corx2 ); -#ifdef ISSUE_1772_replace_shr_o cor = shr_sat( corxy, sub( shl( tmp16, 1 ), Expx2 ) ); /* Q15 */ -#else - cor = shr_o( corxy, sub( shl( tmp16, 1 ), Expx2 ), &Overflow ); /* Q15 */ -#endif } ELSE { diff --git a/lib_enc/set_impulse_fx.c b/lib_enc/set_impulse_fx.c index 364d78f97..e48ed476d 100644 --- a/lib_enc/set_impulse_fx.c +++ b/lib_enc/set_impulse_fx.c @@ -201,11 +201,7 @@ void set_impulse_fx( den = extract_h( L_shl( rr_fx[i], exp_den ) ); num = div_s( num, den ); -#ifdef ISSUE_1772_replace_shr_o krit_fx = shr_sat( num, sub( sub( shl_o( exp_num, 1, &Overflow ), exp_den ), 2 ) ); /* Q18 */ -#else - krit_fx = shr_o( num, sub( sub( shl_o( exp_num, 1, &Overflow ), exp_den ), 2 ), &Overflow ); /* Q18 */ -#endif IF( GT_16( krit_fx, krit_max_fx ) ) { diff --git a/lib_enc/stat_noise_uv_enc_fx.c b/lib_enc/stat_noise_uv_enc_fx.c index 8dfb40738..a3e5f4bf7 100644 --- a/lib_enc/stat_noise_uv_enc_fx.c +++ b/lib_enc/stat_noise_uv_enc_fx.c @@ -69,11 +69,7 @@ void stat_noise_uv_enc_fx( expd = norm_l( LepsP[1] ); den = extract_h( L_shl_o( LepsP[1], expd, &Overflow ) ); /*expd-16*/ num = div_s( num, den ); /*expn-expd+15*/ -#ifdef ISSUE_1772_replace_shr_o num = shr_sat( num, add( sub( expn, expd ), 5 ) ); /*Q10*/ -#else - num = shr_o( num, add( sub( expn, expd ), 5 ), &Overflow ); /*Q10*/ -#endif num = sub( num, 1024 ); /*num - 1*/ test(); @@ -146,11 +142,7 @@ void stat_noise_uv_enc_ivas_fx( expd = norm_l( LepsP[1] ); den = extract_h( L_shl_o( LepsP[1], expd, &Overflow ) ); /*expd-16*/ num = div_s( num, den ); /*expn-expd+15*/ -#ifdef ISSUE_1772_replace_shr_o num = shr_sat( num, add( sub( expn, expd ), 5 ) ); /*Q10*/ -#else - num = shr_o( num, add( sub( expn, expd ), 5 ), &Overflow ); /*Q10*/ -#endif num = sub( num, 1024 ); /*num - 1*/ test(); diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 1a5d0a18e..eb8eae8b8 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -3518,12 +3518,7 @@ void ivas_lfe_synth_with_filters_fx( lfeGain_fx = extract_h( BASOP_Util_Divide3232_Scale_newton( hMasaLfeSynth->targetEneLfeSmooth_fx, L_add( EPSILON_FX, hMasaLfeSynth->transportEneSmooth_fx ), &lfeGain_fx_exp ) ); /*Q(31-(lfeGain_fx_exp+hMasaLfeSynth->transportEneSmooth_q-hMasaLfeSynth->targetEneLfeSmooth_q))-16*/ lfeGain_fx_exp = add( sub( hMasaLfeSynth->transportEneSmooth_q, hMasaLfeSynth->targetEneLfeSmooth_q ), lfeGain_fx_exp ); lfeGain_fx = Sqrt16( lfeGain_fx, &lfeGain_fx_exp ); // Q15-lfeGain_fx_exp -#ifdef ISSUE_1751_replace_shl_ro lfeGain_fx = shr_r_sat( lfeGain_fx, negate( lfeGain_fx_exp ) ); // Q15 -#else - Flag Overflow; - lfeGain_fx = shl_ro( lfeGain_fx, lfeGain_fx_exp, &Overflow ); // Q15 -#endif } IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( hMasaLfeSynth->targetEneTransSmooth_fx, sub( Q31, hMasaLfeSynth->targetEneTransSmooth_q ), /*EPSILON + */ hMasaLfeSynth->transportEneSmooth_fx, sub( Q31, hMasaLfeSynth->transportEneSmooth_q ) ), 1 ) ) { @@ -3535,12 +3530,7 @@ void ivas_lfe_synth_with_filters_fx( transportGain_fx = BASOP_Util_Divide3232_Scale( hMasaLfeSynth->targetEneTransSmooth_fx, /*EPSILON + */ hMasaLfeSynth->transportEneSmooth_fx, &transportGain_fx_exp ); /*Q=15-(transportGain_fx_exp+hMasaLfeSynth->transportEneSmooth_q-hMasaLfeSynth->targetEneTransSmooth_q)*/ transportGain_fx_exp = add( sub( hMasaLfeSynth->transportEneSmooth_q, hMasaLfeSynth->targetEneTransSmooth_q ), transportGain_fx_exp ); transportGain_fx = Sqrt16( transportGain_fx, &transportGain_fx_exp ); // q15-transportGain_fx_exp -#ifdef ISSUE_1751_replace_shl_ro transportGain_fx = shr_r_sat( transportGain_fx, negate( transportGain_fx_exp ) ); // Q15 -#else - Flag Overflow; - transportGain_fx = shl_ro( transportGain_fx, transportGain_fx_exp, &Overflow ); // Q15 -#endif } j = 0; move16(); -- GitLab From d7355862ab5fb65644dcfa59b23c85c4d20c8a30 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 20:06:34 +0200 Subject: [PATCH 27/35] cleanup accept FIX_1735_W_SHL_SAT_L --- lib_com/options.h | 1 - lib_dec/ivas_dirac_dec_fx.c | 4 ---- lib_enc/analy_sp_fx.c | 4 ---- lib_enc/ivas_enc_cov_handler_fx.c | 4 ---- 4 files changed, 13 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index f806a823f..faa61ac63 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -88,7 +88,6 @@ #define NONBE_FIX_864_JBM_RENDER_FRAMESIZE /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */ -#define FIX_1735_W_SHL_SAT_L /* FhG: Usage of W_shl_sat_l() */ #define FIX_ISSUE_1792 /* FhG: fix noise bursts in binaural rendering */ /* Info for issue 1816: diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index e77563e6d..aa174fe62 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -2007,11 +2007,7 @@ void ivas_dirac_dec_set_md_map( tmp_fx = W_add_nosat( tmp_fx, W_deposit32_l( L_deposit_l( hSpatParamRendCom->render_to_md_map[slot_idx_abs] ) ) ); slot_idx_abs = add( slot_idx_abs, 1 ); } -#ifdef FIX_1735_W_SHL_SAT_L iDiv_and_mod_32( W_shl_sat_l( tmp_fx, 16 ), hSpatParamRendCom->subframe_nbslots[sf_idx], &quo, &rem, 0 ); -#else - iDiv_and_mod_32( W_extract_l( W_shl_nosat( tmp_fx, 16 ) ), hSpatParamRendCom->subframe_nbslots[sf_idx], &quo, &rem, 0 ); -#endif hSpatParamRendCom->render_to_md_map[sf_idx] = add( round_fx( quo ), hSpatParamRendCom->dirac_read_idx ) % hSpatParamRendCom->dirac_md_buffer_length; move16(); } diff --git a/lib_enc/analy_sp_fx.c b/lib_enc/analy_sp_fx.c index f9a6d0351..8618c8fd7 100644 --- a/lib_enc/analy_sp_fx.c +++ b/lib_enc/analy_sp_fx.c @@ -321,11 +321,7 @@ static void find_enr_dft_ivas_fx( } /* normalization per frequency bin */ -#ifdef FIX_1735_W_SHL_SAT_L band_fx[i] = W_shl_sat_l( band_ener, sub( Q16 - 32, shift ) ); // *q_band -#else - band_fx[i] = W_extract_h( W_shl( band_ener, sub( Q16, shift ) ) ); // *q_band -#endif move32(); /* per band energy without E_MIN */ diff --git a/lib_enc/ivas_enc_cov_handler_fx.c b/lib_enc/ivas_enc_cov_handler_fx.c index c03632d10..ae7d26e2e 100644 --- a/lib_enc/ivas_enc_cov_handler_fx.c +++ b/lib_enc/ivas_enc_cov_handler_fx.c @@ -224,11 +224,7 @@ static Word16 ivas_spar_get_activeW_flag_fx( q_shift = Q31; move16(); q_shift = W_norm( bb_var_64bit[ch] ); -#ifdef FIX_1735_W_SHL_SAT_L bb_var[ch] = W_shl_sat_l( bb_var_64bit[ch], sub( q_shift, 32 ) ); /* q_bb_var[ch] + sub( q_shift, 32 ) */ -#else - bb_var[ch] = W_extract_l( W_shl_nosat( bb_var_64bit[ch], sub( q_shift, 32 ) ) ); /* q_bb_var[ch] + sub( q_shift, 32 ) */ -#endif move32(); q_bb_var[ch] = add( q_bb_var[ch], sub( q_shift, 32 ) ); move16(); -- GitLab From f29d90c92744bc812e045ea56bba3bee5e0932b7 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 20:07:29 +0200 Subject: [PATCH 28/35] [cleanup] accept FIX_ISSUE_1792 --- lib_com/options.h | 1 - lib_dec/ivas_jbm_dec_fx.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index faa61ac63..b7d6179c6 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -88,7 +88,6 @@ #define NONBE_FIX_864_JBM_RENDER_FRAMESIZE /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */ -#define FIX_ISSUE_1792 /* FhG: fix noise bursts in binaural rendering */ /* Info for issue 1816: * Some compilers do not automatically use 32 bit for 16x16bit products. The code "Word32 c = (Word16) a * (Word16) b;" creates then a 16-bit result, sign-extending the diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 48aeda1a4..6c6f93fd7 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -622,11 +622,7 @@ ivas_error ivas_jbm_dec_tc_fx( move16(); FOR( ch = 0; ch < nchan_transport; ch++ ) { -#ifdef FIX_ISSUE_1792 temp_min = L_norm_arr( p_output_fx[ch], output_frame ); -#else - temp_min = getScaleFactor32( p_output_fx[ch], output_frame ); -#endif Q_p_output = s_min( Q_p_output, temp_min ); } Q_p_output = sub( Q_p_output, 2 ); -- GitLab From 2552cc3c31527fe1041caf095356f9580d2dcd06 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 20:08:33 +0200 Subject: [PATCH 29/35] [cleanup] accept FIX_ISSUE_1816_USE_W32_FOR_MPY_W16xW16 --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index b7d6179c6..43d82631a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -94,7 +94,6 @@ * lower 16-bit of the product, any upper bits are omitted. Example: Product 0x0100 * 0x0100 results in 0x0001.0000, gets truncated to its lower bits and return 0x0000. * The issue is fixed by simply casting one of the product operands to Word32 in lib_com/basop32.c */ -#define FIX_ISSUE_1816_USE_W32_FOR_MPY_W16xW16 /* FhG: (QA-FIX) Use doubled data width for 16x16 product, some compilers keep 16-bit format also for products */ #define FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION /* FhG: (NON-BE) improve precision of multiplications with factor 0.1f, avoids overflow with up-rounded value */ #define FIX_ISSUE_1795_Q3_OVERFLOW /* FhG: Q3 overflow in function WB_BWE_gain_pred_fx (EVS legacy code) BE, MR1855 */ -- GitLab From 5e6afd9166c14bac872df90ce64933e3ac200364 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 20:09:34 +0200 Subject: [PATCH 30/35] [cleanup] accept FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION --- lib_com/options.h | 1 - lib_dec/swb_tbe_dec_fx.c | 26 -------------------------- lib_enc/swb_tbe_enc_fx.c | 26 -------------------------- 3 files changed, 53 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 43d82631a..4ca58aba1 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -94,7 +94,6 @@ * lower 16-bit of the product, any upper bits are omitted. Example: Product 0x0100 * 0x0100 results in 0x0001.0000, gets truncated to its lower bits and return 0x0000. * The issue is fixed by simply casting one of the product operands to Word32 in lib_com/basop32.c */ -#define FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION /* FhG: (NON-BE) improve precision of multiplications with factor 0.1f, avoids overflow with up-rounded value */ #define FIX_ISSUE_1795_Q3_OVERFLOW /* FhG: Q3 overflow in function WB_BWE_gain_pred_fx (EVS legacy code) BE, MR1855 */ #define NONBE_FIX_1748_SPAR_DIV_OPT /*Dlb: issue 1748: SPAR common div optimizations*/ diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 3ed08633c..174f67f64 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -2723,7 +2723,6 @@ void swb_tbe_dec_fx( exp = 0; move16(); } -#ifdef FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION /* code for EVS and IVAS are basically identical with the exception of i_mult_sat() which has precision issues thus is was replaced for IVAS and kept for EVS, in order to keep EVS BE to test sequences and legacy implementations @@ -2754,18 +2753,6 @@ void swb_tbe_dec_fx( move16(); } } -#else - FOR( ; i < L_SHB_LAHEAD + 10; i++ ) - { - temp = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ ); /* Q15 */ - L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp ); /* Q31-exp */ - temp = sub( 32767 /*1.0f Q15*/, temp ); - Lscale = L_add( Mult_32_16( Lscale, temp ), L_tmp1 ); - L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */ - shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */ - move16(); - } -#endif /* Update SHB excitation */ Copy( shaped_shb_excitation + L_FRAME16k, hBWE_TD->state_syn_shbexc_fx, L_SHB_LAHEAD ); /* Q_bwe_exc */ @@ -6318,7 +6305,6 @@ void ivas_swb_tbe_dec_fx( exp = 0; move16(); } -#ifdef FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION /* code for EVS and IVAS are basically identical with the exception of i_mult_sat() which has precision issues thus is was replaced for IVAS and kept for EVS, in order to keep EVS BE to test sequences and legacy implementations @@ -6349,18 +6335,6 @@ void ivas_swb_tbe_dec_fx( move16(); } } -#else - FOR( ; i < L_SHB_LAHEAD + 10; i++ ) - { - temp_fx = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ ); /* Q15 */ - L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp_fx ); /* Q31-exp */ - temp_fx = sub( 32767 /*1.0f Q15*/, temp_fx ); - Lscale = L_add( Mult_32_16( Lscale, temp_fx ), L_tmp1 ); - L_tmp = Mult_32_16( Lscale, shaped_shb_excitation_fx[i] ); /* Q_bwe_exc + (31-exp) - 15 */ - shaped_shb_excitation_fx[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ - move16(); - } -#endif } ELSE { diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index e1bbd3e19..ec11d2837 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -2535,7 +2535,6 @@ void swb_tbe_enc_fx( exp = 0; move16(); } -#ifdef FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION /* code for EVS and IVAS are basically identical with the exception of i_mult_sat() which has precision issues thus is was replaced for IVAS and kept for EVS, in order to keep EVS BE to test sequences and legacy implementations @@ -2566,18 +2565,6 @@ void swb_tbe_enc_fx( move16(); } } -#else - FOR( ; i < L_SHB_LAHEAD + 10; i++ ) - { - tmp = i_mult_o( sub( i, 19 ), 3277 /*0.1f Q15*/, &Overflow ); /* Q15 */ - L_tmp1 = Mult_32_16( L_shl_o( 1, sub( 31, exp ), &Overflow ), tmp ); /* Q31-exp */ - tmp = sub( 32767 /*1.0f Q15*/, tmp ); - Lscale = L_add( Mult_32_16( Lscale, tmp ), L_tmp1 ); - L_tmp = Mult_32_16( Lscale, shaped_shb_excitation_fx[i] ); /* Q_bwe_exc + (31-exp) - 15 */ - shaped_shb_excitation_fx[i] = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /* Q_bwe_exc */ - move16(); - } -#endif /* Update SHB excitation */ Copy( shaped_shb_excitation_fx + L_FRAME16k, hBWE_TD->state_syn_shbexc_fx, L_SHB_LAHEAD ); /* Q_bwe_exc */ @@ -3864,7 +3851,6 @@ void swb_tbe_enc_ivas_fx( exp = 0; move16(); } -#ifdef FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION /* code for EVS and IVAS are basically identical with the exception of i_mult_sat() which has precision issues thus is was replaced for IVAS and kept for EVS, in order to keep EVS BE to test sequences and legacy implementations @@ -3895,18 +3881,6 @@ void swb_tbe_enc_ivas_fx( move16(); } } -#else - FOR( ; i < L_SHB_LAHEAD + 10; i++ ) - { - tmp = i_mult_o( sub( i, 19 ), 3277 /*0.1f Q15*/, &Overflow ); /* Q15 */ - L_tmp1 = Mult_32_16( L_shl_o( 1, sub( 31, exp ), &Overflow ), tmp ); /* Q31-exp */ - tmp = sub( 32767 /*1.0f Q15*/, tmp ); - L_tmp = L_add( Mult_32_16( Lscale, tmp ), L_tmp1 ); - L_tmp = Mult_32_16( L_tmp, shaped_shb_excitation_fx[i] ); /* Q_bwe_exc + (31-exp) - 15 */ - shaped_shb_excitation_fx[i] = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /* Q_bwe_exc */ - move16(); - } -#endif } ELSE { -- GitLab From 802cd0579a2010721983df51176d4be4b7bd1a48 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 20:10:19 +0200 Subject: [PATCH 31/35] [cleanup] accept FIX_ISSUE_1795_Q3_OVERFLOW --- lib_com/options.h | 1 - lib_com/swb_bwe_com_fx.c | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 4ca58aba1..ba0955304 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -95,7 +95,6 @@ * The issue is fixed by simply casting one of the product operands to Word32 in lib_com/basop32.c */ -#define FIX_ISSUE_1795_Q3_OVERFLOW /* FhG: Q3 overflow in function WB_BWE_gain_pred_fx (EVS legacy code) BE, MR1855 */ #define NONBE_FIX_1748_SPAR_DIV_OPT /*Dlb: issue 1748: SPAR common div optimizations*/ #define FIX_ISSUE_1801_NOISE_FLOOR_REDUCTION /* FhG: Fixed getScalefactor usage */ diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index 8b134e5d6..0c6e30547 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -242,25 +242,15 @@ Word16 WB_BWE_gain_pred_fx( enerL = L_deposit_l( enerL_16 ); enerL = L_shl( enerL, 6 ); /*Q6 */ -#ifdef FIX_ISSUE_1795_Q3_OVERFLOW /* Here, we do not multiply L_tmp by 3 to avoid overflow */ L_tmp = L_mult0( WB_fenv[0], WB_fenv[0] ); /* Q6 */ -#else - /* Here, we have not enough headroom for mult with 3, so we get some overflow */ - tmp1 = i_mult_sat( 3, WB_fenv[0] ); /*Q3 */ - L_tmp = L_mult0( tmp1, WB_fenv[0] ); /*Q6 */ -#endif test(); test(); test(); -#ifdef FIX_ISSUE_1795_Q3_OVERFLOW #define ONE_DIV_3 ( (Word32) 0x2AAAAAAA ) /* Here, L_tmp is not pre-multiplied with 3, we multiply enerL with 1/3 */ IF( GT_16( shr( enerL_16, 3 ), tmp ) && GT_32( Mpy_32_32( ONE_DIV_3, enerL ), L_tmp ) && NE_16( prev_coder_type, UNVOICED ) && WB_fenv[0] != 0 ) -#else - IF( GT_16( shr( enerL_16, 3 ), tmp ) && GT_32( enerL, L_tmp ) && NE_16( prev_coder_type, UNVOICED ) && WB_fenv[0] != 0 ) -#endif { env_var_flag = 1; move16(); -- GitLab From e7041da1ab23c5142d0c60754c459b2f9b6e1d85 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 20:11:06 +0200 Subject: [PATCH 32/35] [cleanup] accept NONBE_FIX_1748_SPAR_DIV_OPT --- lib_com/ivas_spar_com_fx.c | 315 ------------------------------------- lib_com/options.h | 1 - 2 files changed, 316 deletions(-) diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index ffbe68925..e11c518c6 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -3846,12 +3846,8 @@ void ivas_compute_spar_params_fx( Word32 diff_norm_order1_table[4] = { 0, 805306368, 402653184, 268435456 }; // q28 Word32 diff_norm_order2_table[6] = { 0, 1342177280, 671088640, 447392416, 335544320, 268435456 }; // q28 Word32 diff_norm_order3_table[8] = { 0, 1879048192, 939524096, 626349376, 469762048, 375809632, 313174688, 268435456 }; // q28 -#ifdef NONBE_FIX_1748_SPAR_DIV_OPT #define EPSILON_FX_SHIFT 6 #define EPSILON_FX_THR ( 1 << EPSILON_FX_SHIFT ) -#else -#define EPSILON_FX_THR 70 -#endif #define ONE_BY_THREE_Q31 715827882 #define ONE_BY_FIVE_Q31 429496729 #define ONE_BY_SEVEN_Q31 306783378 @@ -4092,19 +4088,11 @@ void ivas_get_spar_md_from_dirac_enc_fx( Word32 norm_fx; Word16 norm_q; -#ifdef NONBE_FIX_1748_SPAR_DIV_OPT Word16 num_ch_order, norm_t; Word32 tmp_norm_out; -#else - Word16 num_ch_order, hoa2_ch_order; -#endif num_ch_order = ivas_sba_get_nchan_fx( order, 0 ); -#ifndef NONBE_FIX_1748_SPAR_DIV_OPT - hoa2_ch_order = ivas_sba_get_nchan_fx( SBA_HOA2_ORDER, 0 ); -#else assert( order == 1 ); -#endif FOR( ch = 0; ch < num_ch_order; ch++ ) { @@ -4119,36 +4107,18 @@ void ivas_get_spar_md_from_dirac_enc_fx( } /*normalize 1st order*/ -#ifdef NONBE_FIX_1748_SPAR_DIV_OPT norm_t = L_norm_arr( &response_avg_fx[1], sub( foa_ch, 1 ) ); norm_t = sub( norm_t, 1 ); scale_sig32( &response_avg_fx[1], sub( foa_ch, 1 ), norm_t ); -#endif norm_fx = 0; move32(); -#ifndef NONBE_FIX_1748_SPAR_DIV_OPT - norm_q = 0; - move16(); -#endif FOR( ch = 1; ch < foa_ch; ch++ ) { norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29 } norm_q = sub( 31, ( sub( add( 30, 30 ), 31 ) ) ); -#ifdef NONBE_FIX_1748_SPAR_DIV_OPT norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q -#else - IF( norm_fx ) - { - norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q - } - ELSE - { - norm_fx = EPSILON_FX; - move32(); - } -#endif IF( norm_q <= 0 ) { norm_fx = L_shr( norm_fx, ( negate( norm_q ) ) ); // q=31 @@ -4157,7 +4127,6 @@ void ivas_get_spar_md_from_dirac_enc_fx( } norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30 -#ifdef NONBE_FIX_1748_SPAR_DIV_OPT IF( LT_32( norm_fx, EPSILON_FX_THR ) ) { FOR( ch = 1; ch < foa_ch; ch++ ) @@ -4176,136 +4145,7 @@ void ivas_get_spar_md_from_dirac_enc_fx( move32(); } } -#else - FOR( ch = 1; ch < foa_ch; ch++ ) - { - IF( LT_32( norm_fx, EPSILON_FX_THR ) ) - { - IF( response_avg_fx[ch] != 0 ) - { - response_avg_fx[ch] = divide3232( response_avg_fx[ch], EPSILON_FX_THR ); // q15 - move32(); - } - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 - move32(); - } - ELSE IF( GT_32( response_avg_fx[ch], norm_fx ) ) - { - response_avg_fx[ch] = ONE_IN_Q30; // 1 q30 - move32(); - } - ELSE - { - response_avg_fx[ch] = divide3232( response_avg_fx[ch], norm_fx ); // q15 - move32(); - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 - move32(); - } - } -#endif - -#ifndef NONBE_FIX_1748_SPAR_DIV_OPT - - /*normalize 2nd order*/ - norm_fx = 0; - move32(); - Word16 min_ch_order = s_min( hoa2_ch_order, num_ch_order ); - FOR( ch = foa_ch; ch < min_ch_order; ch++ ) - { - norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29 - } - norm_q = sub( 31, ( sub( add( 29, 29 ), 31 ) ) ); - IF( norm_fx ) - { - norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q - } - ELSE - { - norm_fx = EPSILON_FX; - move32(); - } - IF( norm_q < 0 ) - { - norm_fx = L_shr( norm_fx, negate( norm_q ) ); // q31 - norm_q = 0; - move16(); - } - norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30 - min_ch_order = s_min( hoa2_ch_order, num_ch_order ); - FOR( ch = foa_ch; ch < min_ch_order; ch++ ) - { - IF( LT_32( norm_fx, EPSILON_FX_THR ) ) - { - response_avg_fx[ch] = response_avg_fx[ch]; // q30 - response_avg_fx[ch] = divide3232( response_avg_fx[ch], EPSILON_FX_THR ); // q15 - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 - move32(); - move32(); - move32(); - } - ELSE IF( GT_32( response_avg_fx[ch], norm_fx ) ) - { - response_avg_fx[ch] = ONE_IN_Q30; // q30 - move32(); - } - ELSE - { - response_avg_fx[ch] = divide3232( response_avg_fx[ch], norm_fx ); // q15 - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 - move32(); - move32(); - } - } - /*normalize 3rd order*/ - norm_fx = 0; - move32(); - FOR( ch = hoa2_ch_order; ch < num_ch_order; ch++ ) - { - norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29 - } - norm_q = sub( 31, ( sub( add( 29, 29 ), 31 ) ) ); - IF( norm_fx ) - { - norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q - } - ELSE - { - norm_fx = EPSILON_FX; - move32(); - } - IF( norm_q < 0 ) - { - norm_fx = L_shr( norm_fx, negate( norm_q ) ); // q31 - norm_q = 0; - move16(); - } - norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30 - FOR( ch = hoa2_ch_order; ch < num_ch_order; ch++ ) - { - IF( LT_32( norm_fx, EPSILON_FX_THR ) ) - { - response_avg_fx[ch] = response_avg_fx[ch]; // q30 - response_avg_fx[ch] = divide3232( response_avg_fx[ch], EPSILON_FX_THR ); // q15 - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 - move32(); - move32(); - move32(); - } - ELSE IF( GT_32( response_avg_fx[ch], norm_fx ) ) - { - response_avg_fx[ch] = ONE_IN_Q30; // 1 q30 - move32(); - } - ELSE - { - response_avg_fx[ch] = divide3232( response_avg_fx[ch], norm_fx ); // q15 - move32(); - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 - move32(); - } - } -#endif } } @@ -4695,19 +4535,11 @@ void ivas_get_spar_md_from_dirac_fx( { Word32 norm_fx; Word16 norm_q; -#ifdef NONBE_FIX_1748_SPAR_DIV_OPT Word16 num_ch_order, norm_t; Word32 tmp_norm_out; -#else - Word16 num_ch_order, hoa2_ch_order; -#endif num_ch_order = ivas_sba_get_nchan_fx( order, 0 ); -#ifndef NONBE_FIX_1748_SPAR_DIV_OPT - hoa2_ch_order = ivas_sba_get_nchan_fx( SBA_HOA2_ORDER, 0 ); -#else assert( order == 1 ); -#endif FOR( ch = 0; ch < num_ch_order; ch++ ) { @@ -4722,17 +4554,11 @@ void ivas_get_spar_md_from_dirac_fx( } /*normalize 1st order*/ -#ifdef NONBE_FIX_1748_SPAR_DIV_OPT norm_t = L_norm_arr( &response_avg_fx[1], sub( foa_ch, 1 ) ); norm_t = sub( norm_t, 1 ); scale_sig32( &response_avg_fx[1], sub( foa_ch, 1 ), norm_t ); -#endif norm_fx = 0; move32(); -#ifndef NONBE_FIX_1748_SPAR_DIV_OPT - norm_q = 0; - move16(); -#endif FOR( ch = 1; ch < foa_ch; ch++ ) { norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29 @@ -4740,19 +4566,7 @@ void ivas_get_spar_md_from_dirac_fx( norm_q = sub( 31, ( sub( add( 30, 30 ), 31 ) ) ); -#ifdef NONBE_FIX_1748_SPAR_DIV_OPT norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q -#else - IF( norm_fx ) - { - norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q - } - ELSE - { - norm_fx = EPSILON_FX; - move32(); - } -#endif IF( norm_q <= 0 ) { @@ -4762,7 +4576,6 @@ void ivas_get_spar_md_from_dirac_fx( } norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30 -#ifdef NONBE_FIX_1748_SPAR_DIV_OPT IF( LT_32( norm_fx, EPSILON_FX_THR ) ) { FOR( ch = 1; ch < foa_ch; ch++ ) @@ -4781,135 +4594,7 @@ void ivas_get_spar_md_from_dirac_fx( move32(); } } -#else - FOR( ch = 1; ch < foa_ch; ch++ ) - { - IF( LT_32( norm_fx, EPSILON_FX_THR ) ) - { - IF( response_avg_fx[ch] != 0 ) - { - response_avg_fx[ch] = divide3232( response_avg_fx[ch], EPSILON_FX_THR ); // q15 - move32(); - } - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 - move32(); - } - ELSE IF( GT_32( response_avg_fx[ch], norm_fx ) ) - { - response_avg_fx[ch] = ONE_IN_Q30; // 1 q30 - move32(); - } - ELSE - { - response_avg_fx[ch] = divide3232( response_avg_fx[ch], norm_fx ); // q15 - move32(); - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 - move32(); - } - } -#endif -#ifndef NONBE_FIX_1748_SPAR_DIV_OPT - /*normalize 2nd order*/ - norm_fx = 0; - move32(); - Word16 min_ch_order = s_min( hoa2_ch_order, num_ch_order ); - FOR( ch = foa_ch; ch < min_ch_order; ch++ ) - { - norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29 - } - norm_q = sub( 31, ( sub( add( 29, 29 ), 31 ) ) ); - IF( norm_fx ) - { - norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q - } - ELSE - { - norm_fx = EPSILON_FX; - move32(); - } - IF( norm_q < 0 ) - { - norm_fx = L_shr( norm_fx, negate( norm_q ) ); // q31 - norm_q = 0; - move16(); - } - norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30 - min_ch_order = s_min( hoa2_ch_order, num_ch_order ); - FOR( ch = foa_ch; ch < min_ch_order; ch++ ) - { - IF( LT_32( norm_fx, EPSILON_FX_THR ) ) - { - response_avg_fx[ch] = response_avg_fx[ch]; // q30 - response_avg_fx[ch] = divide3232( response_avg_fx[ch], EPSILON_FX_THR ); // q15 - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 - move32(); - move32(); - move32(); - } - ELSE IF( GT_32( response_avg_fx[ch], norm_fx ) ) - { - response_avg_fx[ch] = ONE_IN_Q30; // q30 - move32(); - } - ELSE - { - response_avg_fx[ch] = divide3232( response_avg_fx[ch], norm_fx ); // q15 - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 - move32(); - move32(); - } - } - - /*normalize 3rd order*/ - norm_fx = 0; - move32(); - FOR( ch = hoa2_ch_order; ch < num_ch_order; ch++ ) - { - norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29 - } - norm_q = sub( 31, ( sub( add( 29, 29 ), 31 ) ) ); - IF( norm_fx ) - { - norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q - } - ELSE - { - norm_fx = EPSILON_FX; - move32(); - } - IF( norm_q < 0 ) - { - norm_fx = L_shr( norm_fx, negate( norm_q ) ); // q31 - norm_q = 0; - move16(); - } - norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30 - FOR( ch = hoa2_ch_order; ch < num_ch_order; ch++ ) - { - IF( LT_32( norm_fx, EPSILON_FX_THR ) ) - { - response_avg_fx[ch] = response_avg_fx[ch]; // q30 - response_avg_fx[ch] = divide3232( response_avg_fx[ch], EPSILON_FX_THR ); // q15 - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 - move32(); - move32(); - move32(); - } - ELSE IF( GT_32( response_avg_fx[ch], norm_fx ) ) - { - response_avg_fx[ch] = ONE_IN_Q30; // 1 q30 - move32(); - } - ELSE - { - response_avg_fx[ch] = divide3232( response_avg_fx[ch], norm_fx ); // q15 - move32(); - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 - move32(); - } - } -#endif } } diff --git a/lib_com/options.h b/lib_com/options.h index ba0955304..6de09cbdb 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -95,7 +95,6 @@ * The issue is fixed by simply casting one of the product operands to Word32 in lib_com/basop32.c */ -#define NONBE_FIX_1748_SPAR_DIV_OPT /*Dlb: issue 1748: SPAR common div optimizations*/ #define FIX_ISSUE_1801_NOISE_FLOOR_REDUCTION /* FhG: Fixed getScalefactor usage */ -- GitLab From 00e76c1761ffc87533856ab7f3ac4ccda8cdd052 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 20:11:50 +0200 Subject: [PATCH 33/35] [cleanup] accept FIX_1818_WRONG_PIT_INIT --- lib_com/options.h | 1 - lib_enc/core_switching_enc_fx.c | 12 ------------ lib_enc/rst_enc_fx.c | 8 -------- 3 files changed, 21 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6de09cbdb..586e5c2b1 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -98,7 +98,6 @@ #define FIX_ISSUE_1801_NOISE_FLOOR_REDUCTION /* FhG: Fixed getScalefactor usage */ -#define FIX_1818_WRONG_PIT_INIT /* VA: Fix wrong pitch initialization */ #define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */ diff --git a/lib_enc/core_switching_enc_fx.c b/lib_enc/core_switching_enc_fx.c index 4c0b843e9..46e980f5a 100644 --- a/lib_enc/core_switching_enc_fx.c +++ b/lib_enc/core_switching_enc_fx.c @@ -282,11 +282,7 @@ void core_switching_pre_enc_fx( tmp16 = shr( st_fx->L_frame, 6 ); Copy( st_fx->old_pitch_buf_fx + tmp16, st_fx->old_pitch_buf_fx, tmp16 ); /*Q6*/ -#ifdef FIX_1818_WRONG_PIT_INIT set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR << 6, tmp16 ); -#else - set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR, tmp16 ); -#endif /* Reset old TD BWE buffers */ IF( hBWE_TD != NULL ) { @@ -854,11 +850,7 @@ void core_switching_pre_enc_ivas_fx( } Copy( st_fx->old_pitch_buf_fx + tmp16, st_fx->old_pitch_buf_fx, tmp16 ); -#ifdef FIX_1818_WRONG_PIT_INIT set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR << 6, tmp16 ); -#else - set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR, tmp16 ); -#endif /* Reset old ACELP buffers */ test(); IF( ( st_fx->element_mode == EVS_MONO ) && hLPDmem != NULL ) @@ -908,11 +900,7 @@ void core_switching_pre_enc_ivas_fx( tmp16 = shr( st_fx->L_frame, 6 ); Copy( st_fx->old_pitch_buf_fx + tmp16, st_fx->old_pitch_buf_fx, tmp16 ); -#ifdef FIX_1818_WRONG_PIT_INIT set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR << 6, tmp16 ); -#else - set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR, tmp16 ); -#endif /* Reset old TD BWE buffers */ IF( hBWE_TD != NULL ) { diff --git a/lib_enc/rst_enc_fx.c b/lib_enc/rst_enc_fx.c index 9880084e1..9c5c7263b 100644 --- a/lib_enc/rst_enc_fx.c +++ b/lib_enc/rst_enc_fx.c @@ -53,19 +53,11 @@ void CNG_reset_enc_fx( /* reset the pitch buffer in case of FRAME_NO_DATA or SID frames */ IF( EQ_16( st_fx->L_frame, L_FRAME ) ) { -#ifdef FIX_1818_WRONG_PIT_INIT set16_fx( pitch_buf, L_SUBFR << 6, NB_SUBFR ); -#else - set16_fx( pitch_buf, L_SUBFR, NB_SUBFR ); -#endif } ELSE /* st->L_frame == L_FRAME16k */ { -#ifdef FIX_1818_WRONG_PIT_INIT set16_fx( pitch_buf, L_SUBFR16k << 6, NB_SUBFR16k ); -#else - set16_fx( pitch_buf, L_SUBFR16k, NB_SUBFR16k ); -#endif } set16_fx( voice_factors, 1, NB_SUBFR16k ); -- GitLab From 4d84ca1071c6a180261f742cf71effcc3fb0d454 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 20:12:41 +0200 Subject: [PATCH 34/35] [cleanup] accept FIX_ISSUE_1801_NOISE_FLOOR_REDUCTION --- lib_com/options.h | 1 - lib_dec/ivas_mct_dec_fx.c | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 586e5c2b1..eb678f7c2 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -96,7 +96,6 @@ */ -#define FIX_ISSUE_1801_NOISE_FLOOR_REDUCTION /* FhG: Fixed getScalefactor usage */ #define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */ diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 32bcb918d..e759e6bec 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -293,37 +293,21 @@ ivas_error ivas_mct_dec_fx( Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->old_Aq_12_8_fx, hCPE->hCoreCoder[0]->old_Aq_12_8_fx_32, add( M, 1 ), sub( 28, sub( 15, norm_s( sub( hCPE->hCoreCoder[0]->old_Aq_12_8_fx[0], 1 ) ) ) ) ); Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[1]->old_Aq_12_8_fx, hCPE->hCoreCoder[1]->old_Aq_12_8_fx_32, add( M, 1 ), sub( 28, sub( 15, norm_s( sub( hCPE->hCoreCoder[1]->old_Aq_12_8_fx[0], 1 ) ) ) ) ); ivas_mdct_core_reconstruct_fx( hCPE, x_fx, synth_fx, fUseTns[cpe_id], 1, q_output, e_sig ); -#ifdef FIX_ISSUE_1801_NOISE_FLOOR_REDUCTION Word16 hdrm; -#else - Word16 hdrm, sh; -#endif hdrm = getScaleFactor16( synth_fx[0], hCPE->hCoreCoder[0]->hTcxDec->L_frameTCX ); IF( hdrm != 0 ) { -#ifdef FIX_ISSUE_1801_NOISE_FLOOR_REDUCTION hdrm = sub( hdrm, 1 ); Scale_sig( synth_fx[0], hCPE->hCoreCoder[0]->hTcxDec->L_frameTCX, hdrm ); e_sig[0] = sub( e_sig[0], hdrm ); -#else - sh = s_min( sub( e_sig[0], 16 ), hdrm ); - Scale_sig( synth_fx[0], hCPE->hCoreCoder[0]->hTcxDec->L_frameTCX, sh ); - e_sig[0] = sub( e_sig[0], sh ); -#endif move16(); } hdrm = getScaleFactor16( synth_fx[1], hCPE->hCoreCoder[0]->hTcxDec->L_frameTCX ); IF( hdrm != 0 ) { -#ifdef FIX_ISSUE_1801_NOISE_FLOOR_REDUCTION hdrm = sub( hdrm, 1 ); Scale_sig( synth_fx[1], hCPE->hCoreCoder[1]->hTcxDec->L_frameTCX, hdrm ); e_sig[1] = sub( e_sig[1], hdrm ); -#else - sh = s_min( sub( e_sig[1], 16 ), hdrm ); - Scale_sig( synth_fx[1], hCPE->hCoreCoder[1]->hTcxDec->L_frameTCX, sh ); - e_sig[1] = sub( e_sig[1], sh ); -#endif move16(); } -- GitLab From f03e50f52722c7648865474e784c9011fc7a4dd3 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 2 Aug 2025 20:16:33 +0200 Subject: [PATCH 35/35] formatting --- lib_com/deemph_fx.c | 2 +- lib_com/ivas_dirac_com_fx.c | 12 ++-- lib_com/ivas_spar_com_fx.c | 2 - lib_com/low_rate_band_att_fx.c | 4 +- lib_com/options.h | 17 +----- lib_com/prot_fx.h | 2 +- lib_com/stat_com.h | 2 +- lib_com/tns_base.c | 4 +- lib_dec/FEC_HQ_phase_ecu_fx.c | 4 +- lib_dec/ivas_dirac_dec_fx.c | 2 +- lib_dec/ivas_mct_dec_fx.c | 1 - lib_dec/ivas_mct_dec_mct_fx_fx.c | 3 +- lib_dec/ivas_mdct_core_dec_fx.c | 1 - lib_dec/ivas_svd_dec_fx.c | 4 +- lib_dec/tonalMDCTconcealment_fx.c | 2 +- lib_enc/ACcontextMapping_enc_fx.c | 55 +++++++++---------- lib_enc/find_tilt_fx.c | 6 +- lib_enc/gaus_enc_fx.c | 4 +- lib_enc/ivas_mc_param_enc_fx.c | 1 - lib_enc/stat_noise_uv_enc_fx.c | 8 +-- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 26 ++++----- lib_rend/ivas_dirac_rend_fx.c | 5 +- lib_rend/ivas_objectRenderer_hrFilt_fx.c | 4 +- 23 files changed, 74 insertions(+), 97 deletions(-) diff --git a/lib_com/deemph_fx.c b/lib_com/deemph_fx.c index 9be25cddb..9516202c1 100644 --- a/lib_com/deemph_fx.c +++ b/lib_com/deemph_fx.c @@ -198,7 +198,7 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W FOR( i = 0; i < L; i++ ) { L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/, &Overflow ); /*Qx-shift+16*/ - x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ + x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ move16(); } } diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 4b586b7bf..31e924d06 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -1226,9 +1226,9 @@ void calculate_hodirac_sector_parameters_fx( p_real_fx = Mpy_32_32( sec_w_real_fx, w_fx ); // ( Qfac - 2 ) + 30 - 31 = Qfac - 3 p_imag_fx = Mpy_32_32( sec_w_imag_fx, w_fx ); // ( Qfac - 2 ) + 30 - 31 = Qfac - 3 - temp_x64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_x_real_fx ), p_imag_fx, sec_x_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 - temp_y64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_y_real_fx ), p_imag_fx, sec_y_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 - temp_z64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_z_real_fx ), p_imag_fx, sec_z_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 + temp_x64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_x_real_fx ), p_imag_fx, sec_x_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 + temp_y64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_y_real_fx ), p_imag_fx, sec_y_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 + temp_z64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_z_real_fx ), p_imag_fx, sec_z_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 sec_I_vec_x_64_fx = W_add( sec_I_vec_x_64_fx, temp_x64 ); sec_I_vec_y_64_fx = W_add( sec_I_vec_y_64_fx, temp_y64 ); sec_I_vec_z_64_fx = W_add( sec_I_vec_z_64_fx, temp_z64 ); @@ -1310,9 +1310,9 @@ void calculate_hodirac_sector_parameters_fx( p_real_fx = Mpy_32_32( sec_w_real_fx, w_fx ); // ( Qfac - 2 ) + 30 - 31 = Qfac - 3 p_imag_fx = Mpy_32_32( sec_w_imag_fx, w_fx ); // ( Qfac - 2 ) + 30 - 31 = Qfac - 3 - temp_x64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_x_real_fx ), p_imag_fx, sec_x_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 - temp_y64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_y_real_fx ), p_imag_fx, sec_y_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 - temp_z64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_z_real_fx ), p_imag_fx, sec_z_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 + temp_x64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_x_real_fx ), p_imag_fx, sec_x_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 + temp_y64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_y_real_fx ), p_imag_fx, sec_y_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 + temp_z64 = W_mac_32_32( W_mult_32_32( p_real_fx, sec_z_real_fx ), p_imag_fx, sec_z_imag_fx ); // ( Qfac - 3 ) + ( Qfac - 2 ) + 1 = 2 * Qfac - 4 sec_I_vec_x_64_fx = W_add( sec_I_vec_x_64_fx, temp_x64 ); sec_I_vec_y_64_fx = W_add( sec_I_vec_y_64_fx, temp_y64 ); sec_I_vec_z_64_fx = W_add( sec_I_vec_z_64_fx, temp_z64 ); diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index e11c518c6..69922637d 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -4145,7 +4145,6 @@ void ivas_get_spar_md_from_dirac_enc_fx( move32(); } } - } } @@ -4594,7 +4593,6 @@ void ivas_get_spar_md_from_dirac_fx( move32(); } } - } } diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index e9fc12515..8ffaf0bfb 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -96,7 +96,7 @@ void ivas_fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ @@ -204,7 +204,7 @@ void fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ diff --git a/lib_com/options.h b/lib_com/options.h index eb678f7c2..4cc2a3860 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -71,9 +71,6 @@ #define BASOP_NOGLOB_DECLARE_LOCAL #endif - - - /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define OPT_MCT_ENC_V3_BE #define OPT_BIN_REND_V2_NBE @@ -82,22 +79,9 @@ #define FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN #define FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD - - - #define NONBE_FIX_864_JBM_RENDER_FRAMESIZE /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */ - -/* Info for issue 1816: - * Some compilers do not automatically use 32 bit for 16x16bit products. The code "Word32 c = (Word16) a * (Word16) b;" creates then a 16-bit result, sign-extending the - * lower 16-bit of the product, any upper bits are omitted. Example: Product 0x0100 * 0x0100 results in 0x0001.0000, gets truncated to its lower bits and return 0x0000. - * The issue is fixed by simply casting one of the product operands to Word32 in lib_com/basop32.c - */ - - - - #define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */ #define FIX_1824 @@ -127,6 +111,7 @@ #define NONBE_FIX_1075 /* FhG: fix segfault for bitrate switching + BINAURAL_ROOM_REVERB output in MC */ #define NON_BE_FIX_1041_USE_OLD_CNG_LSPS_IF_NONSTAB /* FhG: fix bug in TD MDCT-Stereo concealment */ #define NONBE_FIX_1063_DIV_BY_ZERO_SUMNRG /* VoiceAge: issue 1063: division by zero for angle_rot feature in the UNCLR classifier */ + /* #################### End BASOP porting switches ############################ */ #endif diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 74a1017be..4b9dbc46e 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -6412,7 +6412,7 @@ void TonalMDCTConceal_Apply( void TonalMDCTConceal_Apply_ivas_fx( TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ Word32 *mdctSpectrum, /*IN/OUT*/ - Word16 mdctSpectrum_exp, /*IN */ + Word16 mdctSpectrum_exp, /*IN */ const PsychoacousticParameters *psychParamsCurrent ); void TonalMDCTConceal_InsertNoise_ivas_fx( diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h index 07ee62965..ffac9308c 100644 --- a/lib_com/stat_com.h +++ b/lib_com/stat_com.h @@ -618,7 +618,7 @@ typedef struct cldfb_filter_bank_struct Word16 ds; /* delay synthesis */ Word16 da; /* delay analysis */ CLDFB_PROTOTYPE prototype; - const Word16 *p_filter; /*!< Pointer to filter coefficients */ // Q15 + const Word16 *p_filter; /*!< Pointer to filter coefficients */ // Q15 const Word32 *p_filter_32; /*!< Pointer to filter coefficients */ // Q15 /* rotation vectors */ diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index 57d9b5b6d..aaf262786 100644 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -1209,7 +1209,7 @@ static Word32 FIRLattice( { tmp = Madd_32_16( state[i], x, parCoeff[i] ); /*Q0*/ x = Madd_32_16( x, state[i], parCoeff[i] ); /* exponent: 31+0 */ - state[i] = tmpSave; /*Q0*/ + state[i] = tmpSave; /*Q0*/ move32(); tmpSave = tmp; /*Q0*/ move32(); @@ -1217,7 +1217,7 @@ static Word32 FIRLattice( /* last stage: only need half operations */ x = Madd_32_16( x, state[order - 1], parCoeff[order - 1] ); /*Q0*/ - state[order - 1] = tmpSave; /*Q0*/ + state[order - 1] = tmpSave; /*Q0*/ move32(); return x; /*Q0*/ diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index 9f1c12faa..5cb2c99dc 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -1197,8 +1197,8 @@ static Word16 imax_fx( /* o: The location, relative to the /* Although the output of ratio() is in Q14, adding the missing factor of 2 (See above) * in the denominator, the output is now considered to be in Q15. */ man = ratio( numer, denom, &expo ); /* The mantissa is considered in Q15 */ - posi = shr_sat( man, expo ); /* in Q15 (Due to saturation, it is automatically bound inside [-1.0,1.0].) */ - if ( sign < 0 ) /* Restore the sign. */ + posi = shr_sat( man, expo ); /* in Q15 (Due to saturation, it is automatically bound inside [-1.0,1.0].) */ + if ( sign < 0 ) /* Restore the sign. */ { posi = negate( posi ); } diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index aa174fe62..915257562 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -1794,7 +1794,7 @@ void ivas_qmetadata_to_dirac_fx( final_1_exp = add( s_max( s_max( sub( 9, norm_op1 ), sub( op2_e, norm_op2 ) ), 0 ), 2 ); // 2 for headroom final_1_32 = L_add( L_shr( azimuth_fx, sub( final_1_exp, 9 ) ), L_shr( tmp1_32, sub( final_1_exp, op2_e ) ) ); - b_tmp = rand_triangular_signed_fx( seed_ptr, &exp_factor ); // q = exp_factor + b_tmp = rand_triangular_signed_fx( seed_ptr, &exp_factor ); // q = exp_factor Word32 tmp4_32 = L_mult( b_tmp, dirac_dithering_ele_scale_fx[diff_idx] ); // exp_factor + 4 Word16 final_2_exp; diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index e759e6bec..a18e9c0f9 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -236,7 +236,6 @@ ivas_error ivas_mct_dec_fx( } ivas_mdct_core_tns_ns_fx( hCPE, fUseTns[cpe_id], tnsData[cpe_id], x_fx, Aq_fx_32[cpe_id], 1, 20 ); - } diff --git a/lib_dec/ivas_mct_dec_mct_fx_fx.c b/lib_dec/ivas_mct_dec_mct_fx_fx.c index 824fa5697..299a09a93 100644 --- a/lib_dec/ivas_mct_dec_mct_fx_fx.c +++ b/lib_dec/ivas_mct_dec_mct_fx_fx.c @@ -165,8 +165,7 @@ void ivas_mct_dec_mct_fx( static void applyGlobalILD_fx( Decoder_State **sts, MCT_DEC_HANDLE hMCT, - Word32 *x[MCT_MAX_CHANNELS][NB_DIV] -) + Word32 *x[MCT_MAX_CHANNELS][NB_DIV] ) { Word16 ch, k; Word16 nSubframes, L_subframeTCX; diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index 458af213e..e63f910c5 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1824,7 +1824,6 @@ void ivas_mdct_core_tns_ns_fx( } TonalMDCTConceal_Apply_ivas_fx( st->hTonalMDCTConc, x_fx[ch][0], x_e, st->hTcxCfg->psychParamsCurrent ); - } test(); diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index c6867d550..3d9d846a6 100644 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -791,11 +791,11 @@ static void ApplyRotation_fx( move32(); Word64 temp = W_mac_32_32( W_mult_32_32( op1, x11 ), op2, x12 ); // Q(singularVector) + op_e - singularVector[ch][currentIndex2] = W_shl_sat_l( temp, op_e ); // Q(singularVector) + singularVector[ch][currentIndex2] = W_shl_sat_l( temp, op_e ); // Q(singularVector) move32(); temp = W_mac_32_32( W_mult_32_32( op1, x12 ), L_negate( op2 ), x11 ); // Q(singularVector) + op_e - singularVector[ch][currentIndex1] = W_shl_sat_l( temp, op_e ); // Q(singularVector) + singularVector[ch][currentIndex1] = W_shl_sat_l( temp, op_e ); // Q(singularVector) move32(); } diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 1f6122f86..16d445b91 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -2589,7 +2589,7 @@ void TonalMDCTConceal_Apply( void TonalMDCTConceal_Apply_ivas_fx( TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ Word32 *mdctSpectrum, // Q31-*mdctSpectrum_exp /*IN/OUT*/ - Word16 mdctSpectrum_exp, /*IN */ + Word16 mdctSpectrum_exp, /*IN */ const PsychoacousticParameters *psychParamsCurrent ) { diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index f96d5d130..051b55981 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -1420,7 +1420,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } } - } /*end of the 2-tuples loop*/ + } /*end of the 2-tuples loop*/ total_output_bits = round_fx( W_shl_sat_l( bit_estimate_fx, -Q7 ) ); /* Q23 -> Q16 -> Q0 */ IF( *stop ) { @@ -1571,7 +1571,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( tot_bits2 = round_fx( W_shl_sat_l( nbits2_fx, -Q7 ) ); /* Q23 -> Q16 -> Q0 */ round_bit_estimate_fx = round_fx( W_shl_sat_l( bit_estimate_fx, -Q7 ) ); /* Q23 -> Q16 -> Q0 */ - if ( LT_16( lastnz2, lastnz ) ) /* Overflow occured because unable to code all tuples */ + if ( LT_16( lastnz2, lastnz ) ) /* Overflow occured because unable to code all tuples */ { overflow_flag = 1; move16(); @@ -1588,37 +1588,36 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } IF( overflow_flag != 0 ) /* Overflow */ { - IF( *stop ) - { - *stop = tot_bits2; /* Q0 */ - move16(); - } - ELSE - { - *stop = round_bit_estimate_fx; - move16(); - } - } - - *lastnz_out = lastnz; /* Q0 */ + IF( *stop ){ + *stop = tot_bits2; /* Q0 */ move16(); - *nEncoded = lastnz2; /* Q0 */ + } + ELSE + { + *stop = round_bit_estimate_fx; move16(); - /* Safety mechanism to avoid overflow */ - test(); - IF( EQ_16( lastnz2, 2 ) && EQ_16( overflow_flag, 1 ) ) - { - FOR( k = 0; k < lastnz2; k++ ) - { - x[k] = 0; - move16(); - } - } + } +} - return tot_bits2; +*lastnz_out = lastnz; /* Q0 */ +move16(); +*nEncoded = lastnz2; /* Q0 */ +move16(); +/* Safety mechanism to avoid overflow */ +test(); +IF( EQ_16( lastnz2, 2 ) && EQ_16( overflow_flag, 1 ) ) +{ + FOR( k = 0; k < lastnz2; k++ ) + { + x[k] = 0; + move16(); } } +return tot_bits2; +} +} + /*-------------------------------------------------------------------* * RCcontextMapping_encode2_estimate_bandWise_start_fx() @@ -1796,7 +1795,7 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( hContextMem->ctx = add( i_mult( s_and( hContextMem->ctx, 0xf ), 16 ), t ); /* Q0 */ move16(); - } /*end of the 2-tuples loop*/ + } /*end of the 2-tuples loop*/ total_output_bits = round_fx( W_shl_sat_l( hContextMem->bit_estimate_fx, -Q7 ) ); /* Q0 */ // total_output_bits = (Word16) ( hContextMem->bit_estimate + 0.5f ); diff --git a/lib_enc/find_tilt_fx.c b/lib_enc/find_tilt_fx.c index 3d9d373ba..77f1b9ad9 100644 --- a/lib_enc/find_tilt_fx.c +++ b/lib_enc/find_tilt_fx.c @@ -322,10 +322,10 @@ void find_tilt_ivas_fx( { sum = W_mac_32_16( sum, pt_bckr[i], inv_bands ); // q_bckr+16 } - lp_bckr = W_shl_sat_l( sum, -16 ); // q_bckr - /*hp_bckr = 0.5f * (bckr[max_band-1] + bckr[max_band]);*/ /* estimated noise E in last 2 critical bands */ + lp_bckr = W_shl_sat_l( sum, -16 ); // q_bckr + /*hp_bckr = 0.5f * (bckr[max_band-1] + bckr[max_band]);*/ /* estimated noise E in last 2 critical bands */ hp_bckr = W_extract_h( W_shl( W_add( W_deposit32_l( bckr[max_band - 1] ), W_deposit32_l( bckr[max_band] ) ), 31 ) ); // q_bckr - if ( hp_bckr == 0 ) /* Avoid division by zero. */ + if ( hp_bckr == 0 ) /* Avoid division by zero. */ { hp_bckr = L_deposit_l( 1 ); } diff --git a/lib_enc/gaus_enc_fx.c b/lib_enc/gaus_enc_fx.c index 2f9a01268..b6ef2d84f 100644 --- a/lib_enc/gaus_enc_fx.c +++ b/lib_enc/gaus_enc_fx.c @@ -363,7 +363,7 @@ void gauss2v_fx( Den = extract_h( L_shl( Lden, exp_den ) ); delta = shr_sat( div_s( Num, Den ), sub( exp_num, exp_den ) ); /* Q15 */ - delta = i_mult2( delta, m_sign ); /* Apply sign Q0*/ + delta = i_mult2( delta, m_sign ); /* Apply sign Q0*/ /* index_delta = (short)(FAC_DELTA * fdelta) */ index_delta = shr( delta, SFAC_DELTA ); @@ -824,7 +824,7 @@ void gauss2v_ivas_fx( Den = extract_h( L_shl( Lden, exp_den ) ); delta = shr_sat( div_s( Num, Den ), sub( exp_num, exp_den ) ); /* Q15 */ - delta = i_mult2( delta, m_sign ); /* Apply sign */ + delta = i_mult2( delta, m_sign ); /* Apply sign */ /* index_delta = (short)(FAC_DELTA * fdelta) */ index_delta = shr( delta, SFAC_DELTA ); diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index b748d26fa..cfd930dc7 100644 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -791,7 +791,6 @@ static void ivas_param_mc_param_est_enc_fx( dmx_imag_64[ch_idx1] = imag_64; move64(); move64(); - } /* Cx for transport channels */ diff --git a/lib_enc/stat_noise_uv_enc_fx.c b/lib_enc/stat_noise_uv_enc_fx.c index a3e5f4bf7..598745ebd 100644 --- a/lib_enc/stat_noise_uv_enc_fx.c +++ b/lib_enc/stat_noise_uv_enc_fx.c @@ -69,8 +69,8 @@ void stat_noise_uv_enc_fx( expd = norm_l( LepsP[1] ); den = extract_h( L_shl_o( LepsP[1], expd, &Overflow ) ); /*expd-16*/ num = div_s( num, den ); /*expn-expd+15*/ - num = shr_sat( num, add( sub( expn, expd ), 5 ) ); /*Q10*/ - num = sub( num, 1024 ); /*num - 1*/ + num = shr_sat( num, add( sub( expn, expd ), 5 ) ); /*Q10*/ + num = sub( num, 1024 ); /*num - 1*/ test(); IF( NE_16( st_fx->bwidth, NB ) ) @@ -142,8 +142,8 @@ void stat_noise_uv_enc_ivas_fx( expd = norm_l( LepsP[1] ); den = extract_h( L_shl_o( LepsP[1], expd, &Overflow ) ); /*expd-16*/ num = div_s( num, den ); /*expn-expd+15*/ - num = shr_sat( num, add( sub( expn, expd ), 5 ) ); /*Q10*/ - num = sub( num, 1024 ); /*num - 1*/ + num = shr_sat( num, add( sub( expn, expd ), 5 ) ); /*Q10*/ + num = sub( num, 1024 ); /*num - 1*/ test(); IF( NE_16( st_fx->bwidth, NB ) ) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index eb8eae8b8..7a12f4192 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -638,9 +638,9 @@ void ivas_dirac_dec_output_synthesis_close_fx( *------------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_process_slot_fx( - const Word32 *reference_power, /* i : Estimated power Q(q_reference_power)*/ + const Word32 *reference_power, /* i : Estimated power Q(q_reference_power)*/ const Word16 *q_reference_power, /* i : Estimated power Q */ - const Word32 *onset, /* i : onset filter Q31*/ + const Word32 *onset, /* i : onset filter Q31*/ const Word16 *azimuth, const Word16 *elevation, const Word32 *diffuseness, /* Q(q_diffuseness)*/ @@ -3517,7 +3517,7 @@ void ivas_lfe_synth_with_filters_fx( { lfeGain_fx = extract_h( BASOP_Util_Divide3232_Scale_newton( hMasaLfeSynth->targetEneLfeSmooth_fx, L_add( EPSILON_FX, hMasaLfeSynth->transportEneSmooth_fx ), &lfeGain_fx_exp ) ); /*Q(31-(lfeGain_fx_exp+hMasaLfeSynth->transportEneSmooth_q-hMasaLfeSynth->targetEneLfeSmooth_q))-16*/ lfeGain_fx_exp = add( sub( hMasaLfeSynth->transportEneSmooth_q, hMasaLfeSynth->targetEneLfeSmooth_q ), lfeGain_fx_exp ); - lfeGain_fx = Sqrt16( lfeGain_fx, &lfeGain_fx_exp ); // Q15-lfeGain_fx_exp + lfeGain_fx = Sqrt16( lfeGain_fx, &lfeGain_fx_exp ); // Q15-lfeGain_fx_exp lfeGain_fx = shr_r_sat( lfeGain_fx, negate( lfeGain_fx_exp ) ); // Q15 } IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( hMasaLfeSynth->targetEneTransSmooth_fx, sub( Q31, hMasaLfeSynth->targetEneTransSmooth_q ), /*EPSILON + */ hMasaLfeSynth->transportEneSmooth_fx, sub( Q31, hMasaLfeSynth->transportEneSmooth_q ) ), 1 ) ) @@ -3529,7 +3529,7 @@ void ivas_lfe_synth_with_filters_fx( { transportGain_fx = BASOP_Util_Divide3232_Scale( hMasaLfeSynth->targetEneTransSmooth_fx, /*EPSILON + */ hMasaLfeSynth->transportEneSmooth_fx, &transportGain_fx_exp ); /*Q=15-(transportGain_fx_exp+hMasaLfeSynth->transportEneSmooth_q-hMasaLfeSynth->targetEneTransSmooth_q)*/ transportGain_fx_exp = add( sub( hMasaLfeSynth->transportEneSmooth_q, hMasaLfeSynth->targetEneTransSmooth_q ), transportGain_fx_exp ); - transportGain_fx = Sqrt16( transportGain_fx, &transportGain_fx_exp ); // q15-transportGain_fx_exp + transportGain_fx = Sqrt16( transportGain_fx, &transportGain_fx_exp ); // q15-transportGain_fx_exp transportGain_fx = shr_r_sat( transportGain_fx, negate( transportGain_fx_exp ) ); // Q15 } j = 0; @@ -3621,17 +3621,17 @@ static void computeTargetPSDs_direct_fx( { cur_idx = imult1616( ch_idx, num_freq_bands ); - v_mult_fixed( direct_power, &direct_responses_square[cur_idx], aux_buffer_res, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ + v_mult_fixed( direct_power, &direct_responses_square[cur_idx], aux_buffer_res, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ scale_sig32( aux_buffer_res, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( common1_q, q_reference_power[0] ) ); /* Q(common1_q) */ scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( common1_q, q_reference_power[1] ) ); /* Q(common1_q) */ - scale_sig32( &cy_auto_dir_smooth[cur_idx], num_freq_bands, sub( common1_q, *q_cy_auto_dir_smooth ) ); /* Q(common1_q) */ - v_add_fixed( &cy_auto_dir_smooth[cur_idx], aux_buffer_res, &cy_auto_dir_smooth[cur_idx], num_freq_bands, Q1 ); /* Q(common1_q) - Q1 */ + scale_sig32( &cy_auto_dir_smooth[cur_idx], num_freq_bands, sub( common1_q, *q_cy_auto_dir_smooth ) ); /* Q(common1_q) */ + v_add_fixed( &cy_auto_dir_smooth[cur_idx], aux_buffer_res, &cy_auto_dir_smooth[cur_idx], num_freq_bands, Q1 ); /* Q(common1_q) - Q1 */ - v_mult_fixed( direct_power, &direct_responses[cur_idx], aux_buffer_res, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ + v_mult_fixed( direct_power, &direct_responses[cur_idx], aux_buffer_res, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ scale_sig32( aux_buffer_res, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( common2_q, q_reference_power[0] ) ); /* Q(common2_q) */ scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( common2_q, q_reference_power[1] ) ); /* Q(common2_q) */ - scale_sig32( &cy_cross_dir_smooth[cur_idx], num_freq_bands, sub( common2_q, *q_cy_cross_dir_smooth ) ); /* Q(common2_q) */ - v_add_fixed( &cy_cross_dir_smooth[cur_idx], aux_buffer_res, &cy_cross_dir_smooth[cur_idx], num_freq_bands, Q1 ); /* Q(common2_q) - Q1 */ + scale_sig32( &cy_cross_dir_smooth[cur_idx], num_freq_bands, sub( common2_q, *q_cy_cross_dir_smooth ) ); /* Q(common2_q) */ + v_add_fixed( &cy_cross_dir_smooth[cur_idx], aux_buffer_res, &cy_cross_dir_smooth[cur_idx], num_freq_bands, Q1 ); /* Q(common2_q) - Q1 */ } /* Q adjustment */ @@ -3721,11 +3721,11 @@ static void computeTargetPSDs_diffuse_fx( { cur_idx = imult1616( ch_idx, num_freq_bands ); - v_multc_fixed( &diffuse_power[start_band], diffuse_responses_square[ch_idx], aux_buffer_res, sub( num_freq_bands, start_band ) ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ + v_multc_fixed( &diffuse_power[start_band], diffuse_responses_square[ch_idx], aux_buffer_res, sub( num_freq_bands, start_band ) ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ scale_sig32( aux_buffer_res, s_min( sub( num_freq_bands, start_band ), CLDFB_NO_CHANNELS_HALF ), sub( common_q, q_reference_power[0] ) ); /* Q(common_q) */ scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( sub( num_freq_bands, start_band ), CLDFB_NO_CHANNELS_HALF ) ), sub( common_q, q_reference_power[1] ) ); /* Q(common_q) */ - scale_sig32( &cy_auto_diff_smooth[cur_idx + start_band], sub( num_freq_bands, start_band ), sub( common_q, *q_cy_auto_diff_smooth ) ); /* Q(common_q) */ - v_add_fixed( &cy_auto_diff_smooth[cur_idx + start_band], aux_buffer_res, &cy_auto_diff_smooth[cur_idx + start_band], sub( num_freq_bands, start_band ), Q1 ); /* Q(common_q) - Q1 */ + scale_sig32( &cy_auto_diff_smooth[cur_idx + start_band], sub( num_freq_bands, start_band ), sub( common_q, *q_cy_auto_diff_smooth ) ); /* Q(common_q) */ + v_add_fixed( &cy_auto_diff_smooth[cur_idx + start_band], aux_buffer_res, &cy_auto_diff_smooth[cur_idx + start_band], sub( num_freq_bands, start_band ), Q1 ); /* Q(common_q) - Q1 */ } /* Q adjustment */ diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index e67287c42..38ffe53d1 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -2081,7 +2081,6 @@ void protoSignalComputation2_fx( stereo_type_detect->subtract_power_y_fx = L_add( stereo_type_detect->subtract_power_y_fx, L_shr( temp, sub( q_temp[qidx], stereo_type_detect->q_subtract_power_y ) ) ); // stereo_type_detect->q_subtract_power_y move32(); } - } /* Compute protos (and their power) for direct sound rendering */ @@ -4302,11 +4301,11 @@ static void ivas_masa_ext_dirac_render_sf_fx( /*Buffer rescaling*/ - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0], DirAC_mem.reference_power_q[0] ), hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0], DirAC_mem.reference_power_q[0] ), hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ) Scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1], DirAC_mem.reference_power_q[1] ), hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ) FOR( i = 0; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - Scale_sig32( DirAC_mem.reference_power_fx + i, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0], DirAC_mem.reference_power_q[0] ), DirAC_mem.reference_power_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ) + Scale_sig32( DirAC_mem.reference_power_fx + i, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0], DirAC_mem.reference_power_q[0] ), DirAC_mem.reference_power_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ) Scale_sig32( DirAC_mem.reference_power_fx + CLDFB_NO_CHANNELS_HALF + i, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1], DirAC_mem.reference_power_q[1] ), DirAC_mem.reference_power_q[1] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q ) } hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] = s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0], DirAC_mem.reference_power_q[0] ); diff --git a/lib_rend/ivas_objectRenderer_hrFilt_fx.c b/lib_rend/ivas_objectRenderer_hrFilt_fx.c index f86973171..39f7d129a 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt_fx.c +++ b/lib_rend/ivas_objectRenderer_hrFilt_fx.c @@ -288,8 +288,8 @@ static void GenerateFilter_fx( move16(); modelEval->BMEnergiesR[i].i = i; move16(); - temp1 = W_add( temp1, modelEval->BMEnergiesL[i].val_fx ); // BMEnergiesL_e - temp2 = W_add( temp2, modelEval->BMEnergiesR[i].val_fx ); // BMEnergiesR_e + temp1 = W_add( temp1, modelEval->BMEnergiesL[i].val_fx ); // BMEnergiesL_e + temp2 = W_add( temp2, modelEval->BMEnergiesR[i].val_fx ); // BMEnergiesR_e } ETotL_e = W_norm( temp1 ); ETotL_e = sub( ETotL_e, 32 ); -- GitLab